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 All the above supported chart types can contain multiple series, can be displayed with the X axis horizontally (default) or vertically and support many other custom features. The charts can be built as a view that can be added to a view group or as an intent, such as it can be used to start an activity. The model and the graphing code is well optimized such as it can handle and display huge number of values. AChartEngine is currently at the 1.0.0 release. New chart types will be added in the following releases. Please keep sending your feedback such as we can continually improve this library. Find us on Facebook, too: http://www.facebook.com/achartengine Read a short introduction to AChartEngine here: http://www.javaadvent.com/2012/12/achartengine-charting-library-for.html Another good tutorial can be read here: http://jaxenter.com/effort-free-graphs-on-android-with-achartengine-46199.html
0
stars
1
forks
source link
Barchart - Bars does not display at correct positions #312
What steps will reproduce the problem?
1. BarChart
2.
3.
What is the expected output? What do you see instead?
Please provide a source code snippet that we can use to replicate the issue.
xAxisBarDisplayBottomValues = new String[] { "Jan", "Feb", "Mar", "Apr"};
xAxisTempPositions = new int[]{ 0, 1, 2, 3};
barValues = new int[]{ 20, 60, 27, 90};
public XYMultipleSeriesRenderer getBarChartRenderer() {
XYMultipleSeriesRenderer multiRenderer = new XYMultipleSeriesRenderer();
multiRenderer.setBarWidth(30);
multiRenderer.setXLabels(0);
multiRenderer.setInScroll(true);
multiRenderer.setShowAxes(true);
multiRenderer.setApplyBackgroundColor(true);
multiRenderer.setBackgroundColor(Color.WHITE);
multiRenderer.setMarginsColor(Color.WHITE);
multiRenderer.setChartTitle("Income vs Expense Chart");
multiRenderer.setYTitle("% to Total Listings");
multiRenderer.setZoomButtonsVisible(false);
multiRenderer.setXLabelsColor(Color.BLACK);
multiRenderer.setYLabelsColor(0, Color.BLACK);
multiRenderer.setAxesColor(Color.parseColor("#949494"));
multiRenderer.setLabelsColor(Color.BLACK);
multiRenderer.setShowGrid(true);
multiRenderer.setYAxisMin(0);
multiRenderer.setYAxisMax(100);
multiRenderer.setXAxisMin(-0.5);
multiRenderer.setXAxisMax(3.5);
multiRenderer.setBarSpacing(0.2);
multiRenderer.setFitLegend(true);
multiRenderer.setShowLegend(false);
multiRenderer.setZoomEnabled(true, false);
multiRenderer.setPanEnabled(true, false);
multiRenderer.setYLabelsAlign(Align.RIGHT);
multiRenderer.setMargins(new int[] { 45, 45, 45, 45 });
XYSeriesRenderer incomeRenderer = new XYSeriesRenderer();
incomeRenderer.setColor(Color.BLACK);
// to give the gradient color to the bars.
incomeRenderer.setFillPoints(true);
incomeRenderer.setLineWidth(2);
incomeRenderer.setGradientEnabled(true);
incomeRenderer.setGradientStart(0, Color.parseColor("#de3709"));
incomeRenderer.setGradientStop(100, Color.parseColor("#b7d91e"));
incomeRenderer.setDisplayChartValues(true);
multiRenderer.addXTextLabel(0, xAxisBarDisplayBottomValues[0]);
multiRenderer.addSeriesRenderer(incomeRenderer);
incomeRenderer = new XYSeriesRenderer();
incomeRenderer.setColor(Color.BLACK);
// to give the gradient color to the bars.
incomeRenderer.setFillPoints(true);
incomeRenderer.setLineWidth(2);
incomeRenderer.setGradientEnabled(true);
incomeRenderer.setGradientStart(0, Color.parseColor("#FFFFFF"));
incomeRenderer.setGradientStop(100, Color.parseColor("#000000"));
incomeRenderer.setDisplayChartValues(true);
multiRenderer.addXTextLabel(1, xAxisBarDisplayBottomValues[1]);
multiRenderer.addSeriesRenderer(incomeRenderer);
incomeRenderer = new XYSeriesRenderer();
incomeRenderer.setColor(Color.BLACK);
// to give the gradient color to the bars.
incomeRenderer.setFillPoints(true);
incomeRenderer.setLineWidth(2);
incomeRenderer.setGradientEnabled(true);
incomeRenderer.setGradientStart(0, Color.parseColor("#c9c9c9"));
incomeRenderer.setGradientStop(100, Color.parseColor("#000000"));
incomeRenderer.setDisplayChartValues(true);
multiRenderer.addXTextLabel(2, xAxisBarDisplayBottomValues[2]);
multiRenderer.addSeriesRenderer(incomeRenderer);
incomeRenderer = new XYSeriesRenderer();
incomeRenderer.setColor(Color.BLACK);
// to give the gradient color to the bars.
incomeRenderer.setFillPoints(true);
incomeRenderer.setLineWidth(2);
incomeRenderer.setGradientEnabled(true);
incomeRenderer.setGradientStart(0, Color.parseColor("#de3709"));
incomeRenderer.setGradientStop(100, Color.parseColor("#000000"));
incomeRenderer.setDisplayChartValues(true);
multiRenderer.addXTextLabel(3, xAxisBarDisplayBottomValues[3]);
multiRenderer.addSeriesRenderer(incomeRenderer);
return multiRenderer;
}
private XYMultipleSeriesDataset getBarDemoDataset() {
// Creating a dataset to hold each series
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
XYSeries incomeSeries1 = new XYSeries("Income1");
incomeSeries1.add(xAxisTempPositions[0], barValues[0]);
dataset.addSeries(incomeSeries1);
XYSeries incomeSeries2 = new XYSeries("Income2");
incomeSeries2.add(xAxisTempPositions[1], barValues[1]);
dataset.addSeries(incomeSeries2);
XYSeries incomeSeries3 = new XYSeries("Income3");
incomeSeries3.add(xAxisTempPositions[2], barValues[2]);
dataset.addSeries(incomeSeries3);
XYSeries incomeSeries4 = new XYSeries("Income4");
incomeSeries4.add(xAxisTempPositions[3], barValues[3]);
dataset.addSeries(incomeSeries4);
return dataset;
}
What version of the product binary library are you using?
Please provide any additional information below.
Original issue reported on code.google.com by vedavyas...@gmail.com on 5 Jun 2013 at 8:01
Original issue reported on code.google.com by
vedavyas...@gmail.com
on 5 Jun 2013 at 8:01