0

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

enter image description here

Anant Shah
  • 3,744
  • 1
  • 35
  • 48

3 Answers3

3

Have you set axis dependency?

dataSet.setAxisDependency(AxisDependency.RIGHT);
anhtuannd
  • 918
  • 9
  • 16
  • Not related to OP's question, but this line solved my issue when I wanted to show the RIGHT axis instead of the LEFT axis – trod Sep 28 '18 at 05:17
1

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);
TR4Android
  • 3,200
  • 16
  • 21
0

chartObject.getAxisLeft().setAxisMinValue(0.0f);

Works well for me!

android_griezmann
  • 3,757
  • 4
  • 16
  • 43