Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » pie chart groupping
pie chart groupping [message #174987] Mon, 03 July 2006 22:52 Go to next message
imre farkas is currently offline imre farkasFriend
Messages: 26
Registered: July 2009
Junior Member
hi,

I use this code for group, but is not work

public Chart createChart() {
ChartWithoutAxes cwoaPie = ChartWithoutAxesImpl.create( );

// Plot
cwoaPie.setSeriesThickness( 25 );
cwoaPie.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
Plot p = cwoaPie.getPlot( );
p.getClientArea( ).setBackground( null );
p.getClientArea( ).getOutline( ).setVisible( true );
p.getOutline( ).setVisible( true );

// Legend
Legend lg = cwoaPie.getLegend( );
lg.getText( ).getFont( ).setSize( 16 );
lg.setBackground( null );
lg.getOutline( ).setVisible( true );

// Title
cwoaPie.getTitle( ).getLabel( ).getCaption( ).setValue( "Pie Chart"
);//$NON-NLS-1$
cwoaPie.getTitle( ).getOutline( ).setVisible( true );

// Data Set
TextDataSet categoryValues2 = TextDataSetImpl.create( new String[]{
"New York", "Boston", "Chicago", "San Francisco", "Dallas",
"Dallas"} );//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
//$NON-NLS-5$

NumberDataSet seriesOneValues2 = NumberDataSetImpl.create( new double[]{
54.65, 21, 75.95, 91.28, 37.43, 65
} );

// Base Series
Series seCategory = (Series) SeriesImpl.create( );
seCategory.setDataSet( categoryValues2 );

SeriesDefinition sd = SeriesDefinitionImpl.create( );
cwoaPie.getSeriesDefinitions( ).add( sd );
sd.getSeriesPalette( ).update( 0 );
sd.getSeries( ).add( seCategory );

//groupping
sd.setSorting(SortOption.ASCENDING_LITERAL);
sd.getGrouping().setEnabled(true);
sd.getGrouping().setAggregateExpression("Sum");//$NON-NLS-1$
sd.getGrouping().setGroupType(DataType.NUMERIC_LITERAL);
sd.getGrouping().setGroupingInterval(0);

// Orthogonal Series
PieSeries sePie = (PieSeries) PieSeriesImpl.create( );
sePie.setDataSet( seriesOneValues2 );
sePie.setSeriesIdentifier( "Cities" );//$NON-NLS-1$

SeriesDefinition sdCity = SeriesDefinitionImpl.create( );
sdCity.getQuery( ).setDefinition( "Census.City" );//$NON-NLS-1$

sd.getSeriesDefinitions( ).add( sdCity );
sdCity.getSeries( ).add( sePie );

return cwoaPie;
}

thx in advance
-farkas
Re: pie chart groupping [message #175359 is a reply to message #174987] Wed, 05 July 2006 16:29 Go to previous message
David Michonneau is currently offline David MichonneauFriend
Messages: 1145
Registered: July 2009
Senior Member
Try sd.getGrouping().setGroupType(DataType.TEXT_LITERAL);

Thanks,

David

"farkas" <farkas.imre@chello.hu> wrote in message
news:e8c729$7tq$1@utils.eclipse.org...
> hi,
>
> I use this code for group, but is not work
>
> public Chart createChart() {
> ChartWithoutAxes cwoaPie = ChartWithoutAxesImpl.create( );
>
> // Plot
> cwoaPie.setSeriesThickness( 25 );
> cwoaPie.getBlock( ).setBackground( ColorDefinitionImpl.WHITE( ) );
> Plot p = cwoaPie.getPlot( );
> p.getClientArea( ).setBackground( null );
> p.getClientArea( ).getOutline( ).setVisible( true );
> p.getOutline( ).setVisible( true );
>
> // Legend
> Legend lg = cwoaPie.getLegend( );
> lg.getText( ).getFont( ).setSize( 16 );
> lg.setBackground( null );
> lg.getOutline( ).setVisible( true );
>
> // Title
> cwoaPie.getTitle( ).getLabel( ).getCaption( ).setValue( "Pie
> Chart" );//$NON-NLS-1$
> cwoaPie.getTitle( ).getOutline( ).setVisible( true );
>
> // Data Set
> TextDataSet categoryValues2 = TextDataSetImpl.create( new String[]{
> "New York", "Boston", "Chicago", "San Francisco", "Dallas",
> "Dallas"} );//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
> //$NON-NLS-5$
>
> NumberDataSet seriesOneValues2 = NumberDataSetImpl.create( new double[]{
> 54.65, 21, 75.95, 91.28, 37.43, 65
> } );
>
> // Base Series
> Series seCategory = (Series) SeriesImpl.create( );
> seCategory.setDataSet( categoryValues2 );
>
> SeriesDefinition sd = SeriesDefinitionImpl.create( );
> cwoaPie.getSeriesDefinitions( ).add( sd );
> sd.getSeriesPalette( ).update( 0 );
> sd.getSeries( ).add( seCategory );
>
> //groupping
> sd.setSorting(SortOption.ASCENDING_LITERAL);
> sd.getGrouping().setEnabled(true);
> sd.getGrouping().setAggregateExpression("Sum");//$NON-NLS-1$
> sd.getGrouping().setGroupType(DataType.NUMERIC_LITERAL);
> sd.getGrouping().setGroupingInterval(0);
>
> // Orthogonal Series
> PieSeries sePie = (PieSeries) PieSeriesImpl.create( );
> sePie.setDataSet( seriesOneValues2 );
> sePie.setSeriesIdentifier( "Cities" );//$NON-NLS-1$
>
> SeriesDefinition sdCity = SeriesDefinitionImpl.create( );
> sdCity.getQuery( ).setDefinition( "Census.City" );//$NON-NLS-1$
>
> sd.getSeriesDefinitions( ).add( sdCity ); sdCity.getSeries( ).add(
> sePie );
>
> return cwoaPie;
> }
>
> thx in advance
> -farkas
Previous Topic:Page Break for Report Item in List Detail
Next Topic:2.1 Page break in nested list or table
Goto Forum:
  


Current Time: Sat Aug 17 13:12:05 GMT 2024

Powered by FUDForum. Page generated in 0.03345 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top