pie chart groupping [message #174987] |
Mon, 03 July 2006 22:52 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
imre farkas![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=farkas.imre%40chello.hu) 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 Go to previous message](theme/Solstice/images/up.png) |
David Michonneau![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=dmichonneau%40actuate.com) 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
|
|
|
Powered by
FUDForum. Page generated in 0.03345 seconds