I have to draw a graph on android with:-
X-axis's labels starting from the right-hand side of the graph and
ending to the left. (i.e; label with low value positioned on the
right while labels with higher values positioned left)
Y-axis positioned on the right side of the graph.
I have tried graphview (library) in android but could not find a way to plot x-axis from right to left manner. (As explained above) However, managed to plot Y-axis. (As managed above).
Tried MPChart (library as well) unfortunately that also did not work.
Any suggestion or idea will be a great help.
I am attaching the image as well for you to understand what exactly I want my graph to look like.SEE IMAGE HERE
If the input data is not dynamic you can always graph it it in reverse order by reversing the Array/List and plotting it normally. I've had to use some hack around code to rotate my Graph to make the x axis on the left and y axis on the bottom using MPAndroidChart. But it seems like you already tried attempted that solution, so I honestly would just reverse graph it.
Something like : Collections.reverse(Arrays.asList(a));
"For all my graphing needs I used: MPAndroidChart
This guy made a awesome library and so easy to implement it has really good doceumation to get started found here: MPAndroidChartDocumentation"
Related
I want to implement single and multiple highlight line sliders in line chart. I am able to get only single highlight line slider with MPAndroidChart (https://github.com/PhilJay/MPAndroidChart) library. But I also need two highlight line sliders to allow the user to select range of values(min and max values) on the chart. Please refer the below image for more information:
Can we achieve the above requirement with any library or we need to draw a custom view?
Any help or guidance will be well appreciated.
In terms of shinobicharts, while the Crosshair could be easily customised to act like one of sliders, in order to have the two sliders you'd probably want to make use of the Annotations feature.
You can create Annotations with custom Views and add them at any X, Y point (in data terms). You can also convert between data values and pixel values via the Axes. It is therefore possible to make the Annotation follow the user's finger as they drag across the screen.
The trickiest part would be placing the circle on the LineSeries at the right Y-value. As I mentioned above you can convert pixel values (e.g. from a user gesture) to data values so you could easily get the X value but the API would leave quite a bit of work up to you in order to get the correct Y value.
This kind of feature is something that is requested quite often and is certainly something we are looking at providing in the future but for now, while possible, it isn't available out-of-the-box.
Disclaimer: I work for shinobicontrols
Its been almost two days m struggling to use compound graph with following features:-
graph with stacked bar and line chart together.
Two y-axis (one at right and other at left) with differnt data set.
Tooltip that display current touched coordinates of graph.
I had tried following android graph libraries:-
MPAndroidchart
This library doesnt supports compound graphs. But i love this library, since rest features are up to the mark.(wish this would had supported Compond graphs.)
AndroidPlot
It does support Compound graph but no tooltip and multiple y-axis.
AchartEngine
Supports compound graphs. Look and feel is not that good. No tooltip support. Support Heap bar(stacked) but you cannot use this along with any other chart type in same graph.
So, is there any other library that can match my requirement ?
or
how could i implement this using libraries that i mentioned.
I'm fairly sure that HelloCharts can do all of this. The demo app shows a "Combo Line/Column Chart" to satisfy point 1 and a "Speed Chart" to satisfy requirement 2. Point 3 works in all their charts from what I can tell.
The only thing I'm not 100% sure about is if the ComboLineColumnChartView also supports two Y-axis like the LineChartView, but I don't see why not. Let me know if it works.
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:
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.
// 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);
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.
I'm trying to create a graph on android using the android graphview library.
1)I need to plot points on the graph (Currently, the options are LineGraph and BarGraph) however i wish to only plot the points without drawing a line.
2) Change the positioning of the X axis and it's labels(such that it shows on the top and not the bottom).
I'm looking through the API but cannot find a way to do these things. Would really appreciate if anyone could help out!
it is not possible do to exactly that what you want with android GraphView but should not be hard to modify the library to do so, because the features already exists.
LineGraphView can draw data points.
take a look at the methods
setDrawDataPoints
setDataPointsRadius
BarGraphView can draw the labels on top of the bar
take a look at the method
setDrawValuesOnTop
I'm using AChartEngine library for Android and in time charts the x labels do not correspond to points on the graph as you can see in images.
It appears that the graph is slightly shifted to the right.
Any hint?
This can be fixed using this:
renderer.setXRoundedLabels(false);