其他分享
首页 > 其他分享> > echarts 折线图实现

echarts 折线图实现

作者:互联网

官方例子:Examples - Apache ECharts (incubating)

官方文档:Documentation - Apache ECharts(incubating)

必须要的属性:xAxis、yAxis、series

效果图:

实现步骤:

1.定义容器,存放图表

<div id="main" class="lineChar"></div>

样式:

<style>
.lineChar {
  width: 1900px;
  height: 400px;
  margin: 0;
  padding: 0;
  background-color: #000000;
}
</style>

 

2.option配置

option = {
    legend:{
        data: ["本周", "上周"],
        textStyle: {fontSize: 16}
    },
    xAxis: {
        type: 'category',
        data: ["2020-11-16", "2020-11-17", "2020-11-18", "2020-11-19", "2020-11-20", "2020-11-21", "2020-11-22"]
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            data: [3293.5,3945.6,3760.9,996.6,3481.6,4514.9,3223.5],
            name: "本周",
            smooth: true,
            type: "line"
        },
        {
            data: [1553.9,1180.8,2583.9,2488.5,1890,1881.3,3258.5],
            name: "上周",
            smooth: true,
            type: "line"
            
        }
        ]
};

 

 

标签:11,yAxis,实现,data,2020,series,折线图,type,echarts
来源: https://blog.csdn.net/qq_40953393/article/details/110350903