I am trying to create a Piechart in my android app. this link using achartengine helped. But I still have a problem. I want to display the % of distribution in the pie chart itself
Thanks in advance.
I was also looking for the same. But see the answer given by Dan here. I suppose he is the guy behind AChartEngine and he says that the names of legends and Labels cannot be different.
Update:
Although what I did to over come this was, that I made the legend size as 0. Then in the label I set the label and the computed percentage together. So, in your case, the labels would turn out to be:
Mg+ : 23%
Na+ : 45% ...so on.
Update:2
This issue for present in version 1.0.0 and has been solved in the latest version 1.1.0-rc2 version. You can download it from here. Now as #Dan says it here, we can have different Legend and Label values. We can also use:
renderer.setDisplayValues(true);
to displays the percentage distribution in the pie chart itself.
In order to get the details in % form, you can use the following :
renderer.setChartValuesFormat(NumberFormat.getPercentInstance());
Related
I’m trying to implement the following chart using Androidplot, and I’m wondering how to set the major and minor grids as shown in the picture with Androidplot? Is it using setLinesPerRangeLabel to achieve it? I’m new to Androidplot so some sample code will be of great help, thanks!
Try playing around with setRangeStep() and setLinesPerRangeLabel() (use setDomainStep() & setLinesPerDomainLabel() for domain)
For the step I use StepMode.SUBDIVIDE. When the setLinesPer[Range/Domain]Label is high enough you should start to see the thicker graph lines.
Why is there a blue form? I'm confused
It's called a blueprint, it only represents the size of different boxes, not whatever content they have.
You can choose to see only design / blueprint here or both.
I am new to android development.My requirement is to implement a number picker with range selector and the range values will be static as per the image.Is there any libraries or any other ways available to do this.I have researched a lot but cant get any thing related to this.
The section with green color can be scrolled to any where over the blue bar.And also the blue bar is scrollable itself having ranges from -40 to +40.
Please help
May be it can solve you problem
https://github.com/yahoo/android-range-seek-bar
i am trying to edit the source code of AChart Engine which is very good,
I need to reduce the margin above the pie chart i have tried with renderer.setMargins() but not working,and also i need the chart to be bit bigger which should work for all screen sizes.
I have added the pie chart to a LinerLayout and i have a Scroll View to that linear layout but when i scroll down the pie chart shrinks.
There is some margin below thew legends how to remove that?
please share your views on this and help me.
I told you before that you are asking several questions in a single one. However, I will answer them anyway:
Play with the value you pass to the renderer.setScale() method.
Use renderer.setInScroll(true).
Use renderer.setFitLegend(true).
For the 2nd case use renderer.setZoomEnabled(false, false); and renderer.setPanEnabled(false, false);
I have to draw a dynamic graph of data from a database in android
Any example code regarding this will be appreciated.
I like GraphViz for generating graphs as .gif files.
So...many...graph questions...
Read here: https://stackoverflow.com/questions/5156740/im-looking-for-fancy-charts-library-for-android/5157576#5157576
TeeChart beta is public: http://steema.com/entry/60
Can heavily recommend TeeChart, it's a great library. Been using it for a while now. Since I haven't put this anywhere yet, here's a bit of my "how-to" document:
TeeChart info:
Disable 3D: chart.getAspect().setView3D(false);
Disable Legend: chart.getLegend().setVisible(false);
Disable footer: chart.getFooter().setVisible(false);
Disable header: chart.getHeader().setVisible(false);
SOLVED - How to set marks to data value instead of cylinder number?
For a Bar data-set: bar.getMarks().setStyle(MarksStyle.VALUE);
SOLVED - How to move the marks closer to the chart rectangle?
bar.getMarks().setArrowLength(5); - or negative values to put them on top of the bar
SOLVED - Different styles:
bar.setBarStyle(BarStyle.RECTANGLE);
SOLVED - How do I put a heavier color reference (in terms of readability) on the legend? Thicker (higher) line, not wider
chart.getLegend().setColorWidth(100); makes it wider, but not thicker or anything
chart.getLegend().setFontSeriesColor(true); helps with the issue by also coloring the text
line.getLinePen().setWidth(5); works, but it will change the width of the line as well.
No legend callback yet.
SOLVED - How do I make the lines thicker in a graph?
line.getLinePen().setWidth(5); works, but it will change the width of the Legend as well.
SOLVED - How do I change the color of labels on axes?
chart.getAxes().getLeft().getLabels().getFont().setColor(Color.WHITE);
chart.getAxes().getBottom().getLabels().getFont().setColor(Color.WHITE);
SOLVED WORKAROUND - How do I set the background color of the chart itself? Tried so far (the TChart methods that take a Color from the TChart Color class, not the View methods) - only managed to make the 'surrounding' area black.
chart.setBackground(Color.BLACK);
chart.getCanvas().setBackColor(Color.BLACK);
chart.getGraphics3D().setBackColor(Color.BLACK);
---> WORKAROUND: Use the setBackground above, then use: chart.getWalls().getBack().setVisible(false); --- setColor() on walls is bugged?
SOLVED - How to choose the bounds of a chart manually?
chart.getAxes().getLeft().setAutomatic(false);
chart.getAxes().getLeft().setMinMax(-2, 2);