So long story short, I used MPAndroidChart it works great(thanks to creators). As there were couple of crashes in this lib, we decided to update the library to latest.
After updating to latest versions of Library lots of methods/classes started showing error(not found). Some examples are
chart.setGridColor(Color.WHITE & 0xAAFFFFFF);
YLabel y = chart.getY..... // Seems this is changed to YAxis
chart.setDrawVerticalGrid(false) // Error not found
chart.setTypeFace //
There are other errors as well, tried alot but seems no links to point out which latest api to be followed.
Generally when Google removes some apis, they mention which one to use instead of this one.
P.S:- I hope this gets answer by Mr Philip Jahoda :)
chart.drawVerticalGrid(...) also moved to the axis. YAxis now controls the horizontal grid via yAxis.setDrawGridLines(...), XAxis controls the vertical grid via the same method.
For more information I suggest you check out the examples which are always up to date with the latest version.
Related
I have created a graph with a series of data. Now I'm trying to add a slider / line marker to the chart like the one below.
I created the graph/charts using the MPAndroidChart library provided here https://github.com/PhilJay/MPAndroidChart.
The graph seems to be working fine and good but i need a line slider like below so that when i touch on the graph the line slides and provides the values of the line intersecting the graph.
Could anyone help me figure out this problem or do i have to use a different library to achieve this.
This feature just became available: https://github.com/PhilJay/MPAndroidChart/commits/master
However, it is not available as a release yet, so you cannot get it via gradle or maven, only via cloning the repository.
It will be in the next release v2.1.0 which will be available within the next week.
How do I display values on top of a bar chart using the shinobi library in android
The AnnotationsManager, specifically the addTextAnnotation method, is the solution that you are looking for. You can use this method to add any string to the chart at any X and Y position, in terms of data.
There is a How-To guide about Annotations at the ShinobiControls website. This How-To guide, along with an accompanying sample app, is also included in the download bundle.
Disclaimer: I work for ShinobiControls.
I'm trying to write one example of Android application using the AndroidPlot library.
That library is excellent, but I couldn't found anything about how to display the value data on the top of each bar in the Bar Chart.
Totally doable. I actually just answered the question here:
https://groups.google.com/forum/?fromgroups=#!topic/androidplot/TimE-j9VnaY
But for convenience here's a quick snippet that works in Androidplot 0.6.0 and later. There's also an easy way to do this in previous versions of Androidplot but you'll need to get those details from the thread above.
BarFormatter bf1 = new BarFormatter(Color.RED, Color.BLACK);
bf1.setPointLabelFormatter(new PointLabelFormatter(Color.WHITE));
plot.addSeries(series1, bf1);
Is there a way to only show the custom Y Grid
Since mRenderer.setSHowCustomTextGrid accepts only one parameter I don;t know how to set this.
How it is now:
How I want it:
I added the APIs you need in SVN. You can download a version including this feature here.
I realise AndroidPlot has a forum but it isn't the most active so i'll chance my arm here...
I'm trying to remove the series indicator or plot legend from my XY plot using the AndroidPlot library. I don't want to remove the series from the plot itself, just the legend.
I've seen it done on AndroidPlot examples but with the limited documentation it's difficult to find methods to do the stuff like remove the legen
OK I have the following code to do this. This is not tested on the very latest version but hopefully is still good.
if (!mKeyOn)
mDynamicPlot.getLayoutManager()
.remove(mDynamicPlot.getLegendWidget());
if (!mDomainLabelOn)
mDynamicPlot.getLayoutManager().remove(
mDynamicPlot.getDomainLabelWidget());
Looks like the trick is to get the layoutManager.
You can also use Androidplot's XML Styling with Configurator and thanks to reflection remove plot legend by simply specifying it's visibility in XML layout file like this:
<com.androidplot.xy.XYPlot
...
androidPlot.legendWidget.visible="false"
... />
If there is no need to change your legend dynamically, I think it's better to place such a styling in the XML file.
Looking at the code, setLegendWidget only updates the local handle for the LegendWidget but does not update the LayoutManager, which is what is actually invoked when it comes time to do the drawing. If you implement Ifor's (upvoted) suggestion you should have success since it interacts with the LayoutManager directly:
plot.getLayoutManager().remove(plot.getDomainLabelWidget());
Another option is to hide the Legend like this:
plot.getLegendWidget().setVisible(false);
Provided (in light of the info above) that you are not also trying to substitute/remove the legend widget with a previous call to setLegendWidget().
If you want to remove only one (or a specific) series legend from the legend widget simply use:
yourSeriesFormater.setLegendIconEnabled(false);
This worked for me.