Create a Pie chart using the SQL macro
Scenario
Estimated Time: 13 min
As an example, let's create a Pie chart to display "Book Print Operational Costs".
Background
Our scenario uses a data source profile, BookWarehouse, to query a database table, PRINTOPERATION. The table contains current minimum, maximum, and, average operational costs associated with the printing and go-to-market costs for books.
For this scenario, we focus on charting the current average market costs for each type of print operation.
SQL > mysql> select po_book_id, printoperation, avgcost from printoperation; +------------+-----------------------+----------+ | po_book_id | printoperation | avgcost | +------------+-----------------------+----------+ | 2 | Developmental Editing | 18000.00 | | 3 | Copyediting | 7000.00 | | 4 | Cover Design | 3500.00 | | 5 | Formatting | 2500.00 | | 6 | Illustrations | 4000.00 | | 7 | ISBN Registration | 250.00 | | 8 | Marketing & PR | 5000.00 | +------------+-----------------------+----------+
For more information about data source profiles, click the appropriate version:
Our query against the PRINTOPERATION table looks like:
SELECT printoperation as "Service" ,format(avgcost,0) AS "Cost" FROM printoperation;
Steps
The following steps demonstrate how to use Markup to insert Confluence's native Chart macro and our SQL macro on a Confluence page: