v-charts 动态设置 y轴 max All In One


v-charts 动态设置 y轴 max All In One

动态设置 y 轴 max, 超出 100% 切掉不展示;

    this.chartExtend = Object.assign({},
        {},
        {
            series: (v) => {
                Array.from(v).forEach((e, index) => {
                    e.symbol = 'circle';
                    e.symbolSize = 2;
                    // if (index === 1) {
                    //     e.areaStyle = 'value';
                    // }
                });
                return v;
            },
            yAxis: {
                max: function (value) {
                    console.log('max value', value);
                    // return value.max;
                    return value.max > 1 ? 1 : value.max;
                },
            },
        }
    );

    this.chartExtend = Object.assign({},
        {},
        {
            series: (v) => {
                Array.from(v).forEach((e, idx) => {
                    e.symbol = 'circle';
                    e.symbolSize = 2;

                    // if (idx === 1) {
                    //     e.areaStyle = 'value';
                    // }
                });
                return v;
            },
            yAxis: {
                max (value) {
                    return value.max > 1 ? 1 : value.max;
                },
                // max: (value) => {
                //     return value.max > 1 ? 1 : value.max;
                // },
                // max: function (value) {
                //     return value.max > 1 ? 1 : value.max;
                // },
            },
        }
    );

API

https://v-charts.xgqfrms.xyz/#/line

https://v-charts.xgqfrms.xyz/#/props-demo1





refs

https://www.codeleading.com/article/97153337725/

https://echarts.apache.org/zh/option.html#yAxis.max


Flag Counter

?xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有??xgqfrms, 禁止转载 ???,侵权必究??!