Download & Extend

Is there some way to append additional Google Chart API parameters not presented by Chart API?

Project:Google chart API
Version:6.x-1.x-dev
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I see the $attributes param which adds html attributes to the resultant chart's img tag. Is there an equivalent concept for adding Google Chart params that are not covered by the Chart module?

Ex. I need to add chds=0,9000 but can't see where. (yes, I see #536472: Add support for data scaling (chds) parameter. (patch attached) adding specifically this one parameter, but maybe it's still useful to have a "backdoor" for additional params?)

Comments

#1

For instance, in addition to the current labels (label + position), I also seem to need chxr which seems to be provided only when a generic label range is used.

#2

Subscribing. I like this idea but from memory (only) I think that each parameter needs more than just being thrown into an arguments array, so I don't think it'll be as simple as we might hope.

+1 for Google Chart API to add some methods for adding arbitrary / custom params and / or hooks for implementing external aspects.

#3

+1.

The module should have another _alter hook that would allow to modify the $data array build with the url attributes.

#4

Status:active» needs review

Example patch.

A simple inplementation of the #scale param would be.

<?php
/**
* Implementation of hook_chart_after_build().
*/
function chart_extra_chart_after_build($chart_id, $chart, &$data) {
  if ($chart['#scale']) {
    $data['chds'] = implode(',', $chart['#scale']);
  }
}
AttachmentSize
1109472-chart-after-build.patch 794 bytes

#5

I don't know if this is the right place for this, but I'm having trouble getting the correct data labels on my bar chart. After I applied '#adjust_resolution', my data does display properly, but with the following code, it only displays the scaled values on the labels (i.e. between 0 and 100) and not the actual values.

<?php
$chart
['#shape_markers'][] = array('N','f3f3e4', 0, 0, 20, '', 're');
#also tried this, but basically just returned the same value with a dollar sign in front
$chart['#shape_markers'][] = array('N*cUSD0*','f3f3e4', 0, 0, 20, '', 're');
?>

I applied the chds patch and tried a few things out, but no cigar. Any ideas on how the get the correct values on my labels?

#6

Version:6.x-1.3» 6.x-1.x-dev
Status:needs review» fixed

Committed to 6.x-1.x and 7.x-1.x with minor modification.

<?php
   
// Creates hook_chart_post_build($chart_id, &$chart, &$data)
   
foreach (module_implements('chart_post_build') as $module) {
     
$function = $module . '_chart_post_build';
     
$function($chart['#chart_id'], $chart, $data);
    }
?>

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.