Hello,
here's a patch that allows to set all options available for Google Charts (i.e. for Line Chart). There's currently another issue (#1809850: Provide more ability to override chart options) requesting more control over charts as well. However, I create a new issue since the other issue contains patches for Highchart - I don't want to mix them.
What this patch does:
Most important thing: it doesn't break current implementations.
You are now able to add an array to the $options array which is passed to the theme function. This array contains all the options you like. So the $options array passed to the visualization theme could look like this:
$options = array(
'title' => '',
'fields' => array(
'date' => array(
'label' => t('Date'),
),
'count' => array(
'enabled' => TRUE,
'label' => t('Sold Products'),
),
),
'xAxis' => array(
'labelField' => 'date',
),
'data' => $data,
'type' => 'line',
'chart_options' => array(
'backgroundColor' => '#E0E0E0',
'hAxis' => array(
'textPosition' => 'in',
),
)
);
Hope this will be reviewed and committed soon as I have heavy need for this ;)
Kind regards,
haggins
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | visualization-allow-all-google-chart-options-1990614-2.patch | 1.46 KB | haggins |
Comments
Comment #1
haggins commentedComment #2
rooby commentedI think that #1809850: Provide more ability to override chart options should not be highcharts specific, in whcih case this can either be rolled into that one or leverage the changes in that one once it has been committed.
Comment #3
dcmul commented#1: visualization-allow-all-google-chart-options-1990614-2.patch queued for re-testing.
Comment #4
rooby commentedI think this should be marked as a duplicate of #1809850: Provide more ability to override chart options
It provides what this patch adds plus more.
If anyone disagrees please feel free to reopen this.