Reputation: 4044
For set Y values I used this code snippet
ArrayList<Entry> yVals = new ArrayList<Entry>();
int sizeOfY = analyticsWeek.getGraph().size();
if (sizeOfY > 7)
sizeOfY = 7;
for (int i = 0; i < sizeOfY; i++) {
Log.e("sizeOfY",analyticsWeek.getTitle()+":"+i);
yVals.add(new Entry(Float.parseFloat("0"), i));
}
It shows middle of graph with 0.0 values instead of show at aligned to xAxis when (0,1),(0,2) where (pointValue,Xaxis). As shown in image it comes in center of graph even if there is zero point values. It should be aligned to xAxis
Upvotes: 0
Views: 1858
Reputation: 3246
You should set the minimum value of your axis to 0
using setAxisMinValue
, like this:
mChart.getAxisLeft().setAxisMinValue(0);
mChart.getAxisRight().setAxisMinValue(0);
Note: Starting with version 3.0.0
of the library this has been renamed to setAxisMinimum
:
mChart.getAxisLeft().setAxisMinimum(0);
mChart.getAxisRight().setAxisMinimum(0);
Upvotes: 1
Reputation: 3887
chartObject.getAxisLeft().setAxisMinValue(0.0f);
Works well for me!
Upvotes: 0
Reputation: 963
Have you set axis dependency?
dataSet.setAxisDependency(AxisDependency.RIGHT);
Upvotes: 3