echarts3 仪表盘(gauge)当数据超过最大值时不能限制指针位置 #3067

Closed
M1ns opened this Issue Apr 25, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@M1ns

M1ns commented Apr 25, 2016

问题简述 (One-line summary)

仪表盘图表的数据超过最大值时指针不是停在最大值处

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.1.5
  • 浏览器类型和版本 (Browser version):chrome 49.0.2623.87 m (64-bit)
  • 操作系统类型和版本 (OS Version):win8.1 专业版

重现步骤 (Steps to reproduce)

1.设置gauge.max=100,gauge.data = [{value: 136, name: ''}]

期望结果 (Expected behaviour)

如echarts2.0中效果
gauge

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

ECharts配置项 (ECharts option)

var dataNum = 12345;
option = {
    series: [
        {
            type: 'gauge',
            detail: {
                formatter:'{value}',
                offsetCenter:[0,'100%'],
            },
            min:0,
            max:dataNum,
            center : ['50%', '50%'],    // 默认全局居中
            radius : '40%',
            axisLine: {            // 坐标轴线
                lineStyle: {       // 属性lineStyle控制线条样式
                    width: 15,
                    color: [
                        [10000/dataNum, '#f66'],
                        [1, '#ff4500']
                    ],
                },

            },
            axisTick: {            // 坐标轴小标记
                show: false
            },
            axisLabel: {
                formatter:function(v){
                    switch (v + '') {
                        case String(dataNum) : return 'max:\n'+dataNum;
                    }
                },
                textStyle:{
                    fontSize:14,
                },
            },
            splitLine: {           // 分隔线
                show:false
            },
            title: {
                show: false
            },
            data: [{value: 13456, name: ''}]
        }
    ]
};

app.timeTicket = setInterval(function () {
    var tempNum = +(Math.random() * 15000).toFixed(0)+5000;
    option.series[0].data[0].value = tempNum;
    option.series[0].axisLine.lineStyle.color[0][0] = tempNum/dataNum;
    myChart.setOption(option, true);
},2000);

其他信息 (Other comments)

指针没有停下
gauge1

@pissang pissang added this to the 3.1.8 milestone Apr 25, 2016

@pissang pissang closed this in c0d8b42 Apr 25, 2016

@norbertorozas

This comment has been minimized.

Show comment
Hide comment
@norbertorozas

norbertorozas May 25, 2017

Was the minimum range corrected too? We see the same problem in values < min. Pointer doesn't stop!

Was the minimum range corrected too? We see the same problem in values < min. Pointer doesn't stop!

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