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.
Related
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.
I need to create horizontal selector like in Uber android app (Please check screen shot). But that selector list must be dynamic means (Array[1,2,3,4...]). Please check screen shot:
I trid a lot but nothing worked with grate UI like this, I have trid also this link: check link. Its worked but bad UI because its uses paint to create things. Please help me to achieve same thing. I am trying it for payment selection option based on region. So its must be dynamic.
You can use android ui widget seekbar for this purpose and then customize it.
Also you can refer the following example
Seekbar
I'm porting one of my iOS apps over to Android (which I'm pretty new to), and I was wondering how I would draw this shape in Android using XML:
I want to recreate the shape (the white object) at the bottom of a tableView. The image attached is a screenshot of the bottom of a UITableView.
Any help would be greatly appreciated if you need any more info just let me know.
Thanks
EDIT:
Sorry I wasn't totally clear, I'm actually trying to recreate the slight arch at the bottom of the table. Since it's so slight, you may not be able to see it with a quick glance.
It seams to me that you want to "lift" your table up a little bit. If so, you have to implement this attribute to your tableView:
android:elevation="2dp"
or in java:
tableview.setElevation(2);
My opinion when reading this question: Stop trying to make your android apps look like iOS apps !!!
If you still want to do it.
Just have the background color for your activity to that color and set the layout_margin to either 2 or 4.
It should give you your desired effect.
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.
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!