What steps will reproduce the problem?
1. take bar chart on one y axis and take line chart on another y axis
2. default bar chart of stacked is drawn
3.
What is the expected output? What do you see instead?
option of stacked or default chart should be there
Please provide a source code snippet that we can use to replicate the issue.
/**
* Copyright (C) 2009, 2010 SC 4ViewSoft SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.achartengine.chartdemo.demo.chart;
import java.util.ArrayList;
import java.util.List;
import org.achartengine.ChartFactory;
import org.achartengine.chart.BarChart;
import org.achartengine.chart.RangeBarChart;
import org.achartengine.chart.LineChart;
import org.achartengine.chart.PointStyle;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYMultipleSeriesRenderer.Orientation;
import org.achartengine.renderer.XYSeriesRenderer;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint.Align;
/**
* Multiple temperature demo chart.
*/
public class MultipleTemperatureChart extends AbstractDemoChart {
/**
* Returns the chart name.
*
* @return the chart name
*/
public String getName() {
return "Temperature and sunshine";
}
/**
* Returns the chart description.
*
* @return the chart description
*/
public String getDesc() {
return "The average temperature and hours of sunshine in Crete (line chart with multiple Y scales and axis)";
}
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "Air temperature","Water" ,"India"};
List<double[]> x = new ArrayList<double[]>();
for (int i = 0; i < titles.length; i++) {
x.add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9});
}
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 18, 12.5, 13.8, 0, 0, 24.4, 26.4, 26.1, 23.6});
values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6 });
values.add(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9});
int[] colors = new int[] { Color.BLUE, Color.YELLOW ,Color.DKGRAY,Color.DKGRAY};
PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT ,PointStyle.POINT,PointStyle.POINT};
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(4);
setRenderer(renderer, colors, styles);
renderer.setOrientation(Orientation.HORIZONTAL);
int length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
r.setLineWidth(3f);
}
setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32,
Color.LTGRAY, Color.GRAY);
renderer.setXLabels(12);
renderer.setYLabels(10);
renderer.setShowGrid(true);
renderer.setXLabelsAlign(Align.RIGHT);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setZoomButtonsVisible(true);
renderer.setPanLimits(new double[] { -10, 20, -10, 40 });
renderer.setZoomLimits(new double[] { -10, 20, -10, 40 });
renderer.setZoomRate(1.05f);
renderer.setBarSpacing(0.5f);
renderer.setLabelsColor(Color.WHITE);
renderer.setXLabelsColor(Color.GREEN);
renderer.setYLabelsColor(0, colors[0]);
renderer.setYLabelsColor(1, colors[1]);
renderer.getSeriesRendererAt(0).setDisplayChartValues(true);
renderer.getSeriesRendererAt(1).setDisplayChartValues(true);
renderer.setYTitle("Hours", 1);
renderer.setYAxisAlign(Align.RIGHT, 1);
renderer.setYLabelsAlign(Align.LEFT, 1);
renderer.setDisplayChartValues(true);
renderer.addYTextLabel(20, "Test", 0);
renderer.addYTextLabel(10, "New Test", 1);
renderer.setPanEnabled(true, false);
renderer.setScale(4.0f);
XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
values.clear();
values.add(new double[] { 4.3, 4.9, 5.9, 8.8, 10.8, 11.9, 13.6, 12.8, 11.4 });
addXYSeries(dataset, new String[] { "Sunshine hours" }, x, values, 1);
// Intent intent = ChartFactory.getCubicLineChartIntent(context, dataset,
renderer, 0.3f,
// "Average temperature");
String[] types = new String[] { BarChart.TYPE,BarChart.TYPE,BarChart.TYPE, LineChart.TYPE
};
Intent intent = ChartFactory.getCombinedXYChartIntent(context, dataset, renderer, types,
"Weather parameters");
return intent;
}
}
What version of the product binary library are you using?
achartengine 1.0.0 .jar
Please provide any additional information below.
Original issue reported on code.google.com by cmaheshs...@gmail.com on 13 Apr 2012 at 8:07
Original issue reported on code.google.com by
cmaheshs...@gmail.com
on 13 Apr 2012 at 8:07