Hi all,<br />
<br />
I created a simple combination chart with 2 Y-axes displaying a BarSeries and a ScatterSeries (See below source code). The problem is that I can't get the origin of my second Y-axis to zero. The BarSeries creates three bars of heights 2, 4 and 8; and the ScatterSeries has also three items at the values 2, 4 and 8. So I would like to see the scatter points at the same height as the top of the bars, but -as you can see in the image on <a class='bbc_url' href='
http://picasaweb.google.com/jeroen.vangoey/BIRT#5309749319650274578'>Picasa Web Albums - BioGeek - BIRT</a> - they are not. The problem is that the origin of the second Y-axis starts at 1 instead of 0. According to the FAQ I should be able to solve that problem with the method getOrigin().setValue(NumberDataElementImpl.create(0)), but I've tried that on every possible axis but none works.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public class OriginProblem {
public final static Chart createScatterBarCombination() {
ChartWithAxes cwaScatterBar = ChartWithAxesImpl.create();
// Legend
cwaScatterBar.getLegend().setItemType(LegendItemType.SERIES_LITERAL);
cwaScatterBar.getLegend().setVisible(false);
// X-Axis
Axis xAxisPrimary = cwaScatterBar.getPrimaryBaseAxes()[0];
xAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL);
// Y-Axis
Axis yAxisPrimary = cwaScatterBar
.getPrimaryOrthogonalAxis(xAxisPrimary);
yAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL);
// Primary Y-Axis
yAxisPrimary = cwaScatterBar.getPrimaryOrthogonalAxis(xAxisPrimary);
yAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL);
yAxisPrimary.getOrigin().setValue(NumberDataElementImpl.create(0));
// Secondary Y-Axis
Axis yAxisSecondary = AxisImpl.create(Axis.ORTHOGONAL);
yAxisSecondary.setType(AxisType.LINEAR_LITERAL);
xAxisPrimary.getAssociatedAxes().add(yAxisPrimary);
xAxisPrimary.getAssociatedAxes().add(yAxisSecondary);
// Data Set
TextDataSet categoryValues = TextDataSetImpl.create(
new String[] {"One", "Two", "Three" });
NumberDataSet orthoValues1 = NumberDataSetImpl.create(
new double[] { 2, 4, 8 });
// X-Series
Series seCategory = SeriesImpl.create();
seCategory.setDataSet(categoryValues);
SeriesDefinition sdX = SeriesDefinitionImpl.create();
xAxisPrimary.getSeriesDefinitions().add(sdX);
sdX.getSeries().add(seCategory);
// Primary Y-Series
BarSeries bs = (BarSeries) BarSeriesImpl.create();
bs.setDataSet(orthoValues1);
SeriesDefinition sdY1 = SeriesDefinitionImpl.create();
sdY1.getSeriesPalette().shift(-2);
yAxisPrimary.getSeriesDefinitions().add(sdY1);
sdY1.getSeries().add(bs);
// Secondary Y-Series
ScatterSeries ss = (ScatterSeries) ScatterSeriesImpl.create();
ss.setDataSet(NumberDataSetImpl.create(
new double[] { 2, 4, 8 }));
ss.getMarker().setType(MarkerType.CIRCLE_LITERAL);
SeriesDefinition sdY2 = SeriesDefinitionImpl.create();
// sdY2.getSeriesPalette( ).shift( -3 );
sdY2.getSeriesPalette().update(ColorDefinitionImpl.BLUE());
yAxisSecondary.getSeriesDefinitions().add(sdY2);
sdY2.getSeries().add(ss);
return cwaScatterBar;
}
}
</pre>
<br />
<br />
<br />
Thanks in advance,<br />
Jeroen