Wednesday, September 08, 2010

Beyond BIRT Basics - Roadshow

The advanced BIRT Roadshows will begin next week in Boston, New York and DC.
These events feature a free day of training on advanced BIRT topics, like understanding the event model, chart and report item scripting, implementing high performance reports, and making BIRT mobile.

The schedule for the month of September is listed below.

Upcoming Accelerated BIRT Roadshows
Boston – Tuesday, September 14
New York – Wednesday, September 15
DC – Thursday, September 16
Bay Area – Tuesday, September 28

If you are interested, sign up quickly, as space is limited.

11 comments:

Anonymous said...

Hallo,

Congratulations for the blog.

I have developed an application in Java, where i create reports from database, using DesignHandlers -mainly grids, with colors and labels and data on top of them. I render the report in pdf. The result is very good and very efficient.

Now i want to go to the next step, where i want to deploy some charts (e.g. Area Chart) given the data that i have in arrays/vectors. But i have difficulty and i have not found any simple example on that, how to create a chart handler, and add it to my design.

Do you have any examples or any suggestions?

Thank you

Jason Weathersby said...

Take a look at this example:
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1260-de-api-open-a-report-and-add-a-chart/

Also a lot of API information and examples are available here:


http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1187-eclipsecon-2010-birt-metal-ppt/

Anonymous said...

Hallo Jason,

Thank you very much for the reply.

I used as basis the StandAloneChartOSGi.java and the function createStackedBar with my data and is very useful to work further on it.

However, can i convert this example to an AreaChart - an area chart is requested - ? Is there any similar example to use area chart?

Also, how could i change the colors of the bars? i did not find any property.

Thank you again for the reply, your help and the blog.

Jason Weathersby said...

If you open the BIRT designer and then click:
window->show view->other then select Chart Examples under the Report and Chart Design. This will present a list of charts (area included). Select the one you like and click the open java source icon in the top right corner of the view. This will open the jave code that is used to create that particular chart model. You should be able to copy this into the previous example and make an area chart.

Jason Weathersby said...

Use the series definition to get the palette and alter the colors:

// Y-Series
BarSeries bs = (BarSeries) BarSeriesImpl.create( );
bs.setSeriesIdentifier( "Actuate" ); //$NON-NLS-1$
bs.getLabel( ).getCaption( ).setColor( ColorDefinitionImpl.RED( ) );
bs.getLabel( ).setBackground( ColorDefinitionImpl.CYAN( ) );
bs.getLabel( ).setVisible( true );
bs.setDataSet( dsNumericValues1 );
bs.setStacked( true );

SeriesDefinition sdY = SeriesDefinitionImpl.create( );
yAxisPrimary.getSeriesDefinitions( ).add( sdY );
sdY.getSeriesPalette( ).update( ColorDefinitionImpl.BLUE( ) );
sdY.getSeries( ).add( bs );

Anonymous said...

Hi Jason,

Thanks again for your answer!

However,i still have issue with the colors. For example in the bar chart, i just want to replace the colors cyan and red with green and blue respectively.

With this : bs.getLabel( ).getCaption( ).setColor( ColorDefinitionImpl.RED( ) );

bs.getLabel( ).setBackground( ColorDefinitionImpl.CYAN( ) );

I just change the color of the number, and not of the appropriate area of the bar that remains red or cyan

If i set: sdY.getSeriesPalette( ).update( ColorDefinitionImpl.GREEN( ) );

then i set everything in green.

Shall i do sth different?

Thank you!

Anonymous said...

It's done!
Thanks

Anonymous said...

wrong! unfortunately the issue was not solved

If i do this: sdY.getSeriesPalette( ).update( ColorDefinitionImpl.ORANGE());

i got orange and yellow colors

but if i replace orange with green
i got again everything green

i am confused, i hope you can give me an idea
thanks

Jason Weathersby said...

Clear the palette and add your own colors. like:

final Fill[] fiaBase = {
ColorDefinitionImpl.ORANGE( ),
GradientImpl.create( ColorDefinitionImpl.create( 225, 225, 255 ),
ColorDefinitionImpl.create( 255, 255, 225 ),
-35,
false ),
ColorDefinitionImpl.CREAM( ),
ColorDefinitionImpl.RED( ),
ColorDefinitionImpl.GREEN( ),
ColorDefinitionImpl.BLUE( ).brighter( ),
ColorDefinitionImpl.CYAN( ).darker( ),
};
sd.getSeriesPalette( ).getEntries( ).clear( );
for ( int i = 0; i < fiaBase.length; i++ )
{
sd.getSeriesPalette( ).getEntries( ).add( fiaBase[i] );
}

Anonymous said...

Just one other thought, we often like to tie our chart palette to styles that are set in CSS. By associating the chart palette to a style defined in a CSS it becomes easier to adjust all of your palettes, without changing the Java code.

For an example, have a look at the birt-function-lib on Eclipse Labs.
<a url="http://code.google.com/a/eclipselabs.org/p/birt-functions-lib/wiki/SetChartPalette>BirtFunctions.setChartPalette</a>

Web Designers said...

thank you man! you made it quite easier to understand.

- Tanya
Web Designers