Carts are incorrect

For some reason the charts are not matching up with the count values. Please see attached which shows there are 198 How2 content types while there are 682 Articles... Oddly on the graph they seem to have an equal amount of the pie. It seems like it is hitting a maximum value and using that same value of How2, Article and Operational Changes.

I have tried messing around with the view but as far as I can see it is correct. I did have to patch out the pipe for a comma in order to get it working at all...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

13rac1’s picture

Can you post the image URL?

13rac1’s picture

Status: Active » Postponed (maintainer needs more info)
westie’s picture

Really sorry we use it on our Intranet, should I export the view?

13rac1’s picture

The image isn't on your intranet, it is hosted on Google servers. You can post the URL to it.

13rac1’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Re-open if you can supply the URL. Thanks!

capynet’s picture

Title: Incorrect results for the charts » Found the problem
Component: Views integration » Code
Assigned: Unassigned » capynet
Status: Closed (cannot reproduce) » Reviewed & tested by the community
FileSize
11.71 KB
10.62 KB

Pie is taking values without converting they into percentages.
I made a change on the code to fix that (later i will put the patch)

For now works only in php >= 5.3

In chart.module near line 295:

   elseif ($chart['#adjust_resolution']['#adjust'] == TRUE){
      _chart_adjust_resolution($chart['#chart_id'], $chart['#data'], $chart['#adjust_resolution']['#max']);
    }
  }

//Convert data to percentage when its a pie chart
  if (in_array($chart['#type'], array(CHART_TYPE_PIE, CHART_TYPE_PIE_3D))) {
      $total = array_sum($chart['#data']);
      $chart['#data'] = array_map(function($number) use ($total) {
              return number_format($number / $total * 100, 1);
          }, $chart['#data']);
  }
13rac1’s picture

Title: Found the problem » Incorrect results for the charts
Status: Reviewed & tested by the community » Active

Please use a descriptive title and status. Setting title back.

capynet’s picture

Sorry. its my first time and not realized I had changed the status of the issue

Gogowitsch’s picture

There seems to be a problem in the #adjust_resolution code, which the support charting module is using: small numbers seem to be rounded to zero (see attached images)

Gogowitsch’s picture

The issue from #9 had been filed already.

Pierre.Vriens’s picture

Issue summary: View changes
Parent issue: » #2371567: Chart 6.x-2.x Release
Pierre.Vriens’s picture

Title: Incorrect results for the charts » adjust_resolution for pie charts requires conversion
Assigned: capynet » Unassigned
Status: Active » Needs work
apaderno’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
Status: Needs work » Closed (outdated)

I am closing this issue, as Drupal 6 is no longer supported.