MPAndroidChart x-axis date/time label formatting

I have done same thing, Try this, XAxis xAxis = mChart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE); xAxis.setDrawGridLines(false); xAxis.setGranularity(1f); // only intervals of 1 day xAxis.setTypeface(mTfLight); xAxis.setTextSize(8); xAxis.setTextColor(ContextCompat.getColor(this, R.color.colorYellow)); xAxis.setValueFormatter(new GraphXAxisValueFormatter(range, interval, slot)); in this range in your case. If you want month then there is 12, in case of week 7 etc. in interval you pass 1. in slot … Read more

MPAndroidChart – Adding labels to bar chart

Updated Answer (MPAndroidChart v3.0.1) Being such a commonly used feature, v3.0.1 of the library added the IndexAxisValueFormatter class exactly for this purpose, so it’s just one line of code now: mBarChart.getXAxis().setValueFormatter(new IndexAxisValueFormatter(labels)); The ProTip from the original answer below still applies. Original Answer (MPAndroidChart v3.0.0) With v3.0.0 of the library there is no direct way … Read more

MPAndroid Chart not displaying any labels for xAxis , what is missing?

These two lines are causing the issue : barChart.getXAxis().setAxisMinValue(10f); barChart.groupBars(10, groupSpace, barSpace); you are setting the minimum value of x axis to 10, whereas the labels will begin with index 0, So internally IndexOut of bound exception keeps occurring So, Change To: barChart.getXAxis().setAxisMinValue(0f); // Better remove setAxisMinValue(), as it deprecated barChart.groupBars(0, groupSpace, barSpace); If you … Read more

How do MPAndroidChart renderers work and how do I write a custom renderer?

Understanding Views and Canvas First, one should study the Canvas and Drawables Guide from the official Android documentation. Particularly, it is important to note that LineChart, BarChart etc. are subclasses of View that display themselves by overriding the onDraw(Canvas c) callback of the View superclass. Note also the definition of “canvas”: A Canvas works for … Read more