Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
livepdm opened this issue Sep 27, 2016 · 4 comments · May be fixed by #17061
Closed

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

livepdm opened this issue Sep 27, 2016 · 4 comments · May be fixed by #17061

Comments

@livepdm
Copy link

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
Copy link
Author

livepdm commented Oct 8, 2016

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

@livepdm
Copy link
Author

livepdm commented Oct 9, 2016

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

@livepdm livepdm closed this as completed Oct 9, 2016
@livepdm livepdm reopened this Oct 9, 2016
@livepdm
Copy link
Author

livepdm commented Oct 9, 2016

echarts-issue- 4518

@livepdm
Copy link
Author

livepdm commented Oct 9, 2016

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

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

Successfully merging a pull request may close this issue.

2 participants