AChartEngine - read y values by x - android

I'm currently working on my first android application and now use the achartengine library.
My question: Is there a function to read out y-values from a chart by passing an x-value as a parameter?
I have a line chart using a TimeSeries with several custom dates (for example 07/24/12 and 07/29/12). Now I want to pass another date (for example 07/25/12) and get the corresponding y-value - even though it is not stored in the TimeSeries.
I just wanted to ask, if there is a simple way like a single function to achieve this aim, otherwise I'll think about a more complicated solution on my own. In my above example, of course, it sounds quite easy to calculate the demanded y-value, but in practice it is going to be more difficult I guess.
Thank you.

No, there isn't such thing in AChartEngine.

Related

Is it possible to pick and choose which y-label values inside a linechart of mpandroidchart are displayed?

Below is the chart I am trying to create using MPAndroidChart library:
required_graph
To create this graph, I need some way to tell the linechart to only show two y-values "Average" and "You". I also need a way to draw a vertical grid-line that only goes up to the circle/y-value. I have searched for tutorials, SO articles, issues on MPAndroidChart github as well as the wiki, but I'm still uncertain how to create the graph above. Is there a way to create this graph with MPAndroidChart? Any help is much appreciated.
Try creating multiple data sets and style them differently. The 1st one should contain all the values, including "Average" and "You", enable fill color and disable drawing the circles.
Then, create a new set with a single value (average) and give it a different style. Do the same with the "you" value.
Good luck !

How to generate a polygonal chart

I'm developing an android application in which I want to show a set of aptitude's person and a numeric rating associated to each one of them.
Currently, my approach is a ListView where each row shows a TextView with the name of the aptitude and a RatingBar representing its value. The problem is, I have to show around 6-10 rows which in most cases fills the screen and from my point of view, it's not an elegant solution.
I came out with the idea of representing the info as a key-value set in a polygonal chart. Something like this:
I'm guessing I will need to be working with Canvas, which I have never did before. I would like to ask for a first steps of how would you get into this approach (if there's models to be defined, which android apis to use) or even better, if there's any library to get something like this.
Checkout MPAndroidChart
it has Radar Chart (spider web chart) which is highly customizable.
you get something like this

achartengine - plotting moving and still graphs

Is there any efficient way of doing this? My screenshot from Android device
As for now I am reading accelerometer data
(all graphs are moving to the left edge of screen) and compare them with my black threshold.
When new accelerometer single data arrives, I plot all three values (red,blue,black). This means adding three new points to the correspondent series at the end and removing the first point from series (to enable 'movement').
Is there an option to avoid adding new points to the black graph (threshold) to make it plot in an efficient manner? Or maybe this is quite efficient option, huh?
There are many options to do graphing. If you want static graphing you can use these API's/code samples.
AChartEngine
Simple Line Chart
Draw a Graph
Charts4j
AndroidPlot - one of the best looking ones, does dynamic plots too and is now open sourced.
TeeChart
So many others to choose from but most are static and non of these can handle real time data plots, i.e. ECG wave forms. One example you might want to look at is the Tricorder android example. Problem it is really complex to setup and if you just want the graphs, there is so much code to rip out. It can be done but I even noticed there is a lag the longer you run the program.
So far the only way I have found a real good dynamic graphing, is to do it yourself and use the SurfaceView and then draw usin the path.lineTo() see below for previous SO answer for this solution.
SO example:

How to implement multiple highlight line sliders in line chart

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

MPAndroidChart XY plot - independent X values?

I'm using the MPAndroidChart library to plot some data from a few sensors. I've found similar questions on SO, but no solutions:
Plot Multiple Charts in one in MPAndroidChart
MPAndroidChart How to represent multiple dataset object with different number of points in the same chart line
The sensors create data at different rates, and each data sample is stored as data structure like this: .
I would like to be able to plot both sensor values on the same chart as two independent traces. However, after attempting to do this using a LineChart (which claims to be able to plot multiple traces on the same graph) I discovered that the MPAndroidChart Library requires that all data be stored as , with the "xIndex" being an index into a single universal (to the traces on the chart) array of X values.
However, this makes plotting data from non-synchronous sources very difficult.
Is there a way, with MPAndroidChart, to create multiple XY traces with independent axis on both the X and Y axis? That is, can I plot something like this:
trace1 = Array of ()
trace2 = another array of ()
trace3...
The only suggestion I saw for a solution was the answer (given by the MPAndroidChart developer) to this question: MPAndroidChart How to represent multiple dataset object with different number of points in the same chart line. However, I'm concerned that using a tag to identify X values will result in slow graphing performance as the dataset grows larger, because I suspect that the library will have to do a lot of string compares and searches to find which Xaxis value corresponds to each Y value.
If it can't be done with MPAndroidChart, can anyone suggest a good library that can do it?
Thanks for any help.
ok, in case anyone else runs into this and needs a suggestion...I've found that Android Plot (http://androidplot.com/) meets my needs. It has good native support for XY graphs and seems like a good package all around.
I wish the javaDocs were a little more developed - a lot of functions have no descriptions, just the function declaration. That's not always enough to go off of. But so far it's working well.

Categories

Resources