3

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.

Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
KplMax
  • 31
  • 1
  • 1
  • 4
  • Hey @halfer & KplMax did you get any solution on this ? – chaitanya Jun 01 '16 at 17:15
  • @chaitanya: I didn't have anything to add on this, it looks like I was just editing the question to improve it. KplMax hasn't logged on for a couple of months, but nevertheless he/she may see your message in due course. – halfer Jun 01 '16 at 17:47

2 Answers2

2
// 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);
lipel
  • 31
  • 2
-2

Refer this: http://wptrafficanalyzer.in/blog/android-drawing-line-chart-using-achartengine/

for smooth curve lines please refer this:

How to make line with rounded (smooth) corners with AndroidPlot

Hope this may help you.

AChartEngine is a charting library for Android applications. Using AChartEngine library, we can plot various charts like line chart, area chart, pie chart, time chart, bubble chart etc.

Community
  • 1
  • 1
Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
  • Hi Krupa Thanks for reply but how to make smooth curve line chart using AchartEngine ? As thats an important requirement of my chart. – KplMax Aug 22 '14 at 07:09
  • Hi Krupa, actually i have referred that link already issue was that the androidplot code was not compiling for me. So i switched to achartengine. Now i see that achartengine has cubic curve option, so the last important task i am left with is, showing a popup message when i click on chart to show that y axis data. Can you tell me how to get the y axis data on a click event on chart ? – KplMax Aug 22 '14 at 07:36
  • Not sure about your further needs but just in case you would like to check a different chart library that may fit: [williamchart](https://github.com/diogobernardino/WilliamChart). You can easily define a LineChart with smooth lines. – diogobernardino Aug 22 '14 at 14:30
  • You can use Cubic line chart of Achart engine to have a smooth line chart – android.fryo Nov 19 '14 at 12:34