通过javascript更新yiiwheels highchart

时间:2014-07-25 06:30:08

标签: javascript php jquery highcharts

我使用yiiwheels的高图小工具(Yii框架的扩展名):

<?php $this->widget('yiiwheels.widgets.highcharts.WhHighCharts',array(
'pluginOptions' => array(
            'title' => array('text' => 'Fruit Consumption'),
            'xAxis' => array('categories' => array('Apples', 'Bananas', 'Oranges')),
            'yAxis' => array('title' => array('text' => 'Fruit eaten')),
            'series' => array(
                array('name' => 'Jane', 'data' => array(1, 0, 4)),
                array('name' => 'John', 'data' => array(5, 7, 3))
            )
        )
    ));?>
echo TbHtml::button('Refresh Chart', array('id'=>'refreshButton')); ?>

<script type="text/javascript">
    $('#refreshButton').click(function() {
        var chart = $('#container').highcharts(); // THIS IS NOT WORKING, HELP!!!
        chart.series[0].setData([129.2, 144.0, 176.0, 135.6, 148.5] ); // sample data
});
</script>

如果我使用来自highcharts.com的原生highcharts.js,这很有效 但就像我说的那样,我使用了yiiwheels的highcharts小部件。 我如何解决这个问题,如何从javascript / jquery引用我的图表? 感谢

0 个答案:

没有答案