首页 > 代码库 > highcharts 多数据+切换

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);    }