Closed meksikanos closed 9 years ago
The series option requires an array of arrays. Just wrap your single series in another set of brackets like this:
echo Highcharts::widget([
'options' => [
'title' => ['text' => 'Sample title - pie chart'],
'plotOptions' => [
'pie' => [
'cursor' => 'pointer',
],
],
'series' => [
[ // new opening bracket
'type' => 'pie',
'name' => 'Elements',
'data' => [
['Firefox', 45.0],
['IE', 26.8],
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
],
] // new closing bracket
],
],
]);
It's easily overlooked if you have only one series because the word is both singular and plural.
my data array passed from controller $ data_name, $ data_numbre, how should I place? thank you
how to replace this 'data' => [ ['Firefox', 45.0], ['IE', 26.8], ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ],
by this [$data_name , $data_numbre ]
thancks
I have the same question.
how to replace this 'data' => [ ['Firefox', 45.0], ['IE', 26.8], ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ],
by this [$data_name , $data_number ] thanks
Anyone found a solution to this?
Hi. I'm trying to run an example code to display 'pie' chart in my Yii2 view file.
Above code renders no chart at all, just title with empty space. I installed the latest version using composer.
Even for another set of data the result is the same - no chart rendered.
In Mozilla Firebug there is no JS errors at all in console.
Btw. Bar type chart is rendering ok. I'm using following code.