[size="6"]Background: [/size]
The original extention only consider core packages. But sometimes we need import different package, such as Gauge.
[size="6"]Solution:[/size]
1. Add one var
public $packages = ‘corechart’; // such as ‘orgchart’ and so on.
2. Change registerScript action to below to dynamic attach packages
$cs->registerScript(
__CLASS__ . '#' . $id, 'google.load("visualization", "1", {packages:["'. [b]$this->packages[/b] .'"]});', CClientScript::POS_HEAD
);
3. examples:
$this->widget(‘yiiwheels.widgets.google.WhVisualizationChart’,
array('visualization' => 'Gauge','packages'=>'gauge',
'data' => array(
array('Label', 'Value'),
array('Memory', 80),
array('CPU', 55),
array('Network', 68),
),
'options' => array(
'width' => 400,
'height' => 120,
'redFrom' => 90,
'redTo' => 100,
'yellowFrom' => 75,
'yellowTo' => 90,
'minorTicks' => 5
)
));