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

min为负数,max为正数时,刻度计算有误 #3

Closed
Saxxhw opened this issue Nov 30, 2016 · 2 comments
Closed

min为负数,max为正数时,刻度计算有误 #3

Saxxhw opened this issue Nov 30, 2016 · 2 comments

Comments

@Saxxhw
Copy link

Saxxhw commented Nov 30, 2016

如题,设置最小值为-90,最大值为90,表盘显示的刻度分别为-90,36,72,108,144,90
`private String[] getMeasureNumbers() {
String[] strings = new String[mBigSliceCount + 1];
for (int i = 0; i <= mBigSliceCount; i++) {
if (i == 0) {
strings[i] = String.valueOf(mMinValue);
} else if (i == mBigSliceCount) {
strings[i] = String.valueOf(mMaxValue);
} else {
strings[i] = String.valueOf(((mMaxValue - mMinValue) / mBigSliceCount) * i);
}
}

    return strings;
}`

这个计算刻度的方法应该修改一下

@Saxxhw
Copy link
Author

Saxxhw commented Nov 30, 2016

`private String[] getMeasureNumbers() {
String[] strings = new String[mBigSliceCount + 1];
for (int i = 0; i <= mBigSliceCount; i++) {
if (i == 0) {
strings[i] = String.valueOf(mMinValue);
} else if (i == mBigSliceCount) {
strings[i] = String.valueOf(mMaxValue);
} else {
int average = (mMaxValue - mMinValue) / mBigSliceCount;
strings[i] = String.valueOf(mMinValue + average * i);
}
}

    return strings;
}`

我改成这样测试了一下,不知道有没有问题,耐心等待大神的修改方案~~

@woxingxiao
Copy link
Owner

相信最新的DashboardView1已经解决了这个问题

@Saxxhw Saxxhw closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants