-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Tests failing after startAtZero was removed #767
Comments
Yes it seems like there's some kind of residue. Weird since |
We can see the problem here: @PhilJay I think that this originates here: https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java#L358 |
Yes, we draw a "little bit more" in that case. But that case should only occur if the range is 0 and hence all values in the dataset are equal. If that is not the case, this should not be an issue. |
@PhilJay Yes it seems that that's not the source of the issue... But it still happens, on the Android side also. Try to replace the code in mChart = (BarChart) findViewById(R.id.chart1);
// Sample data
float[] values = new float[]{8, 104, 81, 93, 52, 44, 97, 101, 75, 28,
76, 25, 20, 13, 52, 44, 57, 23, 45, 91,
99, 14, 84, 48, 40, 71, 106, 41, 45, 61};
ArrayList<BarEntry> entries = new ArrayList<>();
ArrayList<String> xValues = new ArrayList<>();
for (int i = 0; i < values.length; i++)
{
entries.add(new BarEntry(values[i], i));
xValues.add(Integer.toString(i));
}
BarDataSet dataSet = new BarDataSet(entries, "Bar chart unit test data");
mChart.setData(new BarData(xValues, dataSet)); |
Okay after further investigation - two things happened:
|
So more info: axis ranges are multiplied by the spacing factor. But when there was |
@PhilJay I've created a PR in MPAndroidChart |
I just looked into why the tests are failing and it seems to have happened here when
startAtZero
was deprecated.Setting the
customAxisMin = 0.0
in the tests does kind of make it look like it should but there is still an offset. @danielgindi any ideas?The text was updated successfully, but these errors were encountered: