View Page
Export to PDF
Version history
View ownership
Content Information
View Source
Content
…
SQL for Confluence
Release documentation
Server/DC
8.x
User's Guide - 8.x
Tutorials
How to
How to create a chart with SQL
Content Comparison
Versions Compared
Version
Old Version
1
New Version
2
Changes made by
Bob Swift
Bob Swift
Saved on
Mar 12, 2015
Mar 12, 2015
Next Change: Difference between versions 2 and 3
View Version History
Key
This line was added.
This line was removed.
Formatting was changed.
...
Table plus
autoNumber
true
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
Example SQL
Code Block
sql
sql
select product as "Product", revenue as "Revenue" from revenue
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)
...
Chart
dataDisplay
after
legend
false
width
500
attachmentVersion
replace
dataOrientation
vertical
height
500
pieSectionLabel
%0% (%2%)
xthumbnail
true
Products
Product
Revenue
A
234,300
B
346,212
C
224,564
General
Content
Integrations
App links
{"serverDuration": 932, "requestCorrelationId": "cf4f9f54ed6b4d119fcc6fa4fa6154cb"}