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. We will show some simple examples here to get started.
Steps
Table plus |
---|
|
Step | Description |
---|
Create a new page | | Add a chart macro | - Set the chart type, this example uses a pie chart
- Edit other parameters as needed
- For this example
- Set Content orientation to vertical - this is required because we want to use table rows for the values
- Optional: Set Pie section label to %0% (%2%)
| Create a small example table in the chart macro body | - This is just a quick way to get the chart defined and working
- Use insert table with a few rows and columns (see example below)
- The test data needs to match the requirements of the chart type you have selected!
| Verify the chart display correctly | | Add a sql-query macro outside the chart macro body | - We are going to test to ensure that the sql-query macro is going to produce the correct format of table
| Add you query to the sql-query macro body | | 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! | - Cut and paste the sql-macro into the body of the chart macro (discard or save the test data somewhere else)
|
|
...
dataDisplay | after |
---|
legend | false |
---|
width | 500 |
---|
attachmentVersion | replace |
---|
dataOrientation | vertical |
---|
height | 500 |
---|
pieSectionLabel | %0% (%2%) |
---|
xthumbnail | true |
---|
...
Include Page |
---|
| SUPPORT:How to create a chart with SQL - 8.x |
---|
| SUPPORT:How to create a chart with SQL - 8.x |
---|
|