Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 941 Bytes

绘制精彩图表:探索ECharts可视化库.md

File metadata and controls

56 lines (45 loc) · 941 Bytes

步骤:

  1. 引入js
  2. 定义dom节点
<div class="daily-count-chart" style="width: 650px;height: 500px"></div>
  1. 获取dom节点
let myChart = echarts.init(document.querySelector(".chart"))
  1. 定义配置
option = {
};
  1. 设置
myChart.setOption(option);

折线图:

let option = {
          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',
              smooth: true,
                color:'blue',
                markPoint: {
                data: [
                  { type: 'max', name: 'Max' },
                  { type: 'min', name: 'Min' }
                ]
              },
            }
          ]
        };