Echart绘制折线图,隐藏纵坐标

1 篇文章 0 订阅

效果图如下:
在这里插入图片描述

refreshDraw()方法保证,数据改变后,重新绘制折线图,否则不会刷新数据

 methods: {
            getEchartData() {
                let eChart = this.$echarts.init(document.getElementById('eChart'));
                eChart.setOption({
                    legend: {show: true},
                    grid: {
                        show: false,
                        containLabel: false,
                        left: 0, //距离画布左侧距离,有默认值
                        right: 0,//同上
                        top: '25px',//同上
                        bottom: '5px',//同上
                        borderColor: '#E1E5EB',
                        tooltip: { //提示框的显隐
                            show: false
                        }
                    },
                    xAxis: { //横坐标配置
                        type: 'category',
                        scale: true,
                        splitLine: {
                            show: true,
                        },
                        axisLine: {
                            show: false,
                        },
                        boundaryGap: true,
                    },
                    yAxis: {//纵坐标配置
                        show: true,
                        type: 'value',
                        scale: false,
                        axisLine: {
                            show: false,
                        },
                        axisTick: {
                            show: false,
                        },
                        minorTick: {
                            show: false,
                        },
                        splitLine: {
                            show: true,
                        },
                        axisLabel: {
                            formatter: function () {
                                return '';
                            }
                        },
                        minInterval: 20,//最小值
                        interval: 20,
                        max: 100,//纵坐标最大值
                    },
                    series: [
                        {
                            data: this.LineList,//数据
                            type: 'line',
                            symbol: 'circle',
                            itemStyle: {
                                color: this.color,//动态配置折现颜色
                            },
                            symbolSize: 10,
                            label: {
                                show: true,
                                color: '#5E5A72',
                                fontSize: 8,
                                z: 3,
                                formatter: function (val) {
                                    return val.value + '分';
                                }
                            }
                        },
                    ]
                })
            },
            refreshDraw() {
                this.show = false;
                let _this = this;
                setTimeout(function () {
                    _this.show = true;
                    _this.$nextTick(() => {
                        _this.getEchartData();
                    });
                },400)
            }
        }
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值