how to change the chart UI when using Achartengine in android? - android

when using Achartengine for drawing a chart , the function of Achartengine library will just provide a intent, then you just need to jump to the screen pointing by the intent ; yes .... this can be work perfect .. However , the screen is so simple and the style of the chart screen is totally uncompatible with other screen's , and it seems that the Achartengine library doesn't provide any interface to change the chart UI ( not just the color of line or point), can any one tell me some idea to solve this issue...
any help will be appreciated!
bob

The AChartEngine APIs actually allow you create views as well. This means that you can have a chart together with other UI components under the same screen. There is example code in the AChartEngine demo showing you how to do this.

If you apply an application wide theme through your manifest you will inherit some of them. Things like background colors, etc. Otherwise you have to specify your text/axis/line colors through code when setting up the intent.

Related

Android customised box plot chart

How do I implement a box plot graph on Android like this? It seems to be similar to CandleStick Chart of MPAndroidChart. Is there any other good way?
The CandleStickChart is the closest match to your requirement for that library in MPAndroidChart although you could have a look at the other chart libraries here
to see if there is anything closer.
The CandleStickChart from MPAndroidChart looks like this:
CandleStickChartActivity in the example GitHub project is a good start for you to base your implementation.
If you need to customise the appearance of the chart further (e.g., to use circles instead of boxes) you will need to write a custom renderer. See this question for how to do that.

MPAndroidChart how to set a dual-background color on the chart

I am using the latest MPAndroidChart library, and I was wondering if there is way to set a dual-background color on the chart. I need the colors to match a certain number of days that will be displayed on the x-axis. I would like to be able to do this programmatically as I will be using real time data, so the background will be set to a certain no. of days and move along as the chart is updated.
I think you will have to programmatically create a bitmap that always changes according to the latest realtime data you get. Then, you use that Bitmap and set it as the chart-background.
There is no way to set a specific background color (or multiple) in the way you describe it other than via the methods and ways the View class itself already provides.
In order to get the style that I wanted I downloaded the source-code and edited it to allow me to add a Bitmap image to the graph background. So now the background is redrawn when new data is entered and then added to the graph background so that it looks like the date is linked to the background color. Thanks again to Philipp Jahoda for the brilliant library and thank god for open source developers.
p.s if I ever get rich off of this app I will look after you.

Achartengine - different Bar Color for BarChart in android

I have created one graph in android using AchartEngine library.
I want to display every Bar with different color.
What can i do, please give me some suggestion..?
Thanks in Advance
Just look at answer given here. In this he is giving different color to only one bar.
Take idea of it and try to make it custom according to your requirements.

Remove series indicator/plot legend AndroidPlot

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.

How to Draw custom Bar charts in Android

I am developing an application, in which there is a requirement for showing results in a Bar charts. I have tried developing charts using AChartEngine and Google api and many other apis. But my Requirement is to draw multiple charts in one Activity. I followed this.Its working fine. But when i try to set the background image for the whole screen, Its not working
Can Anybody help me please
Just check this Bar Chart in Android With out any Built in jars. Here you can draw charts without any built in jars. Its just simple Graph creation using the concept of setting the height for the textview in a ListView.
I implemented this by using the Horizontal ListView. Here you have the two double arrays with equal size of elements. And the graph will adjust according to the orientation(Portrait and landscape).
If you want more charts in one activity, you can implement another Horizontal Listview in the layout.
I hope this will help you....
i can help you with paid Library which is nice
is called aiCharts (Bar Charts)
or you should refer GraphViewDemo it is also anice and free libraray to make bar graph
GraphViewDemo
I am writing a blog post on the subject. For one of my clients I created a compound view with an embedded bar chart. I did not find a simple and flexible library to achieve this, so I decided to go with custom views. To my surprise, it was simpler than I had expected: create a custom view that takes a colour and a percentage as attributes and use linear layouts to contain its instances, using layout_weight or a fixed layout_width to maintain proportions. I am very happy with the results.

Categories

Resources