Skip to main content
Participant
August 21, 2009
Question

Very simple pie chart?

  • August 21, 2009
  • 1 reply
  • 627 views

I thought this would be easy, but I can't find an example of a very simple pie chart.

I have a simple Access file/table with a record like this:

State     Groundwater     Surfacewater

  Georgia     34     76

So, all I want is a simple pie chart for GA with 2 slices, values of 34 and 76

I tried:

<cfchartseries type="pie" query="totals" valuecolumn="Groundwater sSurfacewater" itemcolumn="State">

and it gets the state name right, but no the data.

It looks like it wants my database records rotated 90 degrees. That is so odd to me, plus my database records are 1 line per state with all the data going out horizontally, not vertically.

How can I just tell it to just use different columns for the data?

And, next I need to do a bar chart of 8 numbers, going horizontally.

Thanks.

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 21, 2009

    Howard Perlman wrote:

    How can I just tell it to just use different columns for the data?


    Charts from queries do not work that way. All of the "values" must be contained in a single column.  So either restructure the table or use a UNION ALL to merge the results into a single column.

    <cfquery...>

    SELECT  State, Groundwater  AS ChartValue

    UNION ALL

    SELECT  State, Surfacewater AS ChartValue

    </cfquery>