Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Migration problem to BIRT 3.7
Migration problem to BIRT 3.7 [message #730093] Tue, 27 September 2011 15:43 Go to next message
Philippe NEMBRARD is currently offline Philippe NEMBRARDFriend
Messages: 9
Registered: August 2010
Junior Member
Hello,

I use my own emitter based on org.eclipse.birt.report.engine.emitter.IContentEmitter to deal with report & chart in SWT world.

I have problem with charts since i move on to birt 3.7

Here is my code

@Override
    public void startImage(final IImageContent image)
    {
        try
        {
            super.startImage(image);
            ExtendedItemDesign eid = (ExtendedItemDesign) image.getGenerateBy();
            ExtendedItemHandle eih = (ExtendedItemHandle) eid.getHandle();
            Chart chart = (Chart) eih.getReportItem().getProperty(
                    "chart.instance");
 
           ... SWT action on Chart object
        }
        catch (Exception e)
        {
....
        }
    }


When i use a PDF or HTML emitter I don't have any problem.

index.php/fa/4071/0/

But with my SWT emitter I have problem that you can see in attachment file.
It seems that the dataset are corrupted.

I specify that it works perfectly with Birt 2.3.2.

Otherwise if I use a chart object created from scratch using org.eclipse.birt.chart.examples, instead of call getProperty("chart.instance") it also works with BIRT 3.7.

Any idea ?

Thanks for your reply.
  • Attachment: BIRTpng.PNG
    (Size: 89.08KB, Downloaded 527 times)
Re: Migration problem to BIRT 3.7 [message #730127 is a reply to message #730093] Tue, 27 September 2011 16:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Philippe,

This is most likely because the chart.instance does not store the data.
Are you trying to regenerate the chart?

Jason

On 9/27/2011 11:43 AM, Philippe NEMBRARD wrote:
> Hello,
>
> I use my own emitter based on org.eclipse.birt.report.engine.emitter.IContentEmitter to deal with report& chart in SWT world.
>
> I have problem with charts since i move on to birt 3.7
>
> Here is my code
>
>
> @Override
> public void startImage(final IImageContent image)
> {
> try
> {
> super.startImage(image);
> ExtendedItemDesign eid = (ExtendedItemDesign) image.getGenerateBy();
> ExtendedItemHandle eih = (ExtendedItemHandle) eid.getHandle();
> Chart chart = (Chart) eih.getReportItem().getProperty(
> "chart.instance");
>
> ... SWT action on Chart object
> }
> catch (Exception e)
> {
> ....
> }
> }
>
>
> When i use a PDF or HTML emitter I don't have any problem.
>
>
>
> But with my SWT emitter I have problem that you can see in attachment file.
> It seems that the dataset are corrupted.
>
> I specify that it works perfectly with Birt 2.3.2.
>
> Otherwise if I use a chart object created from scratch using org.eclipse.birt.chart.examples, instead of call getProperty("chart.instance") it also works with BIRT 3.7.
>
> Any idea ?
>
> Thanks for your reply.
>
Re: Migration problem to BIRT 3.7 [message #730337 is a reply to message #730127] Wed, 28 September 2011 07:53 Go to previous messageGo to next message
Philippe NEMBRARD is currently offline Philippe NEMBRARDFriend
Messages: 9
Registered: August 2010
Junior Member
Jason,

No I'm not trying to regenerate the chart, I want to retrieve my chart instance to use it.
This use is based on basic examples such as com.ibm.examples.chart.widget.ChartWithToolTipCanvas or org.eclipse.birt.chart.examples.api.viewer.SwtLiveChartViewer. In this both examples, the chart is created from scratch. In my case, I'm using a rptdesign file with a scripted data set. And it works perfectly when i deal with a pdf emitter.

I want to use the chart properties for displaying tooltips and create interactivity, and this cannot not be done with a simple Image. I really need the chart instance.

But it seems to have problems since i use 3.7.

sincerely yours

Philippe
Re: Migration problem to BIRT 3.7 [message #730493 is a reply to message #730337] Wed, 28 September 2011 14:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you share the source to debug it?

Jason

On 9/28/2011 3:53 AM, Philippe NEMBRARD wrote:
> Jason,
>
> No I'm not trying to regenerate the chart, I want to retrieve my chart
> instance to use it.
> This use is based on basic examples such as
> com.ibm.examples.chart.widget.ChartWithToolTipCanvas or
> org.eclipse.birt.chart.examples.api.viewer.SwtLiveChartViewer. In this
> both examples, the chart is created from scratch. In my case, I'm using
> a rptdesign file with a scripted data set. And it works perfectly when i
> deal with a pdf emitter.
>
> I want to use the chart properties for displaying tooltips and create
> interactivity, and this cannot not be done with a simple Image. I really
> need the chart instance.
>
> But it seems to have problems since i use 3.7.
>
> sincerely yours
>
> Philippe
Re: Migration problem to BIRT 3.7 [message #732333 is a reply to message #730493] Tue, 04 October 2011 14:23 Go to previous messageGo to next message
Philippe NEMBRARD is currently offline Philippe NEMBRARDFriend
Messages: 1
Registered: July 2009
Junior Member
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 Smile )

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.
Re: Migration problem to BIRT 3.7 [message #733418 is a reply to message #732333] Tue, 04 October 2011 17:03 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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.
>
Previous Topic:Announcing The Eclipse Fall 2011 Training Series
Next Topic:View reports in xls
Goto Forum:
  


Current Time: Fri Mar 29 12:47:30 GMT 2024

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

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

Back to the top