In my humble opinion...

this module must have a major revision in array structures on recieving chart data because its confusing and hard to codes, especially if your codes is dynamic and using looping function to build the chart.

instead of adding chart data per index, chart color per index, chart label per index heres what I like to propose:

$chart = array(
  // insert chart option here
  '#chart_id' => 'test_chart',
  '#title' => chart_title(t('Servings'), 'cc0000', 15),
  '#type' => CHART_TYPE_PIE,
  '#size' => chart_size(400, 200),
);

$chart['#value'] = array(
  0 => array(
    '#data' => 'value here',
    '#label' => t('label here'),
    '#data_colors' => '#FFFFFF', // colors here
  ),
  1 => array(
    '#data' => 'value here 1',
    '#label' => t('label here 1'),
    '#data_colors' => '#FFFFFF', // colors here
  ),
  // ...
  n => array(
    '#data' => 'value here 1',
    '#label' => t('label here 1'),
    '#data_colors' => '#FFFFFF', // colors here
  ),
);

echo chart_render($chart);

Comments

13rac1’s picture

I agree, this module needs to be rewritten. The Google Chart API Image is deprecated. Any rewrite needs to support the new JavaScript Google Chart Tools: https://developers.google.com/chart/

voj’s picture

Title: Rebuild array structure into more friendly structure » Rewrite module to support the new Google Chart API
Priority: Normal » Major

Oh, I didn't realize that the google image chart api is now deprecated. Well this needs to be prioritized.

After searching on Google APIs I found this link:
https://developers.google.com/chart/image/

with a message of:
Important: The Image Charts portion of Google Chart Tools has been officially deprecated as of April 20, 2012. It will continue to work as per our deprecation policy.

Though the image chart API still available for usage(I think for 3 years after deprecation), this must rewritten as soon as possible.

13rac1’s picture

Status: Active » Closed (duplicate)

There is already an issue for support of the JavaScript version: #1196712: New Interactive Google Charts API? Plus, support for Drupal 6 itself ends when Drupal 8 is released hopefully about the end of 2013: http://buytaert.net/drupal-8-feature-freeze-extended

Pierre.Vriens’s picture

Title: Rewrite module to support the new Google Chart API » Array structure revision
Issue summary: View changes
Status: Closed (duplicate) » Needs work
Parent issue: » #2368793: Chart 2.0

I'd like to consider the original request in this issue in the context of the parent issue I'm adding here, also because of the 1st phrase in #1. Therefor I'm restoring the issue title to a variation of the original title (and reopen it). Issue #1196712: New Interactive Google Charts API? mentioned in #3 is indeed the issue to refer to related to addressing the depreciated Google Chart API, so I suggest to not longer consider that part in the previous comments as part of what "this" issue is about. After about 2 years, we now know that the last phrase in #3 is not really correct anymore: hopefully D8 will be released in 2015 (it is now in a early beta version), while some level of continued D6 support has been announced.

With that, in my humble opinion also, there is nothing "blocking" anymore to have somebody like @voj to start contributing to the (revised) title of this issue.

The thing I'd be curious about is this: what would the migration path look like for existing chart users to something using the revised array structure? Different from starting from scratch I'd hope ...

apaderno’s picture

Status: Needs work » Closed (outdated)

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