echarts的xAxis的type是time


https://www.cnblogs.com/vipstone/p/5318615.html

xAxis內無需像type='category'那樣寫data

var data = [];

var times=[[1522306819000, 2], [1522306919000, 1], [1522307019000, 3], [1522307119000, 1], [1522307120000, 1],[1522307230000, 1], [1522302230000, 1], [1522307430000, 1], [1522407230000, 1]];

option = {
    title: {
        text: '動態數據 + 時間坐標軸'
    },
    tooltip: {
        trigger: 'axis',
    },
    xAxis: {
        type: 'time',
        splitLine: {
            show: false
        }
    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, '100%'],
        splitLine: {
            show: false
        }
    },
    series: [{
        name: '模擬數據',
        type: 'line',
        showSymbol: false,
        hoverAnimation: false,
        data: times
    }]
};

myChart.setOption(option)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM