echarts折线图markArea的应用

最近实现的一个echarts折线图
下面是echarts的option:

option = {
    backgroundColor: '#efefef',
    title: [{
            text: '个人曲线', //主标题
            top: '15%',
            left: '40%'

        },
        {
            text: '榜样曲线', //主标题
            top: '15%',
            right: '18%'
        }
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            lineStyle: {
                color: {
                    type: 'linear',
                    x: 0,
                    y: 0,
                    x2: 0,
                    y2: 1,
                    colorStops: [{
                        offset: 0,
                        color: 'rgba(0, 255, 233,0)'
                    }, {
                        offset: 0.5,
                        color: 'rgba(255, 255, 255,1)',
                    }, {
                        offset: 1,
                        color: 'rgba(0, 255, 233,0)'
                    }],
                    global: false
                }
            },
        },
    },
    legend: {
        color: ['#A582EA', '#2CABE3'],
        formatter(params) {
            return params
        },
        x: '86%',
        y: '20%',
        itemWidth: 10,
        itemHeight: 5,
        textStyle: {
            fontSize: 12,
            color: '#323233'
        }
    },
    grid: {
        top: '15%',
        left: '10%',
        right: '15%',
        bottom: '15%',
        // containLabel: true
    },
    xAxis: [{
        type: 'category',
        axisLine: {
            show: true, // 坐标轴
            color: '#A582EA',
            symbol: ['none', 'arrow'], //显示箭头
            symbolSize: [6, 6] //箭头长宽

        },

        axisLabel: {
            color: '#A582EA',
            width: 100
        },
        splitLine: {
            show: false
        },
        boundaryGap: false, //两边留白策略
        data: ["", "3月转正", "6月实战", "1年考核", "24月留存", "当前职级", "榜样职级"] //this.$moment(data.times).format("HH-mm") ,

    }],
    yAxis: [{
        name: '能力值', //y轴名称
        type: 'value',
        nameTextStyle: {
            fontSize: 10 //y轴名称大小设置
        },
        min: 0,
        // max: 140,
        splitNumber: 4,
        splitLine: {
            show: true,
            lineStyle: {
                color: '#00BFF3',
                opacity: 0.23
            }
        },
        axisLine: {
            show: true, // 坐标轴
            symbol: ['none', 'arrow'], //显示箭头
            symbolSize: [6, 6] //箭头长宽
        },
        position: 'left',
        nameLocation: 'middle',
        nameGap: 4,
        nameRotate: 90,
        axisLabel: {
            show: true,
            margin: 20,
            textStyle: {
                color: '#fff',

            },
        },
        axisTick: {
            show: false,
        },
    }],
    series: [{
            name: '工作态度',
            type: 'line',
            showAllSymbol: true,
            symbol: 'circle',
            symbolSize: 10,
            lineStyle: {
                normal: {
                    color: "#A582EA",
                },
            },
            label: {
                show: true,
                position: 'top',
                textStyle: {
                    color: '#A582EA',
                }
            },
            itemStyle: {
                color: "#fff",
                borderColor: "#A582EA",
                borderWidth: 2,
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(43,193,145,0.3)'
                        },
                        {
                            offset: 1,
                            color: 'rgba(43,193,145,0)'
                        }
                    ], false),
                }
            },
            data: [0, 7, 5, 4, 3, 5, 8] //data.values
        },
        {
            name: '学习能力',
            type: 'line',
            showAllSymbol: true,
            symbol: 'circle',
            symbolSize: 10,
            lineStyle: {
                normal: {
                    color: "#2CABE3",
                },
            },
            label: {
                show: true,
                position: 'top',
                textStyle: {
                    color: '#2CABE3',
                }
            },
            itemStyle: {
                color: "#fff",
                borderColor: "#2CABE3",
                borderWidth: 2,
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(81,150,164,0.3)'
                        },
                        {
                            offset: 1,
                            color: 'rgba(81,150,164,0)'
                        }
                    ], false),
                }
            },
            data: [0, 5, 4, 2, 1, 7, 6], //data.values
            markArea: {
                data: [
                    [{
                            xAxis: '当前职级',
                            itemStyle: {
                                color: '#969799'
                            }
                        },
                        {
                            xAxis: '榜样职级',
                            itemStyle: {
                                color: '#969799'
                            }
                        }
                    ]
                ]
            }

        },
    ]
};
  • 6
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值