Hi,
I am using the highcharts library and I'm trying to display multiple series on the same graph.
I am using this patch : https://drupal.org/node/1809850#comment-7577085
I am trying to do this programmatically. I have already managed to set up individual serie charts but I can't figure out how to set up the chart options to handle multiple series.
Does anyone have a working example of the structure of their chart options array?
Here is the kind of array I have at the moment:
$options = array(
'title' => $type,
'fields' => array(
'value' => array(
'label' => t('Value'),
'enabled' => TRUE,
),
),
'xAxis' => array(
'categories' => $data['x'], // Something like array('January', 'February', 'March')
),
'yAxis' => array(
'labelField' => '',
),
'type' => 'line',
'chart_options' => array(
'chart' => array(
'plotBackgroundColor' => NULL,
'backgroundColor' => NULL,
'margin' => array(0, 0, 10, 0),
'height' => 250
),
'title' => array(
'style' => '{font-size: 10px;}'
),
'series' => array(
0 => array(
'name' => 'Paris',
'data' => array(
0 => '100',
1 => '150',
2 => '220'
)
),
1 => array(
'name' => 'London',
'data' => array(
0 => '200',
1 => '130',
2 => '140'
)
)
)
)
);
Thanks,
Chris
Comments
Comment #1
rongok commentedHere is how I do to display multiple series on the same graph. I am not using any patch.
Comment #2
ouissla commentedThank you! this works great.
Comment #3
rongok commentedGlad that it works out for you.
Comment #4
ylys commentedHi, guys
Where you write this code for displaying charts?
I use visualisation in views, but I don't understand how should I customize Highcharts options.
Thanks.
Comment #5
ouissla commentedHi ylys,
This code can be used if you create your chart programmatically. Take a look at this page: http://webwash.net/tutorials/intro-visualization-api-part-2-highcharts-and-code
This should help you.
Chris