highcharts 多数据+切换

 

var highchartsOptions = {
        chart:{
            renderTo:'container'
        },
        title:{
            text:'指标数据'
        },
        tooltip:{
            pointFormat:'{series.name}:<b>{point.y}</b>'
        },
        xAxis:{
            categories:[]
        },
        yAxis:{
            title:{
                text:'数值'
            }
        },
        series:[]
};
    /**
    *categories:[]
    *series:[
    *         {
    *            name:''
    *              data:[]
    *          }
    *        ]
    */       
         function changeHighchartsOption(categories,series){
        highchartsOptions.xAxis.categories = categories;
        highchartsOptions.series = series;    
        newHighcharts('line');
    }
    
    function newHighcharts(type){
        highchartsOptions.chart.type = type;
        new Highcharts.Chart(highchartsOptions);
    }    

highcharts 多数据+切换_第1张图片

 

你可能感兴趣的:(Highcharts)