4 Replies Latest reply on Jan 28, 2007 6:11 AM by BKBK

    same item column(s) different valuecolumns

    Ponybuttons
      When trying to output a chart with the same itemcolumn values, but different valuecolumn values cfchart only graphs the second one. I would expect to get two slices of apples, one equaling 10, the other 15, but I only get the 15. I'd even settle for 25 apples!

      apples - 10
      apples - 15
      oranges - 20

      <cfscript>
      level = queryNew('howmany,name');
      queryAddRow(level);
      querySetCell(level, 'howmany','10');
      querySetCell(level, 'name','Apples');

      queryAddRow(level);
      querySetCell(level, 'howmany','15');
      querySetCell(level, 'name','Apples');

      queryAddRow(level);
      querySetCell(level, 'howmany','20');
      querySetCell(level, 'name','Oranges');
      </cfscript>

      <cfdump var="#level#">

      <cfchart show3d="true" format="flash" chartwidth="800" chartheight="550">
      <cfchartseries type="pie"
      query="level"
      itemcolumn="name"
      valuecolumn="howmany">
      </cfchartseries>
      </cfchart>



      <cfchart show3d="true" format="flash" chartheight="500" chartwidth="500">
      <cfchartseries type="bar"
      query="level"
      itemcolumn="name"
      valuecolumn="howmany">
      </cfchartseries>
      </cfchart>

      how do you like them apples? I don't like them apples!
        • 1. same item column(s) different valuecolumns
          BKBK Adobe Community Professional & MVP
          Make the names distinct. Change the lines querySetCell(level, 'name','Apples'); and querySetCell(level, 'name','Apples'); , respectively, to querySetCell(level, 'name','Apples_1'); and querySetCell(level, 'name','Apples_2');.



          • 2. Re: same item column(s) different valuecolumns
            Ponybuttons Level 1
            Yeah, that would fix it, the problem is this for dynamic reports where users enter what they wish in the name field, and sometimes want to have the same name twice. I don't want to munge through the return set and add random bits to names that are the same for a variety of reasons.
            A: Performance (some of these result sets are huge)
            B: The end users would complain anyway
            C: I shouldn't have to, I should get three slices.

            I think this is a bug in cfchart. When i graph a similiar recordset in Excel, it shows three slices. ChartFx also shows three slices.

            ColdFusion and Flex both show two slices. Ironically, CF always displays the last value in the recordset, Flex displays the highest value regardless of position..
            • 3. Re: same item column(s) different valuecolumns
              MikerRoo Level 1
              This absolutely is a bug (confirmed in CF 7.02).
              CF does not pass the correct data to the underlying WebCharts engine. The Webcharts engine displays duplicate slices correctly (if it gets them).

              Report this at http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform .
              Be sure to mention how much time and/or dollars this has cost you.

              In the meantime use the attached code code as one possible workaround.
              • 4. same item column(s) different valuecolumns
                BKBK Adobe Community Professional & MVP
                I'm not aware that this is a confirmed bug. Bug or not, what is commonly known is that cfchart uses just a fraction of the functionality Coldfusion gets from the WebCharts engine. It is not easy to tell when a deficiency of the tag is by design or when it is a bug.

                However, Coldfusion redeems itself a little. You can use its webcharts engine to build your own custom charts, as MikerRoo has hinted. If you're on Windows, all you need to do is to double-click on C:\CFusionMX7\charting\webcharts.bat. You should then get a webcharts interface.

                Choose a chart-type from the Chart Gallery and press OK. You can customize the chart by changing the values in the Property/Value table in the Design tab. The engine registers such changes automatically in the Code View tab. For more on the classes in the code, have a look at the WebCharts3D v5.0 Developer’s Guide.

                Here is an example based on your query.