Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
3D Bar Chart Y Axis Title Shows Up Twice
cgswtsu78
I'm using the Birt Chart Engine api to dynamically create a 3d bar chart and the Y Axis title is showing up twice (on right and left of the chart). Below is my code, any suggestions on how to suppress the one on the left? Thanks in advance.
public Chart createChart(BaseChart chartSpec, ResourceBundle bundle)
{
ChartWithAxes cwaBar = ChartWithAxesImpl.create( );
cwaBar.setDimension( ChartDimension.THREE_DIMENSIONAL_LITERAL );
cwaBar.setType( "Bar Chart" ); //$NON-NLS-1$
cwaBar.setSubType( "Side-by-side" ); //$NON-NLS-1$
// Plot
cwaBar.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
cwaBar.getBlock( ).getOutline( ).setVisible( true );
// Title
cwaBar.getTitle().getLabel().getCaption().setValue(chartSpec.getChartTitle() + chartSpec.getWhereClauseStmts().get("fromDate") + " - " + chartSpec.getWhereClauseStmts().get("toDate"));
// Legend
cwaBar.getLegend( ).setItemType( LegendItemType.CATEGORIES_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);
xAxisPrimary.getLabel().getCaption().getFont().setRotation(90);
if(chartSpec.getxAxisTitle() != null)
{
xAxisPrimary.getTitle().setVisible(true);
xAxisPrimary.getTitle().getCaption().setValue(chartSpec.getxAxisTitle());
}
// Y-Axis
Axis yAxisPrimary = cwaBar.getPrimaryOrthogonalAxis(xAxisPrimary);
yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
if(chartSpec.getyAxisTitle() != null)
{
yAxisPrimary.getTitle().setVisible(true);
yAxisPrimary.getTitle().getCaption().setValue(chartSpec.getyAxisTitle());
}
//yAxisPrimary.getLabel( ).getCaption( ).getFont( ).setRotation( 90 );
// Z-Axis
Axis zAxis = AxisImpl.create(Axis.ANCILLARY_BASE);
zAxis.setType(AxisType.TEXT_LITERAL);
zAxis.setLabelPosition(Position.BELOW_LITERAL);
zAxis.setTitlePosition(Position.BELOW_LITERAL);
zAxis.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
zAxis.setOrientation(Orientation.HORIZONTAL_LITERAL);
xAxisPrimary.getAncillaryAxes().add(zAxis);
// Data Set
TextDataSet categoryValues = TextDataSetImpl.create(chartSpec.getxAxis());
NumberDataSet orthoValues1 = NumberDataSetImpl.create(chartSpec.getyAxis());
// X-Series
Series seCategory = SeriesImpl.create();
seCategory.setDataSet(categoryValues);
SeriesDefinition sdX = SeriesDefinitionImpl.create();
sdX.getSeriesPalette().shift(0, 10);
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.OUTSIDE_LITERAL);
bs1.setTranslucent(false);
SeriesDefinition sdY = SeriesDefinitionImpl.create();
yAxisPrimary.getSeriesDefinitions().add(sdY);
sdY.getSeries().add(bs1);
// Z-Series
SeriesDefinition sdZ = SeriesDefinitionImpl.create();
zAxis.getSeriesDefinitions().add(sdZ);
// Rotate the chart
cwaBar.setRotation(Rotation3DImpl.create(new Angle3D[]{
Angle3DImpl.create(-10, 25, 0)} ) );
return cwaBar;
}
Find more posts tagged with
Comments
There are no comments yet