Create a chart with SQL - 11.x

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

Step

Description

Create a new page.

 

Add a Chart from Table 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 Display rendered data to 'after'.

    • Optional: Set Pie section label to '%0% (%2%)'.

      SQL_10.1_Ex_Chart.gif

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.

  • The test data must match the requirements of the chart type you have selected.

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.

SQL_10.1_Ex_Query_Chart.gif

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.

Copyright © 2005 - 2025 Appfire | All rights reserved.