绘制如http://echarts.baidu.com/demo.html#line-aqi 的图形时,如果我的值都一样时,js报错 #3582

Closed
meizi0828 opened this Issue Jul 8, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@meizi0828

问题简述 (One-line summary)

绘制如http://echarts.baidu.com/demo.html#line-aqi 的图形时,如果我的值都一样时,js报错!

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.0
  • 浏览器类型和版本 (Browser version):Chrome 51.0.2704.103 m
  • 操作系统类型和版本 (OS Version):win 10

重现步骤 (Steps to reproduce)

1.把http://echarts.baidu.com/demo.html#line-aqi例子中的option的series的data修改为 return 200;
2.点击运行

期望结果 (Expected behaviour)

能正确绘制图表

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

$.get('data/asset/data/aqi-beijing.json', function (data) {
    myChart.setOption(option = {
        title: {
            text: 'Beijing AQI'
        },
        tooltip: {
            trigger: 'axis'
        },
        xAxis: {
            data: data.map(function (item) {
                return item[0];
            })
        },
        yAxis: {
            splitLine: {
                show: false
            }
        },
        toolbox: {
            left: 'center',
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                restore: {},
                saveAsImage: {}
            }
        },
        dataZoom: [{
            startValue: '2014-06-01'
        }, {
            type: 'inside'
        }],
        visualMap: {
            top: 10,
            right: 10,
            pieces: [{
                gt: 0,
                lte: 50,
                color: '#096'
            }, {
                gt: 50,
                lte: 100,
                color: '#ffde33'
            }, {
                gt: 100,
                lte: 150,
                color: '#ff9933'
            }, {
                gt: 150,
                lte: 200,
                color: '#cc0033'
            }, {
                gt: 200,
                lte: 300,
                color: '#660099'
            }, {
                gt: 300,
                color: '#7e0023'
            }],
            outOfRange: {
                color: '#999'
            }
        },
        series: {
            name: 'Beijing AQI',
            type: 'line',
            data: data.map(function (item) {
                return 200;
            }),
            markLine: {
                silent: true,
                data: [{
                    yAxis: 50
                }, {
                    yAxis: 100
                }, {
                    yAxis: 150
                }, {
                    yAxis: 200
                }, {
                    yAxis: 300
                }]
            }
        }
    });
});

其他信息 (Other comments)

qq 20160708144542

33

@pissang pissang added the bug label Jul 8, 2016

@pissang pissang closed this in a66967f Jul 8, 2016

@pissang pissang changed the title from 绘制如http://echarts.baidu.com/demo.html#line-aqi 的图形时,如果我的值都一样时,js报错! to 绘制如http://echarts.baidu.com/demo.html#line-aqi 的图形时,如果我的值都一样时,js报错 Jul 11, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment