echarts 折线图实现

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

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

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

效果图:

echarts 折线图实现

实现步骤:

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"
            
        }
        ]
};

 

 

上一篇:Echarts实现双y轴(不同刻度)


下一篇:pyecharts报错:TypeError: add_yaxis() got an unexpected keyword argument ‘yaxis_data‘