echarts example - JSFiddle - JSFiddle

by locinus

HTML

<script src="//cdn.bootcss.com/echarts/3.2.2/echarts.min.js"></script>
<div id="main" style="width: 600px;height:400px;"></div>

JavaScript

var myChart = echarts.init(document.getElementById('main'));

var option = {
  xAxis: [{
    type: "time",
    name: "Date"
  }],
  yAxis: [{
    type: "value",
    name: "my axis"
  }],
  series: [{
    type: 'line',
    xAxisIndex: 0,
    yAxisIndex: 0,
    data: [
      [1509762600, 7.11376],
      [1509766200, 7.13389],
      [1509832200, 7.53564],
      [1509832800, 7.54459],
      [1509834000, 7.54566],
      [1509835200, 7.55541],
      [1509849000, 7.64559]
    ],
    markLine: {
      data: [
        // 1st line we want to draw
        [
          // start point of the line
          // we have to defined line attributes only here (not in the end point)
          {
            xAxis: 1509762600,
            yAxis: 3,
            symbol: 'none',
            lineStyle: {
              normal: {
                color: "#00F"
              }
            },
            label: {
              normal: {
                show: true,
                position: 'end',
                formatter: 'my label'
              }
            }
          },
          // end point of the line
          {
            xAxis: 1509849000,
            yAxis: 3,
            symbol: 'none'
          }
        ]
      ]
    }
  }]
};

myChart.setOption(option);