This theme is built |

冷闲欧巴

园龄:4年6个月粉丝:0关注:4

echarts 折线图配置项

复制代码
var option = {
      // 折线对应的标题
      legend: {
        data: ['总收入', '订单笔数'],
        right: 10,
        top: 3
      },
      // 布局位置
      grid: {
        top: '50px',
        left: '4%',
        right: '2%',
        bottom: '4%',
        containLabel: true
      },
      // 横坐标刻度文字数据展示
      xAxis: {
        type: 'category',
        splitLine: { show: false },
        boundaryGap: false,
        axisLabel: {
          textStyle: {
            fontSize: 10,
            color: '#333'
          }
        },
        axisLine: {
          // 线的自定义样式
          lineStyle: {
            // 线的颜色
            color: {
              type: 'linear',
              colorStops: [{
                offset: 0, color: '#E15D68' // 0% 处的颜色
              }, {
                offset: 1, color: '#2AB7FE' // 100% 处的颜色
              }],
            },
          },
        },
        // 数据
        data: this.data.trendServerData[name],
      },
      // 纵坐标配置,数组【0】在左边,【1】在右边
      yAxis: [{
        type: 'value',
        nameTextStyle: {
          fontSize: 12
        },
        splitLine: {
          show: false
        },
        axisTick: {
          show: false
        },
        // 线的配置
        axisLine: {
          show: true,
          lineStyle: {
            color: '#E15D68',
          }
        },
        // 字体的配置
        axisLabel: {
          color: '#666',
          fontSize: 12,
          textStyle: {
            fontSize: 15,
            color: '#E15D68'
          }
        }
      },
      {
        type: 'value',
        nameTextStyle: {
          fontSize: 12
        },
        splitLine: {
          show: false
        },
        axisTick: {
          show: false
        },
        // 线的配置
        axisLine: {
          show: true,
          lineStyle: {
            color: '#2AB7FE',
          }
        },
        // 字体的配置
        axisLabel: {
          color: '#666',
          fontSize: 12,
          textStyle: {
            fontSize: 15,
            color: '#2AB7FE'
          }
        }
      }],
      // 折线数据填充
      series: [{
        // 和legend中的data对应
        name: '订单笔数',
        type: 'line',
        symbolSize: 2,
        yAxisIndex: 1,
        // 数据源
        data: this.data.trendData[name].number,
        // 每个点上显示对应的数据
        label: {
          show: true,
          formatter: function (data) {
            return data.value;
          }
        },
        // 线的样式设置
        itemStyle: {
          normal: {
            color: '#3CA3FF',
            lineStyle: {  //线的颜色
              color: '#3CA3FF'
            },
            width: 1
          }
        }
      }, {
        // 和legend中的data对应
        name: '总收入',
        type: 'line',
        symbolSize: 2,
        yAxisIndex: 0,
        // 数据源
        data: this.data.trendData[name].amount,
        // 每个点上显示对应的数据
        label: {
          show: true,
          formatter: function (data) {
            return data.value;
          }
        },
        // 线的样式设置
        itemStyle: {
          normal: {
            color: '#F56379',
            lineStyle: {  //线的颜色
              color: '#F56379'
            },
            width: 1
          }
        }
      }
      ]
    };              
复制代码

 

 

本文作者:冷闲欧巴

本文链接:https://www.cnblogs.com/bkings/p/16148476.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   冷闲欧巴  阅读(437)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起