does charts (achartengine ) carry dynamically changing capability - android

Does charts (AChartEngine) have these capability
1.Ability to add or remove legend
Ability to adjust the axis - both x and y (min and max) - ideally by using a finger pinch.
Ability to show a value if you hover over the point
Ability to show, hide a curve on demand

1.Ability to add or remove legend
Yes. Use the setShowLegend() method on the renderer.
Ability to adjust the axis - both x and y (min and max) - ideally by
using a finger pinch.
For interactivity, you should move to the new Codename One charts package (which is based on the aChartEngine library). It provides more features in this area. You can enable pinch zoom and panning by specifying a flag. Pinch zoom currently just works by zooming in (like on a photograph), so it doesn't necessarily adjust the axis. If you can point me to an example of a chart that provides the type of behaviour you're looking for, I can take a look and recommend how it can be achieved.
Ability to show a value if you hover over the point
The ChartComponent (in the new charts package) allows you to override the seriesPressed() and seriesReleased() methods to respond to clicks on points in the chart. You can then display whatever you want in response. These methods are passed events telling you which series (and data point) was pressed.
Ability to show, hide a curve on demand
You can just modify the chart model (e.g. to remove/add a series), then repaint the ChartComponent.

Related

MPAndroidChart draw multiple charts lined vertically with shared X axis

I wonder if it is possible to achieve something like this with MPAndroidChart library?
Basically, I want to have multiple line charts with different Y axis stacked vertically sharing the same X axis (when I move, zoom or highlight a value I want them to be synchronized). If I get it right, there is no explicit support for this behavior.
I tried to manipulate the values (set negative ones with offset) of the second dataset and I was able to achieve the desired charts placement. But I couldn't find a way to draw the values correctly on the Y axis (AxisValueFormatter isn't enough because I need alternate granularity).
Now I'm thinking of having multiple charts glued together and synchronized by callbacks and zoom/move/highlight them programmatically. But I fear it may affect the performance since I need to work with thousands of data points.
Any ideas? I may even take a look at other free libraries if they can do it, but I prefer to stick with MPAndroidChart as I have good experience with it.

Programmatically show CrossHair in Shinobi Charts for Android (Xamarin)

I'm trying to display the crosshairs on a Shinobi Chart programmatically (via a separate button) on Android and can't figure a way to. I've seen the iOS way which basically involves calling moveToFloatingPosition on the chart.Crosshair.
The closest I've come is calling Focus on Chart.Crosshair, but IsActive and IsShown are false until I long-press on the chart. I'm assuming this is because TrackedSeries is null, so maybe there's a way to set the TrackedSeries programmatically?
shinobiChart.Crosshair.Style.LineColor = Color.Fuchsia.ToAndroid();
shinobiChart.Crosshair.CrosshairMode = Crosshair.Mode.SingleSeries;
lineSeries.CrosshairEnabled = true;
shinobiChart.Crosshair.Focus = lineSeries.DataAdapter.Get(500); // arbitrary DataPoint - it's in the middle of the chart
shinobiChart.RedrawChart();
In the Android version of shinobicharts the API doesn't allow for programmatically displaying the Crosshair - this has to be done via a user gesture (specifically a long press).
What you can do is take advantage of the MotionEvent API in the Android SDK. This allows you to programmatically create user gestures and so you can "perform" a long press on the chart in order to display the Crosshair.
You use the obtain() method to create the MotionEvents - there are a number of overloads of this method so take a look at the docs to see which is the most appropriate to your needs, but the one linked above is the simplest.
Additionally, you can use the conversion methods on the Axis class to go from data values to pixel values, which might help in making sure your MotionEvent is performed directly on the plot area. See Axis.getPixelValueForUserValue(). Note, this method will only return a valid result after the chart has been laid out (but as you're doing this from a button press that shouldn't be a problem).
I appreciate this is a bit fiddly; you'll have to manage the "touch gestures" and make sure you're not permanently "pressing down" on the screen but on the whole it's pretty straight forward. Programmatic control of the Crosshair is definitely something that has been requested before and as such is on our product roadmap though at this stage I'm not able to say when this feature will be available.
Full disclosure - I work for shinobicontrols

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

Android - Using AChartEngine, is it possible to zoom in to a specific point upon displaying the graph?

I have a bar graph with 100+ bars and want to zoom in to a specific range upon displaying the graph. For example, when the graph is displayed on the screen I want only the bars 44-49 to be showing. It is important that the users will be able to zoom out to see all 100+ bars as well.
GraphicalView.zoomIn() would work if it allowed me to specify a point to zoom in to.
Thanks!
You can set the visible range on the X axis:
renderer.setXAxisMin(44);
renderer.setXAxisMax(49);

AChart engine limit pan to valid data points

I have an Android application that is using Achart to create a 2 graphs. Both a line graph and a bar graph.
These graph will be populated with an extra data point each time the application is run. So after 10 runs there will be enough data to cover the visible x-axis.
What I want is for after the 11th+ use, to be able to pan the graph, so that the user can see historical data (back to the first data point).
I have set
renderer.setPanEnabled(true, false);
renderer.setZoomEnabled(false, false);
renderer.setYAxisMin(0);
renderer.setXAxisMin(0.5);
renderer.setXAxisMax(10.5);
renderer.setYAxisMax(100);
Which is all good, but when I pan the data I am able to pan to -ve values on the x axis, and also able to pan way beyond the maximum data point that I already have.
I have tried setting a PanListener, which I think is the way to go, but I am just not sure what I should be setting in this Listener to clamp the panning to valid data points only.
Any ideas?
The user pan will just modify the X axis min and max. In order to avoid this, you will have to indeed add a PanListener and reset these values.
You can also set pan limits.
renderer.setPanLimits(limits);

Categories

Resources