Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LineChart issue using MPAndroidChart library

I am trying to make a simple smooth line chart which show the X axis as date-time on bottom and Y axis as normal left side. I just started using MPAndroidChart API and its example app in Git. In the example Line chart I am not able to find option to change X axis labels to show on bottom instead of top as show currently.

Just like:

enter image description here

Also is there a way to handle date-time data for X axis values ?

Also I tried my hand on Androidplot API but to make the line smooth there I need to make changes in library code which is not compiling at all in my Eclipse and giving errors. Also in Androidplot I did not find an option to show popup with data once I click on line chart.

So if anyone know how to make a smooth line chart using Androidplot API without modifying its library code and how to bring small popup with data in Androidplot API please reply.

like image 544
KplMax Avatar asked Nov 28 '25 18:11

KplMax


1 Answers

// XAxis settings
graph.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
graph.getXAxis().setLabelsToSkip(0);

// and
// make the line smooth
graph.getLineData().getDataSets().get(0).lineDataSet.setDrawCubic(true);
like image 141
lipel Avatar answered Dec 01 '25 10:12

lipel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!