gchart
gchart copied to clipboard
Otions are not working
I want to create area chart with dual y-axis with below following code.But it will return the chart with only one y-axis
$total_trans_sales_chart = array( 'labels' => array( array('string' => 'Sample'), array('number' => 'Total Transactions'), array('number' => 'Total Amount') ), 'data' => array(), 'options' => array( 'vAxes' => array( array('viewWindowMode' => 'explicit' , 'viewWindow' => array('max' => 500, 'min' => 10), 'gridlines' => array('color' => 'transparent')), array('gridlines' => array('color' => 'transparent')) ), 'series' => array(array('targetAxisIndex' => 0),array('targetAxisIndex' => 1)), 'colors' => array('yellow', 'blue'), 'chartArea' => array('left' => 100, 'top' => 100, 'width' => 100, 'height' => 100), ), 'title' => 'Total Transactions and Sales', 'type' => 'area' ); foreach($transaction_details as $key => $transaction){ $total_trans_sales_chart['data'][$key][0] = $this->getStartAndEndDateByWeekNumber($transaction[0]['type']);//$transaction[0]['type']; $total_trans_sales_chart['data'][$key][1] = $transaction[0]['total']; $total_trans_sales_chart['data'][$key][2] = $transaction[0]['total_sum']; }
Can you post the html output from the helper, and also verify that you can do what you are trying to do without the helper (ie with just the JS api that this helper wraps)?
thank you. here is the generated code
this is my cakephp array format
Array ( [title] => Total Transactions and Sales [type] => area [labels] => Array ( [0] => Array ( [string] => Sample )
[1] => Array
(
[number] => Total Transactions
)
[2] => Array
(
[number] => Total Amount
)
)
[data] => Array
(
[0] => Array
(
[0] => Nov 28 to Dec 04
[1] => 10
[2] => 13637.34
)
[1] => Array
(
[0] => Dec 05 to Dec 11
[1] => 112
[2] => 464539.20
)
[2] => Array
(
[0] => Dec 12 to Dec 18
[1] => 149
[2] => 897089.20
)
[3] => Array
(
[0] => Dec 19 to Dec 25
[1] => 73
[2] => 121864.27
)
[4] => Array
(
[0] => Dec 26 to Jan 01
[1] => 1
[2] => 699.00
)
)
[options] => Array
(
[vAxes] => Array
(
[0] => Array
(
[viewWindowMode] => explicit
[gridlines] => Array
(
[color] => transparent
)
)
[1] => Array
(
[gridlines] => Array
(
[color] => transparent
)
)
)
[series] => Array
(
[0] => Array
(
[targetAxisIndex] => 0
)
[1] => Array
(
[targetAxisIndex] => 1
)
)
[colors] => Array
(
[0] => yellow
[1] => blue
)
[chartArea] => Array
(
[left] => 100
[top] => 100
[width] => 100
[height] => 100
)
)
)