line: simple line

简单折线图

HTML

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

JavaScript

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

const workingIcon = 'path://M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zM6 4a1 1 0 0 0-1 1v6a1 1 0 0 0 2 0V5a1 1 0 0 0-1-1zm4 0a1 1 0 0 0-1 1v6a1 1 0 0 0 2 0V5a1 1 0 0 0-1-1z';

const nonWorkingIcon = 'path://M8 15A7 7 0 118 1a7 7 0 010 14zM6 4a1 1 0 00-1 1v6a1 1 0 002 0V5a1 1 0 00-1-1zm4 0a1 1 0 00-1 1v6a1 1 0 002 0V5a1 1 0 00-1-1z';

var option = {
  toolbox: {
    left: 'center',
    itemSize: 30,
    top: 200,
    feature: {
      /**
      The icon below is working
      */
      saveAsImage: {
        icon: workingIcon
      },
      /**
      The icon below is not working
      */
      restore: {
        icon: nonWorkingIcon
      }
    }
  },
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [{
    data: [820, 932, 901, 934, 1290, 1330, 1320],
    type: 'line'
  }]
};



myChart.setOption(option);

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