Skip to content

visualmap dimension等于2的时候不生效 #14256

@KehaoWu

Description

@KehaoWu

Version

5.0.2

Steps to reproduce

在这个例子 https://echarts.apache.org/examples/zh/editor.html?c=line-aqi 的基础上修改代码:

$.get(ROOT_PATH + '/data/asset/data/aqi-beijing.json', function (data) {
    myChart.setOption(option = {
        title: {
            text: 'Beijing AQI',
            left: '1%'
        },
        tooltip: {
            trigger: 'axis'
        },
        grid: {
            left: '5%',
            right: '15%',
            bottom: '10%'
        },
        xAxis: {
            data: data.map(function (item) {
                return item[0];
            })
        },
        yAxis: {},
        toolbox: {
            right: 10,
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                restore: {},
                saveAsImage: {}
            }
        },
        dataZoom: [{
            startValue: '2014-06-01'
        }, {
            type: 'inside'
        }],
        visualMap: {
            top: 50,
            right: 10,
            dimension: 2, // dimension改为1的时候有效,但是改为2就无效了
            pieces: [{
                gt: 0,
                lte: 50,
                color: '#93CE07'
            }, {
                gt: 50,
                lte: 100,
                color: '#FBDB0F'
            }, {
                gt: 100,
                lte: 150,
                color: '#FC7D02'
            }, {
                gt: 150,
                lte: 200,
                color: '#FD0100'
            }, {
                gt: 200,
                lte: 300,
                color: '#AA069F'
            }, {
                gt: 300,
                color: '#AC3B2A'
            }],
            outOfRange: {
                color: '#999'
            }
        },
        series: {
            name: 'Beijing AQI',
            type: 'line',
            data: data.map(function (item) {
                item.push(Math.random() * 100)  // 这里item多加一个随机元素,0-100,一共三个元素
                return item;
            }),
            markLine: {
                silent: true,
                lineStyle: {
                    color: '#333'
                },
                data: [{
                    yAxis: 50
                }, {
                    yAxis: 100
                }, {
                    yAxis: 150
                }, {
                    yAxis: 200
                }, {
                    yAxis: 300
                }]
            }
        }
    });
});

得到的图折线没有变化颜色

What is expected?

折线变化颜色

What is actually happening?

没有变化

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions