lecho / hellocharts-android

Charts library for Android compatible with API 8+, several chart types with scaling, scrolling and animations 📊
Apache License 2.0
7.44k stars 1.61k forks source link

x-axis only shows every second label #362

Open appmonk opened 7 years ago

appmonk commented 7 years ago

I'm finally getting the hang of this library, but I have one issue with the x-axis. I'm changing the labels to show a custom value (eventually the value will be based on a Date string, for now it's just dummy data), but the issue is, that only every second label is shown. this.axisX = new Axis(); List<AxisValue> xValues = new ArrayList<>(); xValues.add(new AxisValue(0).setLabel("jan")); xValues.add(new AxisValue(1).setLabel("feb")); xValues.add(new AxisValue(2).setLabel("mar")); xValues.add(new AxisValue(3).setLabel("apr")); xValues.add(new AxisValue(4).setLabel("may")); xValues.add(new AxisValue(5).setLabel("jun")); xValues.add(new AxisValue(6).setLabel("jul")); xValues.add(new AxisValue(7).setLabel("aug")); xValues.add(new AxisValue(8).setLabel("sep")); xValues.add(new AxisValue(9).setLabel("okt")); xValues.add(new AxisValue(10).setLabel("nov")); xValues.add(new AxisValue(11).setLabel("dec")); axisX.setValues(xValues); axisX.setAutoGenerated(false); data.setAxisXBottom(axisX);

Which gives me an x-axis with: jan, mar, may, jul, sep, nov

How can I get it to show all the labels?

JacobHearst commented 7 years ago

You might be able to tilt the labels with axisX.setHasTiltedLabels(true) or you could try generating the axis values like this axisX.generateAxisFromRange(0, 11, 1) if neither of those work however, the last solution I can think of is to change the font size of the labels with axisX.setTextSize(int textSize)