Copy link to clipboard
Copied
Hi,
I'm trying to use <cfchart> to create a pie chart from a query that shows 3 wedges with 3 different values. I can't for the life of me figure out how to do this. Here is my code:
<cfchart format="png" chartheight="150" chartwidth="200">
<cfchartseries type="pie" query="qCompanyStatus">
</cfchart>
The query returns 1 row with 4 columns
CompanyName | NumberStarted | NumberInProgress | NumberComplete
ABC Company, 4, 5, 9
I'd like to display a pie chart with three wedges showing the values in each of these columns.
How can I do this? It seems there is only an itemcolumn and valuecolumn, I need to display multiple values here and just not sure how to do it. It must be something simple.
Any help highly appreciated...
Thanks
1) Generate the cfchartdata elements yourself
<cfchartseries type="pie">
<cfloop query="qCompanyStatus">
<cfchartdata item="#CompanyName#" value="#NumberStarted#">
<cfchartdata item="#CompanyName#" value="#NumberInProgress#">
....
</cfloop>
</cfchartseries>
2) Reformat the query results to return a single value column.
ABC Company, 4
ABC Company, 5
ABC Company, 9
Copy link to clipboard
Copied
1) Generate the cfchartdata elements yourself
<cfchartseries type="pie">
<cfloop query="qCompanyStatus">
<cfchartdata item="#CompanyName#" value="#NumberStarted#">
<cfchartdata item="#CompanyName#" value="#NumberInProgress#">
....
</cfloop>
</cfchartseries>
2) Reformat the query results to return a single value column.
ABC Company, 4
ABC Company, 5
ABC Company, 9
Copy link to clipboard
Copied
Thanks.. that worked. Appreciated very much!