|
|
|
|
|
Re: Migration problem to BIRT 3.7 [message #733418 is a reply to message #732333] |
Tue, 04 October 2011 13:03  |
Eclipse User |
|
|
|
The reason this is failing is that the chart instance does not store
data. So when your chart builds it does not find any data, because you
replaced the original chart with the one from the report. To get around
this just re-bind the data after you read it from the report. In your
example I got it to work by modifying the SampleEditor class. Right above:
canvas.setChart(chart);
canvas.setSize(800, 600);
I added:
DataSet dataSet = new DataSet();
NumberDataSet orthoValuesDataSet1 =
NumberDataSetImpl.create(dataSet
.getTechnitians());
NumberDataSet orthoValuesDataSet2 =
NumberDataSetImpl.create(dataSet
.getSalers());
TextDataSet categoryValues = TextDataSetImpl
.create(dataSet.getCities());
// X-Axis
Axis xAxisPrimary = ((ChartWithAxes) chart).getPrimaryBaseAxes( )[0];
SeriesDefinition sdX = (SeriesDefinition)
xAxisPrimary.getSeriesDefinitions( )
.get( 0 );
( (Series) sdX.getSeries( ).get( 0 ) ).setDataSet( categoryValues );
// Y-Axis
Axis yAxisPrimary = ((ChartWithAxes) chart).getPrimaryOrthogonalAxis(
xAxisPrimary );
SeriesDefinition sdY1 = (SeriesDefinition)
yAxisPrimary.getSeriesDefinitions( )
.get( 0 );
SeriesDefinition sdY2 = (SeriesDefinition)
yAxisPrimary.getSeriesDefinitions( )
.get( 1 );
( (Series) sdY1.getSeries( ).get( 0 ) ).setDataSet( orthoValuesDataSet2 );
( (Series) sdY2.getSeries( ).get( 0 ) ).setDataSet( orthoValuesDataSet1 );
I am attaching that class file.
Jason
On 10/4/2011 10:23 AM, Philippe NEMBRARD wrote:
> Jason,
>
> here is a sample example based on a plugin example inspired by com.ibm.examples.chart.
>
> You'll have to save the test.rptdesign in the zip on your C: drive (or change the code :) )
>
> once you launch the application, just go in the "With rptdesign" menu and ask for "Bart chart with Tool Tip".
>
> On the left side you'll have a chart retrieve with the getProperty("chart.instance") and displayed with in a SWT format. It does not work
>
> On the right side, the same chart displayed with the HMTL format. It works !
>
> Thanks for you reply.
>
|
|
|
Powered by
FUDForum. Page generated in 0.08055 seconds