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

数值轴刻度为整数 #3115

Closed
pissang opened this Issue Apr 29, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@pissang
Contributor

pissang commented Apr 29, 2016

有时候数值轴需要表达人数等只能是整数的数据。在正常的数据下 ECharts 的刻度划分策略可以保证刻度是整数划分的,但是如果如果所有数据为 0 或者最大值为 1,2 等则会出现划分后出现小数的情况。所以需要加入一种机制保证数值轴刻度永远为整数。两个方案:

  1. 坐标轴加入 integer 类型
{
  type: 'integer'
}
  1. 加入 minInterval 保证刻度划分不会小于 1
{
  minInterval: 1
}

第二种除了保证整数刻度还可以设置成诸如 0.01 用于保证货币的展现正确,等类似情况

@pissang pissang added the enhancement label Apr 29, 2016

@pissang pissang added this to the 3.1.9 milestone Apr 29, 2016

pissang added a commit that referenced this issue May 16, 2016

@pissang pissang closed this May 16, 2016

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