Time-Distance chart using AFreeChart - android

I want to create a time-distance chart that will show the position (on the x axis) at a certain time (on the y axis). I successfully integrated the library in my project and I rendered an empty chart. However, I'm not sure what kind of chart to use a Line Chart, a XY Line Chart or a Time Series Chart and I don't know how should I provide the data (the position at a certain time e.g. at second 5 the distance is 10 meters) for the chart to be drawn.

Check this thread for reference.
http://www.android-graphview.org/

Related

How do I plot Y-axis on right and start time from right and plot a layout in Line chart in MP Chart Android library

I am working on a project where I need to plot data on the line chart, I am using MP chart Android as the library, I need the Y-Axis to start from the right corner and then scroll must be towards left. Also, the current time should be plotted as the first point on X-Axis.
chart.axisLeft.isEnabled = false
chart.axisRight.isEnabled = true
This makes the right Axis enabled but doesn't start the value from right.
The other point is I need to plot a layout on the graph whenever a data is plotted but I am only able to plot Drawables on it, please help me out here.

MPAndroid chart hide labels from X axis and show on double tap

I ma using MPAndroidChart bubble chart. when I run the app it shows x axis values hidden. like I have x-axis label January, February, march, April, may,june. but when app run it shows January , April
and June. on double tape on label it zoom the chart and show hidden labels. I want to show all in a sequence so that user troll horizontal and view all. no need to double tap
You can determinate the numbers of labels to display. This prevents them from hiding automatically.
XAxis xAxis = bubbleChart.getXAxis();
xAxis.setLabelCount(data.length);
Not sure why would you do that. The library does a great job in automatically deciding how many labels to show on either X or Y axis to make the chart nice and readable.
If the chart is narrow, it might happen that your values will overlap, that's why the library skips a few, to make the chart look good.
If that still doesn't help, you can play around with the spacings between axis labels - check out the library's documentation for these specific items
Other solution may be to rotate the labels of the X axis with the help of
xAxis.setLabelRotationAngle(35);
I found the solution after expanding MP Android Chart documentation.
you can do so set thee labels to skip 0. It will skip no label from xAxis.
XAxis xAxis = bubbleChart.getXAxis();
xAxis.setLabelsToSkip(0);

MPAndroidChart - animations between real-time data points

I am currently using MPAndroidChart to display real-time data. I have been able to add points to a line chart and update a radar chart with the data. However, I am having issues with implementing smooth animations when updating the charts.
So, for example, instead of just redrawing the line chart to include a new point of data, I would like the line to gradually extend to a new data point, sliding to the right if an old data point is being replaced (when outside of the visible axis range). And in the radar chart, if a point of data changes from, say, 20 to 60, I would like the point on the chart to smoothly move from the 20 to 60 instead of the chart being completely redrawn.
At the moment, I have found the animateX, animateY, and animateXY methods in the library. However, these only seem to be for initially creating the chart. I need there to be animations while data is continually added to an existing chart. Is it possible with this library? What kinds of tweaks would I need to make?

Issues faced while drawing dynamic line graph using AChartEngine in Android

How to stop scrolling of AChartEngine dynamic line graph along the y-axis?
When I dynamically plot values I wish to display the recent plotted value. How to do that?
I wish to plot y- axis values in range 20 to 200 and want to display only 5 values so I have used mRenderer.setYLabels(5); But, when I do so grid lines are displayed for only those values. And user will not be able to know the exact y axis co-ordinate. How to show grid lines for each value and show labels for only some values?
If I manually scroll graph horizontally towards right or left, x-axis labels change. I set range as 0-10 with setXLables(2); but it changes to 0,5,10… How to control this behavior?
These should be 4 separate questions, not numbered ones. So, I will only answer the first one of them:
You can set the min and max displayed values:
renderer.setXAxisMin(minValue);
renderer.setXAxisMax(maxValue);
If by scrolling you mean panning, then this is the way to do:
renderer.setPanEnabled(false, false);
renderer.setZoomEnabled(false, false);

Intersection of GridLines and line chart y-axis value

I am able to display the AChartEngine's TimeChartView to user, but when the graph renders, the grid lines (vertical - set by showGridLines(true)) and the line drawn on graph to display corresponding y-axis value (time in secs) against the dates on x-axis don't intersect with each other.
The y-axis value pt shows up either before the x-axis value or after it, but not exactly on it.
Please suggest, if there's any achartengine property which needs to be set to get this done / any other thing that needs to be done for getting this done.
Thanks
Omkar Ghaisas
Sample Image --
As can be seen, the points marked with ovals don't coincide with the vertical grid lines and with x axis values, but start before that. E.g the first y value for 7200 should start at vertical line of 02/03/2012, but instead starts before that. Similarly for all other data points.
This was fixed in the AChartEngine SVN.
Please see this for extra information.

Categories

Resources