Android: how to set the chart engine title to two lines? - android

I am developing an app in which i am implementing Achart engine line chart. Everything is working fine. I want to set the chart title to two lines if it is big title. But there is no option given, to set it to two lines. How can i do that? Can any one of you help me?

I have never been in such situation but seeing you question I did some RnD on the Source code of the AChartEngine open source code.
And I found this two things :
1) in code where they set tile Line no 251
2) and XML file for the same
but there is nothing which can stop the TextView to be more than single line.
I am not enough capable that I file this as bug..
But As far as I understand You will have to figur out something else for you as there is no any other option using the library for this thing.

Related

How can I implement the moving line on a graph like that in the native "data usage" app of android

I'm using mpandroidchart's bar chart and I need to implement a horizontal moving line on top of this chart. I also want the upper part of this chart to change the color as I move this line up or down.
Is there provision to implement this already or will I have to write my own code? Or will it be easier to get some part of the library tweaked?
Thanks in advance.

how to remove spaces between bars?

I have developed a bar chart using achartengine library.
Achartengine is rendering the blank values of the series and creating undesired spaces, how to remove that?
Does anyone knows how to stop that??
There are a couple of things you could do:
Use renderer.setBarSpacing(0);
If the above only is not working then make sure none of the series has exactly one item. If this happens then just add an empty bar or one with MathHelper.NULL_VALUE as the value

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 change the chart UI when using Achartengine in 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.

Give some links or source code of Line chart which is embedded into application

I want to add line chart in my application , which has two view 1st view is image 2nd view is line chart, i want to add x values dynamically chart has to grow after adding each x values.
please suggest some link or code.
I don't fully understand the issue of 2 views in the question. What should the image represent ? How is it related to the chart ?
As for rest (i.e. having a dynamic line chart) - I have successfully achieved that with the AndroidPlot library (http://androidplot.com/), and I think it might do the trick for you.
I use Jonas's GrapView lib to show charts. Take a look on this lib, it very simple and easy to use. He shows ho to use it with a lot of example.
Good Luck!

Categories

Resources