Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » bar chart with 2 y-axes(problem )
bar chart with 2 y-axes [message #849557] Thu, 19 April 2012 04:53 Go to next message
Hao Jin is currently offline Hao Jin
Messages: 2
Registered: April 2012
Junior Member
The following code can generate a bar chart (showed in attachment) with 2 y-axes. The bars are not side by side, but overlapped.

I need help, thanks!


ChartWithAxes cwaBar = ChartWithAxesImpl.create();
		cwaBar.setType("Bar Chart"); //$NON-NLS-1$
		cwaBar.setSubType("Side-by-side"); //$NON-NLS-1$

		// Plot

		cwaBar.getBlock().setBackground(ColorDefinitionImpl.WHITE());
		cwaBar.getPlot().getClientArea().setBackground(ColorDefinitionImpl.create(255, 255, 225));

		// Title

		cwaBar.getTitle().getLabel().getCaption().setValue("Line Chart with Multiple Y Axis");//$NON-NLS-1$

		// Legend

		Legend lg = cwaBar.getLegend();
		LineAttributes lia = lg.getOutline();
		lg.getText().getFont().setSize(16);
		lia.setStyle(LineStyle.SOLID_LITERAL);
		lg.getInsets().set(10, 5, 0, 0);
		lg.getOutline().setVisible(false);
		lg.setAnchor(Anchor.NORTH_LITERAL);

		// X-Axis

		Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes()[0];
		xAxisPrimary.setType(AxisType.TEXT_LITERAL);
		xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
		xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);

		// Y-Axis

		Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis(xAxisPrimary);
		yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
		yAxisPrimary.setSideBySide(true);

		// Y-Axis (2)

		Axis yAxis = AxisImpl.create(Axis.ORTHOGONAL);
		yAxis.setType(AxisType.LINEAR_LITERAL);
		yAxis.getMajorGrid().setTickStyle(TickStyle.RIGHT_LITERAL);
		yAxis.setLabelPosition(Position.RIGHT_LITERAL);
		xAxisPrimary.getAssociatedAxes().add(yAxis);
		yAxis.setSideBySide(true);

		// Data Set
		TextDataSet categoryValues = TextDataSetImpl.create(new String[] {
				"March", "April", "May", "June", "July" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
		NumberDataSet orthoValues1 = NumberDataSetImpl.create(new double[] {
				12.5, 19.6, 18.3, 13.2, 26.5 });
		NumberDataSet orthoValues2 = NumberDataSetImpl.create(new double[] {
				22.7, 23.6, 38.3, 43.2, 40.5 });
		SampleData sd = DataFactory.eINSTANCE.createSampleData();
		BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData();
		sdBase.setDataSetRepresentation("");//$NON-NLS-1$
		sd.getBaseSampleData().add(sdBase);
		OrthogonalSampleData sdOrthogonal1 = DataFactory.eINSTANCE
				.createOrthogonalSampleData();
		sdOrthogonal1.setDataSetRepresentation("");//$NON-NLS-1$
		sdOrthogonal1.setSeriesDefinitionIndex(0);
		sd.getOrthogonalSampleData().add(sdOrthogonal1);
		OrthogonalSampleData sdOrthogonal2 = DataFactory.eINSTANCE
				.createOrthogonalSampleData();
		sdOrthogonal2.setDataSetRepresentation("");//$NON-NLS-1$
		sdOrthogonal2.setSeriesDefinitionIndex(1);
		sd.getOrthogonalSampleData().add(sdOrthogonal2);
		cwaBar.setSampleData(sd);
		// X-Series
		Series seCategory = SeriesImpl.create();
		seCategory.setDataSet(categoryValues);
		SeriesDefinition sdX = SeriesDefinitionImpl.create();
		xAxisPrimary.getSeriesDefinitions().add(sdX);
		sdX.getSeries().add(seCategory);

		// Y-Series (1)
		BarSeries bs1 = (BarSeries) BarSeriesImpl.create();
		bs1.setDataSet(orthoValues1);
		bs1.getLabel().setVisible(true);
		bs1.setLabelPosition(Position.INSIDE_LITERAL);
		SeriesDefinition sdY1 = SeriesDefinitionImpl.create();
		sdY1.getSeriesPalette().shift(-2);
		yAxisPrimary.getSeriesDefinitions().add(sdY1);
		sdY1.getSeries().add(bs1);

		// Y-Serires (2)

		BarSeries bs2 = (BarSeries) BarSeriesImpl.create();

		bs2.setDataSet(orthoValues2);
		bs2.getLabel().setVisible(true);
		bs2.setLabelPosition(Position.INSIDE_LITERAL);
		SeriesDefinition sdY2 = SeriesDefinitionImpl.create();
		sdY2.getSeriesPalette().shift(-3);
		yAxis.getSeriesDefinitions().add(sdY2);
		sdY2.getSeries().add(bs2);

		return cwaBar;

  • Attachment: barchart.PNG
    (Size: 22.76KB, Downloaded 131 times)

[Updated on: Thu, 19 April 2012 08:34]

Report message to a moderator

Re: bar chart with 2 y-axes [message #850263 is a reply to message #849557] Thu, 19 April 2012 19:09 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you open a bugzilla. If I use the following code, a report is
created with the correct chart type with side by side set on the the two
y-axis. But it does not appear to work with standalone chart engine.

Also adding a reference to older message on similar subject:
http://www.eclipse.org/forums/index.php/m/835717/

import java.io.IOException;

import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.ChartWithAxes;
import org.eclipse.birt.chart.model.attribute.Anchor;
import org.eclipse.birt.chart.model.attribute.AxisType;
import org.eclipse.birt.chart.model.attribute.IntersectionType;
import org.eclipse.birt.chart.model.attribute.LegendItemType;
import org.eclipse.birt.chart.model.attribute.LineAttributes;
import org.eclipse.birt.chart.model.attribute.LineStyle;
import org.eclipse.birt.chart.model.attribute.Palette;
import org.eclipse.birt.chart.model.attribute.TickStyle;
import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
import org.eclipse.birt.chart.model.attribute.impl.PaletteImpl;
import org.eclipse.birt.chart.model.component.Axis;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.model.component.impl.AxisImpl;
import org.eclipse.birt.chart.model.component.impl.SeriesImpl;
import org.eclipse.birt.chart.model.data.BaseSampleData;
import org.eclipse.birt.chart.model.data.DataFactory;
import org.eclipse.birt.chart.model.data.NumberDataSet;
import org.eclipse.birt.chart.model.data.OrthogonalSampleData;
import org.eclipse.birt.chart.model.data.SampleData;
import org.eclipse.birt.chart.model.data.SeriesDefinition;
import org.eclipse.birt.chart.model.data.TextDataSet;
import org.eclipse.birt.chart.model.data.impl.NumberDataSetImpl;
import org.eclipse.birt.chart.model.data.impl.QueryImpl;
import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
import org.eclipse.birt.chart.model.data.impl.TextDataSetImpl;
import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl;
import org.eclipse.birt.chart.model.layout.Legend;
import org.eclipse.birt.chart.model.layout.Plot;
import org.eclipse.birt.chart.model.type.BarSeries;
import org.eclipse.birt.chart.model.type.LineSeries;
import org.eclipse.birt.chart.model.type.impl.BarSeriesImpl;
import org.eclipse.birt.chart.model.type.impl.LineSeriesImpl;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.model.api.DesignConfig;
import org.eclipse.birt.report.model.api.ElementFactory;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.IDesignEngine;
import org.eclipse.birt.report.model.api.IDesignEngineFactory;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSourceHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.SessionHandle;
import org.eclipse.birt.report.model.api.SimpleMasterPageHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.command.ContentException;
import org.eclipse.birt.report.model.api.command.NameException;
import
org.eclipse.birt.report.model.api.elements.structures.PropertyBinding;

import com.ibm.icu.util.ULocale;


public class SimpleChart

{

private ReportDesignHandle reportDesignHandle = null;

private ElementFactory elementFactory = null;

private OdaDataSourceHandle odaDataSourceHandle = null;

private String dataSourceName = "datasource";

private String dataSetName = "maindataset";
private SessionHandle sessionHandle =null;

org.eclipse.birt.report.model.api.elements.structures.ComputedColumn
cs1, cs2 = null;

public static void main(String args[])

{
try {

new SimpleChart().createReport();

} catch (Exception e) {

e.printStackTrace();

}

}


public void createReport() throws SemanticException, IOException

{
System.out.println("Start");
init();

createMasterPages();

buildDataSource();
buildDataSet();
createBody();


reportDesignHandle.saveAs("output/desample/simplecharttest.rptdesign");
reportDesignHandle.close( );
Platform.shutdown();
System.out.println("Finished");

}


private void init(){


DesignConfig config = new DesignConfig( );

IDesignEngine engine = null;

try {

Platform.startup(config);

IDesignEngineFactory factory = (IDesignEngineFactory) Platform


..createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);

engine = factory.createDesignEngine(config);

} catch (Exception ex) {

ex.printStackTrace();

}


// we need a handle of session of design engine

sessionHandle = engine.newSessionHandle(ULocale.ENGLISH);
reportDesignHandle = sessionHandle.createDesign();
elementFactory = reportDesignHandle.getElementFactory();

}


private void createMasterPages() throws ContentException, NameException

{

SimpleMasterPageHandle simpleMasterPage =
elementFactory.newSimpleMasterPage("Master Page");

reportDesignHandle.getMasterPages().add(simpleMasterPage);

}

void buildDataSource( ) throws SemanticException
{

OdaDataSourceHandle dsHandle = elementFactory.newOdaDataSource(
"Data Source", "org.eclipse.birt.report.data.oda.jdbc" );
dsHandle.setProperty( "odaDriverClass",
"org.eclipse.birt.report.data.oda.sampledb.Driver" );
dsHandle.setProperty( "odaURL", "jdbc:classicmodels:sampledb" );
dsHandle.setProperty( "odaUser", "ClassicModels" );
dsHandle.setProperty( "odaPassword", "" );

PropertyBinding pb = new PropertyBinding();

reportDesignHandle.getDataSources( ).add( dsHandle );

}

void buildDataSet( ) throws SemanticException
{

OdaDataSetHandle dsHandle = elementFactory.newOdaDataSet( dataSetName,
"org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" );
dsHandle.setDataSource( "Data Source" );
String qry = "Select PRODUCTCODE, QUANTITYORDERED from orderdetails
where ordernumber = 10104";

dsHandle.setQueryText( qry );
reportDesignHandle.getDataSets( ).add( dsHandle );




}

private void createBody() throws SemanticException

{
ExtendedItemHandle extendedItemHandle =
elementFactory.newExtendedItem("Simple Chart", "Chart");
extendedItemHandle.setWidth("700px");
extendedItemHandle.setHeight("500px");

extendedItemHandle.setProperty(ExtendedItemHandle.DATA_SET_PROP,
dataSetName);
extendedItemHandle.setProperty("outputFormat","PNG");



//Chart c = createChart();
Chart c = createSideBySide();

extendedItemHandle.getReportItem().setProperty(
"chart.instance", c );

reportDesignHandle.getBody().add(extendedItemHandle);


//PropertyHandle computedSet = extendedItemHandle.getColumnBindings( );
//computedSet.clearValue();

cs1 = StructureFactory.createComputedColumn( );
cs1.setName( "PRODUCTCODE" );
cs1.setExpression( "dataSetRow[\"PRODUCTCODE\"]");
cs1.setDataType( "string" );
cs1.setAggregateOn(null);


cs2 = StructureFactory.createComputedColumn( );
cs2.setName( "QUANTITYORDERED" );
cs2.setExpression( "dataSetRow[\"QUANTITYORDERED\"]");
cs2.setDataType( "integer" );

extendedItemHandle.addColumnBinding(cs1, true);
extendedItemHandle.addColumnBinding(cs2, true);


}


public static final Chart createSideBySide(){

ChartWithAxes cwaBar = ChartWithAxesImpl.create();
cwaBar.setType("Bar Chart"); //$NON-NLS-1$
cwaBar.setSubType("Side-by-side"); //$NON-NLS-1$
cwaBar.getBlock().getBounds().setWidth(600);
cwaBar.getBlock().getBounds().setHeight(600);
// Plot

cwaBar.getBlock().setBackground(ColorDefinitionImpl.WHITE());

cwaBar.getPlot().getClientArea().setBackground(ColorDefinitionImpl.create(255,
255, 225));

// Title

cwaBar.getTitle().getLabel().getCaption().setValue("Bar Chart with
Multiple Y Axis");//$NON-NLS-1$

// Legend

Legend lg = cwaBar.getLegend();
LineAttributes lia = lg.getOutline();
lg.getText().getFont().setSize(16);
lia.setStyle(LineStyle.SOLID_LITERAL);
lg.getInsets().set(10, 5, 0, 0);
lg.getOutline().setVisible(false);
lg.setAnchor(Anchor.NORTH_LITERAL);

// X-Axis

Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes()[0];
xAxisPrimary.setType(AxisType.TEXT_LITERAL);
//xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
//xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);

// Y-Axis

Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis(xAxisPrimary);
//yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);

yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
yAxisPrimary.setSideBySide(true);

// Y-Axis (2)

Axis yAxis = AxisImpl.create(Axis.ORTHOGONAL);
yAxis.setType(AxisType.LINEAR_LITERAL);
//yAxis.getMajorGrid().setTickStyle(TickStyle.RIGHT_LITERAL);
//yAxis.setLabelPosition(Position.RIGHT_LITERAL);
xAxisPrimary.getAssociatedAxes().add(yAxis);
yAxis.setSideBySide(true);

// Data Set
TextDataSet categoryValues = TextDataSetImpl.create(new String[] {
"March", "April", "May", "June", "July"
});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
NumberDataSet orthoValues1 = NumberDataSetImpl.create(new double[] {
12.5, 19.6, 18.3, 13.2, 26.5 });
NumberDataSet orthoValues2 = NumberDataSetImpl.create(new double[] {
22.7, 23.6, 38.3, 43.2, 40.5 });
SampleData sd = DataFactory.eINSTANCE.createSampleData();
BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData();
sdBase.setDataSetRepresentation("");//$NON-NLS-1$
sd.getBaseSampleData().add(sdBase);
OrthogonalSampleData sdOrthogonal1 = DataFactory.eINSTANCE
.createOrthogonalSampleData();
sdOrthogonal1.setDataSetRepresentation("");//$NON-NLS-1$
sdOrthogonal1.setSeriesDefinitionIndex(0);
sd.getOrthogonalSampleData().add(sdOrthogonal1);
OrthogonalSampleData sdOrthogonal2 = DataFactory.eINSTANCE
.createOrthogonalSampleData();
sdOrthogonal2.setDataSetRepresentation("");//$NON-NLS-1$
sdOrthogonal2.setSeriesDefinitionIndex(1);
sd.getOrthogonalSampleData().add(sdOrthogonal2);
cwaBar.setSampleData(sd);
// X-Series
Series seCategory = SeriesImpl.create();
//seCategory.setDataSet(categoryValues);
seCategory.getDataDefinition( )
.add( QueryImpl.create( "row[\"PRODUCTCODE\"]" ) );
SeriesDefinition sdX = SeriesDefinitionImpl.create();
xAxisPrimary.getSeriesDefinitions().add(sdX);
sdX.getSeries().add(seCategory);

// Y-Series (1)
BarSeries bs1 = (BarSeries) BarSeriesImpl.create();
//bs1.setDataSet(orthoValues1);
bs1.getDataDefinition( ).add( QueryImpl.create(
"row[\"QUANTITYORDERED\"]" ) );
bs1.getLabel().setVisible(true);
//bs1.setLabelPosition(Position.INSIDE_LITERAL);
bs1.setStacked(false);
SeriesDefinition sdY1 = SeriesDefinitionImpl.create();
sdY1.getSeriesPalette().shift(-2);
yAxisPrimary.getSeriesDefinitions().add(sdY1);
sdY1.getSeries().add(bs1);

// Y-Serires (2)

BarSeries bs2 = (BarSeries) BarSeriesImpl.create();

//bs2.setDataSet(orthoValues2);
bs2.getDataDefinition( ).add( QueryImpl.create(
"row[\"QUANTITYORDERED\"]" ) );
bs2.getLabel().setVisible(true);
//bs2.setLabelPosition(Position.INSIDE_LITERAL);
bs2.setStacked(false);
SeriesDefinition sdY2 = SeriesDefinitionImpl.create();
sdY2.getSeriesPalette().shift(-3);
yAxis.getSeriesDefinitions().add(sdY2);
sdY2.getSeries().add(bs2);

return cwaBar;

}

}


Jason


On 4/19/2012 4:53 AM, Hao Jin wrote:
> The bars are not side by side, but overlapped.
>
>
> ChartWithAxes cwaBar = ChartWithAxesImpl.create();
> cwaBar.setType("Bar Chart"); //$NON-NLS-1$
> cwaBar.setSubType("Side-by-side"); //$NON-NLS-1$
>
> // Plot
>
> cwaBar.getBlock().setBackground(ColorDefinitionImpl.WHITE());
> cwaBar.getPlot().getClientArea().setBackground(ColorDefinitionImpl.create(255, 255, 225));
>
> // Title
>
> cwaBar.getTitle().getLabel().getCaption().setValue("Line Chart with Multiple Y Axis");//$NON-NLS-1$
>
> // Legend
>
> Legend lg = cwaBar.getLegend();
> LineAttributes lia = lg.getOutline();
> lg.getText().getFont().setSize(16);
> lia.setStyle(LineStyle.SOLID_LITERAL);
> lg.getInsets().set(10, 5, 0, 0);
> lg.getOutline().setVisible(false);
> lg.setAnchor(Anchor.NORTH_LITERAL);
>
> // X-Axis
>
> Axis xAxisPrimary = cwaBar.getPrimaryBaseAxes()[0];
> xAxisPrimary.setType(AxisType.TEXT_LITERAL);
> xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
> xAxisPrimary.getOrigin().setType(IntersectionType.MIN_LITERAL);
>
> // Y-Axis
>
> Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis(xAxisPrimary);
> yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
> yAxisPrimary.setSideBySide(true);
>
> // Y-Axis (2)
>
> Axis yAxis = AxisImpl.create(Axis.ORTHOGONAL);
> yAxis.setType(AxisType.LINEAR_LITERAL);
> yAxis.getMajorGrid().setTickStyle(TickStyle.RIGHT_LITERAL);
> yAxis.setLabelPosition(Position.RIGHT_LITERAL);
> xAxisPrimary.getAssociatedAxes().add(yAxis);
> yAxis.setSideBySide(true);
>
> // Data Set
> TextDataSet categoryValues = TextDataSetImpl.create(new String[] {
> "March", "April", "May", "June", "July" });//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
> NumberDataSet orthoValues1 = NumberDataSetImpl.create(new double[] {
> 12.5, 19.6, 18.3, 13.2, 26.5 });
> NumberDataSet orthoValues2 = NumberDataSetImpl.create(new double[] {
> 22.7, 23.6, 38.3, 43.2, 40.5 });
> SampleData sd = DataFactory.eINSTANCE.createSampleData();
> BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData();
> sdBase.setDataSetRepresentation("");//$NON-NLS-1$
> sd.getBaseSampleData().add(sdBase);
> OrthogonalSampleData sdOrthogonal1 = DataFactory.eINSTANCE
> .createOrthogonalSampleData();
> sdOrthogonal1.setDataSetRepresentation("");//$NON-NLS-1$
> sdOrthogonal1.setSeriesDefinitionIndex(0);
> sd.getOrthogonalSampleData().add(sdOrthogonal1);
> OrthogonalSampleData sdOrthogonal2 = DataFactory.eINSTANCE
> .createOrthogonalSampleData();
> sdOrthogonal2.setDataSetRepresentation("");//$NON-NLS-1$
> sdOrthogonal2.setSeriesDefinitionIndex(1);
> sd.getOrthogonalSampleData().add(sdOrthogonal2);
> cwaBar.setSampleData(sd);
> // X-Series
> Series seCategory = SeriesImpl.create();
> seCategory.setDataSet(categoryValues);
> SeriesDefinition sdX = SeriesDefinitionImpl.create();
> xAxisPrimary.getSeriesDefinitions().add(sdX);
> sdX.getSeries().add(seCategory);
>
> // Y-Series (1)
> BarSeries bs1 = (BarSeries) BarSeriesImpl.create();
> bs1.setDataSet(orthoValues1);
> bs1.getLabel().setVisible(true);
> bs1.setLabelPosition(Position.INSIDE_LITERAL);
> SeriesDefinition sdY1 = SeriesDefinitionImpl.create();
> sdY1.getSeriesPalette().shift(-2);
> yAxisPrimary.getSeriesDefinitions().add(sdY1);
> sdY1.getSeries().add(bs1);
>
> // Y-Serires (2)
>
> BarSeries bs2 = (BarSeries) BarSeriesImpl.create();
>
> bs2.setDataSet(orthoValues2);
> bs2.getLabel().setVisible(true);
> bs2.setLabelPosition(Position.INSIDE_LITERAL);
> SeriesDefinition sdY2 = SeriesDefinitionImpl.create();
> sdY2.getSeriesPalette().shift(-3);
> yAxis.getSeriesDefinitions().add(sdY2);
> sdY2.getSeries().add(bs2);
>
> return cwaBar;
>
Re: bar chart with 2 y-axes [message #853627 is a reply to message #850263] Mon, 23 April 2012 03:27 Go to previous messageGo to next message
Hao Jin is currently offline Hao Jin
Messages: 2
Registered: April 2012
Junior Member
Thank you very much, i have just tested it, it works. but in my Webapp i need to work with standalone chart engine. I need charts saved as .png in my xhtml site.
is this a bug of Birt?
Re: bar chart with 2 y-axes [message #854326 is a reply to message #853627] Mon, 23 April 2012 18:02 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Yes it is a bug. Can you log it? It looks like the error is in the Bar
class


public BarAxisIdLookup( ChartWithAxes cwa, Axis curAxis )

{

Axis[] axs = cwa.getOrthogonalAxes( cwa.getBaseAxes( )[0], true );

int count = 0, id = 0;

for ( Axis axis : axs )

{

if ( axis.isSideBySide( )

&& axis.getSeriesDefinitions( ).size( ) > 0 )

{

SeriesDefinition sd = axis.getSeriesDefinitions( ).get( 0 );

if ( sd.getDesignTimeSeries( ) instanceof BarSeries )

{

if ( curAxis == axis )

{

id = count;

}

count++;

}

}

}



The issue with this is that sd.getDesignTimeSeries returns null for
charts that manually set the data and thus not allowing side by side.

Jason

On 4/23/2012 3:27 AM, Hao Jin wrote:
> Thank you very much, i have just tested it, it works. but in my Webapp i
> need to work with standalone chart engine. I need charts saved as .png
> in my xhtml site.
> is this a bug of Birt?
Re: bar chart with 2 y-axes [message #1291945 is a reply to message #849557] Fri, 11 April 2014 07:13 Go to previous message
Tony Hsiao is currently offline Tony Hsiao
Messages: 13
Registered: March 2013
Junior Member
I came across the same problem when trying to generate a similar bar chart with 2 y-axes in my eclipse plugin, and I want to know if the bug has been fixed, or if there are other ways to do that. Thank you!
Previous Topic:Table cell Word Wrap
Next Topic:How to programmatically instanciate a unique data source ?‏
Goto Forum:
  


Current Time: Wed Jul 30 09:24:59 EDT 2014

Powered by FUDForum. Page generated in 0.01989 seconds