我已尝试使用此代码更改颜色:
<?php
echo GoogleChart::widget(array('visualization' => 'PieChart',
'data' => array(
array('Task', 'All Statuses'),
// array('Picked Up', (int) $all_vehicle['picked_up']),
array('Car on Way', (int) $all_vehicle['car_on_way']),
array('Shipped', (int) $all_vehicle['shipped']),
array('On Hand', (int) $all_vehicle['on_hand']),
),
'options' => array('title' => 'All','width' => 442, 'height' => 400, 'pieHole' => 0.4, 'seriesColors' => [ "#000", "#000", "#000", "#000" ])
));
?>
使用此数组更改颜色
seriesColors' => [ "#000", "#000", "#000", "#000" ])
答案 0 :(得分:1)
您必须使用选项color
而不是seriesColor
作为插件的选项,请参阅DOCS
。所以将您的小部件代码更改为以下
<?php
echo GoogleChart::widget(array('visualization' => 'PieChart',
'data' => array(
array('Task', 'All Statuses'),
// array('Picked Up', (int) $all_vehicle['picked_up']),
array('Car on Way', (int) $all_vehicle['car_on_way']),
array('Shipped', (int) $all_vehicle['shipped']),
array('On Hand', (int) $all_vehicle['on_hand']),
),
'options' => array(
'title' => 'All',
'width' => 442,
'height' => 400,
'pieHole' => 0.4,
'colors'=> ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']
)
));
?>