Create a chart with SQL - 11.x
Summary
The Chart macro combined with the SQL macro provides powerful visual reporting capabilities. These macros were designed to work together. The SQL macros produce standard Confluence tables. The Chart macro produces charts from tables included in its macro body. Of course, the parameters of the Chart macro must define a chart that can be produced from the format of the table (or tables) included in the chart macro body. So part of the challenge is to define the chart correctly to match with your table(s) produced by the SQL macros and this depends on what you are trying to do and how you have constructed the SQL. The Chart macro has a number of parameters that can be adjusted to accommodate different table arrangements. This article explains some simple examples to get started.
Step | Description |
|---|---|
Create a new page. |
|
Add a Chart from Table macro. |
|
Create a small example table in the Chart macro body. |
|
Verify the chart displays correctly. |
|
Add a SQL Query macro outside the Chart macro body. | This is to ensure that the SQL Query macro is going to produce the correct format of the table. |
Build your query in the SQL Query macro body by using the available tables, views and columns, and, select lists in SQL statement. | The ability to add required tables and columns from the available select lists in SQL statement is added in SQL 10.1 release. |
Verify it produces the same table structure as the test table. | Now, you should have both macros configured correctly. |
Combine the macros - this is the critical step! | Drag and drop the SQL macro into the body of the Chart macro (discard or save the test data somewhere else). |
Need support? Create a request with our support team.
