line: simple line

简单折线图

by tmtron

HTML

<script src="//unpkg.com/[email protected]/dist/echarts.min.js"></script>
<script src="https://underscorejs.org/underscore.js"></script>
<div id="main" style="width: 600px;height:200px;"></div>

JavaScript

// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));


var option = {
  "yAxis": {
    "type": "value",
    "splitNumber": 4,
    "show": true,
  },
  "xAxis": [{
    "type": "time",
    "splitNumber": 5,
    "interval": 5,
    "axisLabel": {
      "interval": 5,
      formatter: () => 'longtext',
      "show": true
    },
    "splitLine": {
      "show": true,
    },
    "axisLine": {
      "show": "auto",
    },
    "show": true,
  }],
  "series": [{
    "type": "line",
    "name": "lineA",
    "yAxisIndex": 0,
    "data": [
      [
        1602633600000,
        13.034444444444445
      ],
      [
        1606259700000,
        12.165
      ]
    ],
    "encode": {
      "x": [
        0
      ],
      "y": [
        1
      ]
    }
  }],
  "dataZoom": [{
      "show": true,
    },
    {
      "type": "inside",
      "filterMode": "weakFilter"
    }
  ]
};




myChart.setOption(option);

// 使用刚指定的配置项和数据显示图表。
//  myChart.setOption(option);