How to add legend for Pie chart in Android plot? - android

I am using Android Plot(http://androidplot.com/) library to draw a Pie chart and Pie chart draw is fine but I want legend and its customisation as shown in attached image so please guide me to do same in Android Plot library.

Pie chart legends were added in Androidplot 1.5.0 but is disabled by default. To enable:
pieChart.legend.setVisible(true);
Configuration of the legend works the same way it does for other series types in Androidplot. For example, you can configure a single column with 4 rows:
pie.getLegend().setTableModel(new DynamicTableModel(1, 4));
Or a single row with 4 columns (shown below):
pie.getLegend().setTableModel(new DynamicTableModel(4, 1));

Related

Combined values in Pie chart issue in Android

I am drawing a Pie chart in Android using MPAndroidChart. I have two different array list for different teams and need to show both list in combined form on Pie chart. Now i'm having an issue while drawing data on chart.
As you can see in screenshot "caught" type is showing 2 time with different values in chart. How to combine both of them with sum of their respective values?

Chart with pair of lines with single legend entry

Specifically, with MPAndroidChart I'm trying to create bollinger bands on a LineChart. I'd like both lines to be the same color and share a single legend entry but I can't seem to find a way to do this. It seems if I have 2+ lines I need to have 2+ legend entries.
Also is there a way to stack the legends vertical when positioned below the graph?
What you mentioned is just the Legend that is auto generated depending on your data.
But the Legend also has a setCustom(...) method that allows you to set any amount of colors and labels that you like.
Legend l = chart.getLegend();
l.setCustom(integerColorArray, stringLabelArray);
More on that in the wiki.

LineChart issue using MPAndroidChart library

I am trying to make a simple smooth line chart which show the X axis as date-time on bottom and Y axis as normal left side. I just started using MPAndroidChart API and its example app in Git. In the example Line chart I am not able to find option to change X axis labels to show on bottom instead of top as show currently.
Just like:
Also is there a way to handle date-time data for X axis values ?
Also I tried my hand on Androidplot API but to make the line smooth there I need to make changes in library code which is not compiling at all in my Eclipse and giving errors. Also in Androidplot I did not find an option to show popup with data once I click on line chart.
So if anyone know how to make a smooth line chart using Androidplot API without modifying its library code and how to bring small popup with data in Androidplot API please reply.
// XAxis settings
graph.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
graph.getXAxis().setLabelsToSkip(0);
// and
// make the line smooth
graph.getLineData().getDataSets().get(0).lineDataSet.setDrawCubic(true);
Refer this:
http://wptrafficanalyzer.in/blog/android-drawing-line-chart-using-achartengine/
for smooth curve lines please refer this:
How to make line with rounded (smooth) corners with AndroidPlot
Hope this may help you.
AChartEngine is a charting library for Android applications. Using AChartEngine library, we can plot various charts like line chart, area chart, pie chart, time chart, bubble chart etc.

How to set different values for Legend and Labels in piechart While I am using Chart Engine in android

Hi I am using A chart Engine to display pie chart in android.In my code I want to show values on labels and area corresponding to that vale on legend.But I am unable to get that one.Please can any one helps to me.Thanks in advance.
I want like below
Displaying the pie labels with separate values from the legend labels is not possible in AChartEngine.
However, you can display the pie slice value (age in your case) in the middle of each slice, using:
renderer.setDisplayChartValues(true);
There was a bug in the code that was preventing displaying the chart values when the labels were not displaying. I have just fixed this issue in SVN. You can checkout the code according to this page and run an ant dist in order to build an up to date achartengine.jar file including this fix.
I was also having the same problem but now its solved. Thanks dan...
You can use
renderer.setDisplayValues(true);
This displays the %of distribution in the pie chart itself.

Android Line chart/graph API

I need to show progressive numeric stats to my Line Graph/Chart. Please share your opinion and advice. Please also make a note that I prefer if there would be a native API.
rohit
AChartEngine is a charting library for Android applications. It currently supports the following chart types:
line chart
area chart
scatter chart
time chart
bar chart
pie chart
bubble chart
doughnut chart
range (high-low) bar chart
dial chart / gauge
combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart
cubic line chart
You can get more information from this link.
Check out Zeitdata Charts. It is very lean and offers line charts and scatter plots. It also allows you to see what a chart would look like from within a layout editor.

Categories

Resources