Highlighted

Pie chart using CFCHART with any 0 data values failing

Community Beginner ,
Mar 01, 2018

Copy link to clipboard

Copied

This is a problem that was first observed with CF8 using the cfchart tag. We have since upgraded to CF2016 and it still exists. Perhaps this is a programming error on our part but here is the issue:

Trying to create a pie chart. In this case I has 4 data items. Two of them have 0 values and the other two each have a value of 50 (representing percentages).

This is in response to a title to this posing as a question... How do you feel today?

<cfsavecontent variable="chartContent">
  <cfchart format="png" pieslicestyle="solid" width="400" height="280">

    <cfchartseries type="pie">

      <cfchartdata item="Terrific!" value="0">

      <cfchartdata item="OK" value="50">

      <cfchartdata item="Not so good" value="50">

      <cfchartdata item="Terrible!" value="0"> 

    </cfchartseries>

  </cfchart>

</cfsavecontent>

I don't know if the cfsavecontent has any bearing on this but I left it in because we use it to place the chart on a template page.

This is what I get for the results:

This is completely wrong!

  • The color mapping shows one color not two.
  • The color choice is wrong for either of the 50% values, suggesting 100% have a value of "Terrible!"

Is this a bug?

We have observed this with other quantity of answer options.

We have seen it wrong with one of the 4 having a non-0 value but the rest are 0 values.

The only work around we have found is to always place non-0 values last in the list.

So changing the data order around...

<cfsavecontent variable="chartContent">

  <cfchart format="png" pieslicestyle="solid" width="400" height="280">

    <cfchartseries type="pie">

      <cfchartdata item="Terrible!" value="0"> 

      <cfchartdata item="Terrific!" value="0">

      <cfchartdata item="OK" value="50">

      <cfchartdata item="Not so good" value="50">

    </cfchartseries>

  </cfchart>

</cfsavecontent>

Then you get this pie chart:

At least the color mapping is correct but the answer options have to be rearranged so that all 0 value data items are at the top of the list.

If it was the opposite where only items at the top of the list were colored it would be better but having to rearrange the order to put non-0 data as the last in the list of cfchartdata is a terrible hack!

Having incorrect color mapping as in the desired implementation shown first above is just unusable!!

I'm hoping there is a simple fix to making this work but if this is a bug... Adobe, please fix ASAP!

I'm also surprised no one else has found this or reported this that I can find so it gives me hope that there is a simple fix to what we are doing.

Views

756

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Pie chart using CFCHART with any 0 data values failing

Community Beginner ,
Mar 01, 2018

Copy link to clipboard

Copied

This is a problem that was first observed with CF8 using the cfchart tag. We have since upgraded to CF2016 and it still exists. Perhaps this is a programming error on our part but here is the issue:

Trying to create a pie chart. In this case I has 4 data items. Two of them have 0 values and the other two each have a value of 50 (representing percentages).

This is in response to a title to this posing as a question... How do you feel today?

<cfsavecontent variable="chartContent">
  <cfchart format="png" pieslicestyle="solid" width="400" height="280">

    <cfchartseries type="pie">

      <cfchartdata item="Terrific!" value="0">

      <cfchartdata item="OK" value="50">

      <cfchartdata item="Not so good" value="50">

      <cfchartdata item="Terrible!" value="0"> 

    </cfchartseries>

  </cfchart>

</cfsavecontent>

I don't know if the cfsavecontent has any bearing on this but I left it in because we use it to place the chart on a template page.

This is what I get for the results:

This is completely wrong!

  • The color mapping shows one color not two.
  • The color choice is wrong for either of the 50% values, suggesting 100% have a value of "Terrible!"

Is this a bug?

We have observed this with other quantity of answer options.

We have seen it wrong with one of the 4 having a non-0 value but the rest are 0 values.

The only work around we have found is to always place non-0 values last in the list.

So changing the data order around...

<cfsavecontent variable="chartContent">

  <cfchart format="png" pieslicestyle="solid" width="400" height="280">

    <cfchartseries type="pie">

      <cfchartdata item="Terrible!" value="0"> 

      <cfchartdata item="Terrific!" value="0">

      <cfchartdata item="OK" value="50">

      <cfchartdata item="Not so good" value="50">

    </cfchartseries>

  </cfchart>

</cfsavecontent>

Then you get this pie chart:

At least the color mapping is correct but the answer options have to be rearranged so that all 0 value data items are at the top of the list.

If it was the opposite where only items at the top of the list were colored it would be better but having to rearrange the order to put non-0 data as the last in the list of cfchartdata is a terrible hack!

Having incorrect color mapping as in the desired implementation shown first above is just unusable!!

I'm hoping there is a simple fix to making this work but if this is a bug... Adobe, please fix ASAP!

I'm also surprised no one else has found this or reported this that I can find so it gives me hope that there is a simple fix to what we are doing.

Views

757

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 01, 2018 0
Community Beginner ,
Oct 15, 2018

Copy link to clipboard

Copied

I know this is a bit old, but I came across the same issue while updating our charts to CF2016. I did a lot of tests and this same thing happens  even if the number is not exactly 0.

If you divide the slice value by the sum of all slice values in the chart, it breaks when you get to a percentage that is equal to or less than 5 0's behind the decimal.

examples:

Sum of slices = 9000000 lowest single slice value is 90 which equals 0.00001  Chart works fine.

Change the lowest slice value to 81 and you get 0.000009 - Chart breaks and shows the whole pie as the last color value.

We are on the latest patches of CF2016 and hopeful that a bug has been or can be logged to resolve this. We have spent an inordinate amount of time chasing down what was an intermittent issue.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 15, 2018 1
Community Beginner ,
Oct 15, 2018

Copy link to clipboard

Copied

For our purposes, I created a function to modify the numbers so the chart does not break. It is a small difference and not noticeable in the chart. I do not use the value in a tooltip or legend because it would be wrong. But here it is in case it helps anyone else in this weird edge case.

<cffunction name="FixPieChart">

    <cfargument name="totalVal" required="true">

    <cfargument name="sliceVal" required="true">


    <cfset var evalNum = arguments.sliceVal / arguments.totalVal>

    <cfset var ret = ''>


    <cfif evalNum lt .000019>

        <cfset ret = totalVal * .000019>

    <cfelse>

        <cfset ret = sliceVal>

    </cfif>


    <cfreturn ret>

</cffunction>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 15, 2018 0
New Here ,
Oct 15, 2018

Copy link to clipboard

Copied

We found we solved our issues mostly by switching from format=”jpeg” to

format=”html”.

Paul Gillen

Trusted Employees | Rental History Reports

Director of Information Technology

Corporate HQ: 7900 West 78th St, Ste 400 | Edina, MN 55439

Direct: 952-259-3007 | Fax: 952-259-3007

Websites: www.trustedemployees.com | www.rentalhistoryreports.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 15, 2018 0
siebels LATEST
Community Beginner ,
Oct 22, 2018

Copy link to clipboard

Copied

Thanks paulg58834100 that did not work in our case as we are embedding into PDFs for reporting so we use format="png"

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 22, 2018 0
Adobe Community Professional ,
Oct 21, 2018

Copy link to clipboard

Copied

bruceh3555​, I suspect that what you have found is a ColdFusion bug. Report it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 21, 2018 1
Community Beginner ,
Oct 21, 2018

Copy link to clipboard

Copied

Done.  Tracker

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 21, 2018 2