log 类型轴label显示精度问题 #4158

Closed
livepdm opened this Issue Sep 27, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@livepdm

livepdm commented Sep 27, 2016

问题简述 (One-line summary)

当我们设置
series : [
{
name:'邮件营销',
type:'line',
stack: '总量',
areaStyle: {normal: {}},
data:[100, 100, 100, 100, 100, 100, 20000.0]
},
中的data中有20000.0 (或20000000000000,20000000000000000000)时,
图表的显示会变成19999.99999999等;

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):
    当前3.1.10, 3.2.3都有问题
  • 浏览器类型和版本 (Browser version):
    IE 9,Firefox 34 ESR,Chrome 53
  • 操作系统类型和版本 (OS Version):
    Win 7

重现步骤 (Steps to reproduce)

  1. 重现很简单,请使用下面的设置:

期望结果 (Expected behaviour)

希望显示为20000或20000.0。

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

浮点型数字精度导致的显示问题。

ECharts配置项 (ECharts option)

option = {
    title: {
        text: '堆叠区域图'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    yAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : ['周一','周二','周三','周四','周五','周六','周日']
        }
    ],
    xAxis : [
        {
            type : 'log',
            min:'dataMin',
            max:'dataMax'
        }
    ],
    series : [
        {
            name:'邮件营销',
            type:'line',
            stack: '总量',
            areaStyle: {normal: {}},
            data:[100, 100, 100, 100, 100, 1000,20000]
        },
        {
            name:'联盟广告',
            type:'line',
            stack: '总量',
            areaStyle: {normal: {}},
            data:[100, 100, 100, 100, 100, 100, 0]
        },
        {
            name:'视频广告',
            type:'line',
            stack: '总量',
            areaStyle: {normal: {}},
            data:[100, 100, 100, 100, 100, 100, 0]
        },
        {
            name:'直接访问',
            type:'line',
            stack: '总量',
            areaStyle: {normal: {}},
            data:[100, 100, 100, 100, 100, 100, 0]
        },
        {
            name:'搜索引擎',
            type:'line',
            stack: '总量',
            label: {
                normal: {
                    show: true,
                    position: 'top'
                }
            },
            areaStyle: {normal: {}},
            data:[100, 100, 100, 100, 100, 100, 0]
        }
    ]
}

其他信息 (Other comments)

@livepdm

This comment has been minimized.

Show comment
Hide comment
@livepdm

livepdm Oct 8, 2016

这个项目是活动的么?
问题发了10天没有一个人看?

livepdm commented Oct 8, 2016

这个项目是活动的么?
问题发了10天没有一个人看?

@livepdm

This comment has been minimized.

Show comment
Hide comment
@livepdm

livepdm Oct 9, 2016

能够重现的。
通过你的邮件给出的链接,我能看到问题重现,请参考附件截图,多谢!
Uploading echarts-issue-#4518.png…

livepdm commented Oct 9, 2016

能够重现的。
通过你的邮件给出的链接,我能看到问题重现,请参考附件截图,多谢!
Uploading echarts-issue-#4518.png…

@livepdm livepdm closed this Oct 9, 2016

@livepdm livepdm reopened this Oct 9, 2016

@livepdm

This comment has been minimized.

Show comment
Hide comment

livepdm commented Oct 9, 2016

echarts-issue- 4518

@livepdm

This comment has been minimized.

Show comment
Hide comment
@livepdm

livepdm Oct 9, 2016

贴图成功了,见右下角。
抱歉,不太会用这个。。。。。

livepdm commented Oct 9, 2016

贴图成功了,见右下角。
抱歉,不太会用这个。。。。。

@pissang pissang added the enhancement label Oct 9, 2016

@100pah 100pah closed this in 30f4d15 Oct 10, 2016

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