|
Re: Migration problem to BIRT 3.7 [message #730127 is a reply to message #730093] |
Tue, 27 September 2011 16:37 |
|
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 #730493 is a reply to message #730337] |
Wed, 28 September 2011 14:14 |
|
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 #733418 is a reply to message #732333] |
Tue, 04 October 2011 17:03 |
|
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.03675 seconds