返回> 网站首页 

highcharts图表使用示例

yoours2021-03-27 16:16:39 阅读 2138

简介一边听听音乐,一边写写文章。

绘制折线图

 1. 按住shift然后鼠标左右移动曲线

 2. 鼠标画选框局部放大

 3. 支持下载当前显示图像为图片文件


window.onload = function(){

    var chart = Highcharts.chart('container', {

    chart: {

    type: 'spline',

            zoomType: 'x',

    panning: true,

    panKey: 'shift'

    },credits: {

    enabled: false

    },

    title: {

    text: '数据采集'

    },

    subtitle: {

    text: '分析曲线'

    },

    xAxis: {

    type: 'long',

    title: {

    text: "时间戳"

    },

    },

    colors: ['#FF0000', '#00FF00', '#0000FF', '#8000FF', '#00FFFF', '#FF00FF'],

    yAxis: {

    title: {

    text: 'RSSI'

    },

    min: -80

    },

    tooltip: {

    headerFormat: '<b>{series.name}</b><br>',

    pointFormat: '{point.x:.2f}: {point.y:.2f} m'

    },

    plotOptions: {

    spline: {

    marker: {

    enabled: true

    }

    }

    },

    series: [{

    name: 'A',

    data: data0A

    },

    {

    name: 'F',

    data: data7F

    }, 

    {

    name: 'C',

    data: dataCC

   

    }, 

    {

    name: 'Q',

    data: dataAA

   

    }

    ],

    exporting: {

    filename: getDateString()

    }

    });

};

function getDateString()

{

var myDate = new Date();

return myDate.getFullYear()+ "" + (myDate.getMonth()+1).toString().padStart(2,'0')+""+myDate.getDate().toString().padStart(2,'0')+"_"+myDate.getHours().toString().padStart(2,'0')+""+myDate.getMinutes().toString().padStart(2,'0')+""+myDate.getSeconds().toString().padStart(2,'0')+""+myDate.getMilliseconds().toString().padStart(3,'0');

}

微信小程序扫码登陆

文章评论

2138人参与,0条评论