如何破坏highcharts对象

时间:2015-03-12 05:25:39

标签: javascript jquery highcharts

当我用highcharts打开一个页面超过两次时。我得到了这样的错误:


    Uncaught Highcharts error #16: www.highcharts.com/errors/16

和细节是:


    Highcharts Error #16

    Highcharts already defined in the page

    This error happens the second time Highcharts or Highstock is loaded in 
    the same page, so the Highcharts namespace is already defined. Keep in 
    mind that the Highcharts.Chart constructor and all features of Highcharts
     are included in Highstock, so if you are running Chart and StockChart 
    in combination, you only need to load the highstock.js file.

它告诉我highcharts对象已经存在。所以,当我用highcharts重新打开页面时,我怎么能破坏对象。 这是我的代码:


    $(function(){
      chart1 = new Highcharts.Chart({
            chart: {
              renderTo: 'container1',
              type: 'column'
            },
            title: {
                text: 'count'
            },
            credits: {
              enabled: false
            },
            xAxis: {
                categories: [  ],
                crosshair: true
            },
            yAxis: {
                min: 0,
                title: {
                    text: '商家个数'
                }
            },
            tooltip: {
                headerFormat: '{point.key}',
                pointFormat: '{series.name}: ' +
                    '{point.y} 个',
                footerFormat: '',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [
              {
                name: 'count',
                data: 
              }
            ]
        });
    });

任何帮助都会受到赞赏.....

0 个答案:

没有答案