Community
Participate
Working Groups
During a live presentation of BIRT at EclipseCon, we came across a rather embarassing issue. When charts are included in a library, and imported into a report design from a library, any changes to the library instance of the chart do not reflect in the report itself.
Steps to create: Create a new library Create a chart in that library (I used a scripted data source/set, just returning values 1-5) Create new report Import chart into report Go into library, change the label of the chart Chart title in report will not update. I noticed in the XML file that even though the extend clause is included in the XML source, it also keeps a seperate copy of its own properties. See below XML code: <extended-item extensionName="Chart" name="NewChart" extends="new_library.NewChart" id="10"> <xml-property name="xmlRepresentation"><![CDATA[<model:ChartWithoutAxes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:attribute="http://www.birt.eclipse.org/ChartModelAttribute" xmlns:layout="http://www.birt.eclipse.org/ChartModelLayout" xmlns:model="http://www.birt.eclipse.org/ChartModel" xmlns:type="http://www.birt.eclipse.org/ChartModelType"> <Type>Pie Chart</Type> <SubType>Standard Pie Chart</SubType> <Block> <Children xsi:type="layout:TitleBlock"> <Bounds> <Left>0.0</Left> <Top>0.0</Top> <Width>0.0</Width> <Height>0.0</Height> </Bounds> <Insets> <Top>3.0</Top> <Left>3.0</Left> <Bottom>3.0</Bottom> <Right>3.0</Right> </Insets> <Row>-1</Row> <Column>-1</Column> <Rowspan>-1</Rowspan> <Columnspan>-1</Columnspan> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Visible>true</Visible> <Label> <Caption> <Value>New Report Title</Value> <Font> <Size>16.0</Size> <Bold>true</Bold> <Alignment> <horizontalAlignment>Center</horizontalAlignment> <verticalAlignment>Center</verticalAlignment> </Alignment> </Font> </Caption> <Background xsi:type="attribute:ColorDefinition"> <Transparency>0</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> </Outline> <Insets> <Top>0.0</Top> <Left>2.0</Left> <Bottom>0.0</Bottom> <Right>3.0</Right> </Insets> <Visible>true</Visible> </Label> </Children> <Children xsi:type="layout:Plot"> <Bounds> <Left>0.0</Left> <Top>0.0</Top> <Width>0.0</Width> <Height>0.0</Height> </Bounds> <Insets> <Top>3.0</Top> <Left>3.0</Left> <Bottom>3.0</Bottom> <Right>3.0</Right> </Insets> <Row>-1</Row> <Column>-1</Column> <Rowspan>-1</Rowspan> <Columnspan>-1</Columnspan> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Visible>true</Visible> <HorizontalSpacing>5</HorizontalSpacing> <VerticalSpacing>5</VerticalSpacing> <ClientArea> <Outline> <Style>Solid</Style> <Thickness>0</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Insets> <Top>0.0</Top> <Left>0.0</Left> <Bottom>0.0</Bottom> <Right>0.0</Right> </Insets> </ClientArea> </Children> <Children xsi:type="layout:Legend"> <Bounds> <Left>0.0</Left> <Top>0.0</Top> <Width>0.0</Width> <Height>0.0</Height> </Bounds> <Insets> <Top>3.0</Top> <Left>3.0</Left> <Bottom>3.0</Bottom> <Right>3.0</Right> </Insets> <Row>-1</Row> <Column>-1</Column> <Rowspan>-1</Rowspan> <Columnspan>-1</Columnspan> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Visible>true</Visible> <ClientArea> <Outline> <Style>Solid</Style> <Thickness>0</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Insets> <Top>2.0</Top> <Left>2.0</Left> <Bottom>2.0</Bottom> <Right>2.0</Right> </Insets> </ClientArea> <Text> <Value></Value> <Font> <Alignment/> </Font> </Text> <Orientation>Vertical</Orientation> <Direction>Top_Bottom</Direction> <Separator> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>true</Visible> </Separator> <Position>Right</Position> <ItemType>Categories</ItemType> <Title> <Caption> <Value></Value> <Font> <Alignment/> </Font> </Caption> <Background xsi:type="attribute:ColorDefinition"> <Transparency>0</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Insets> <Top>0.0</Top> <Left>2.0</Left> <Bottom>0.0</Bottom> <Right>3.0</Right> </Insets> <Visible>false</Visible> </Title> <TitlePosition>Above</TitlePosition> </Children> <Bounds> <Left>0.0</Left> <Top>0.0</Top> <Width>479.25</Width> <Height>311.25</Height> </Bounds> <Insets> <Top>3.0</Top> <Left>3.0</Left> <Bottom>3.0</Bottom> <Right>3.0</Right> </Insets> <Row>-1</Row> <Column>-1</Column> <Rowspan>-1</Rowspan> <Columnspan>-1</Columnspan> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Background xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Visible>true</Visible> </Block> <Dimension>Two_Dimensional</Dimension> <Units>Points</Units> <SeriesThickness>10.0</SeriesThickness> <GridColumnCount>1</GridColumnCount> <SampleData> <BaseSampleData> <DataSetRepresentation>'A','B','C'</DataSetRepresentation> </BaseSampleData> <OrthogonalSampleData> <DataSetRepresentation>5.0,4.0,12.0</DataSetRepresentation> <SeriesDefinitionIndex>0</SeriesDefinitionIndex> </OrthogonalSampleData> </SampleData> <Interactivity> <Enable>true</Enable> <LegendBehavior>None</LegendBehavior> </Interactivity> <SeriesDefinitions> <Query> <Definition></Definition> </Query> <SeriesPalette> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>80</Red> <Green>166</Green> <Blue>218</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>242</Red> <Green>88</Green> <Blue>106</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>232</Red> <Green>172</Green> <Blue>57</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>255</Green> <Blue>128</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>64</Red> <Green>128</Green> <Blue>128</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>128</Green> <Blue>192</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>170</Red> <Green>85</Green> <Blue>85</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>128</Green> <Blue>0</Blue> </Entries> </SeriesPalette> <SeriesDefinitions> <Query> <Definition></Definition> </Query> <SeriesPalette> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>80</Red> <Green>166</Green> <Blue>218</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>242</Red> <Green>88</Green> <Blue>106</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>232</Red> <Green>172</Green> <Blue>57</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>255</Green> <Blue>128</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>64</Red> <Green>128</Green> <Blue>128</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>128</Green> <Blue>192</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>170</Red> <Green>85</Green> <Blue>85</Blue> </Entries> <Entries xsi:type="attribute:ColorDefinition"> <Transparency>255</Transparency> <Red>128</Red> <Green>128</Green> <Blue>0</Blue> </Entries> </SeriesPalette> <Series xsi:type="type:PieSeries"> <Visible>true</Visible> <Label> <Caption> <Value></Value> <Font> <Alignment/> </Font> </Caption> <Background xsi:type="attribute:ColorDefinition"> <Transparency>0</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Insets> <Top>0.0</Top> <Left>2.0</Left> <Bottom>0.0</Bottom> <Right>3.0</Right> </Insets> <Visible>true</Visible> </Label> <DataDefinition> <Definition>row["value"]</Definition> </DataDefinition> <SeriesIdentifier></SeriesIdentifier> <DataPoint> <Components> <Type>Orthogonal_Value</Type> </Components> <Separator>, </Separator> </DataPoint> <LabelPosition>Outside</LabelPosition> <Stacked>false</Stacked> <Explosion>10</Explosion> <Title> <Caption> <Value></Value> <Font> <Size>16.0</Size> <Bold>true</Bold> <Alignment/> </Font> </Caption> <Background xsi:type="attribute:ColorDefinition"> <Transparency>0</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> </Outline> <Insets> <Top>0.0</Top> <Left>2.0</Left> <Bottom>0.0</Bottom> <Right>3.0</Right> </Insets> <Visible>true</Visible> </Title> <TitlePosition>Below</TitlePosition> <LeaderLineAttributes> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>true</Visible> </LeaderLineAttributes> <LeaderLineStyle>Stretch_To_Side</LeaderLineStyle> <LeaderLineLength>40.0</LeaderLineLength> </Series> <Grouping> <Enabled>false</Enabled> <GroupingInterval>2</GroupingInterval> <GroupType>Text</GroupType> <AggregateExpression>Sum</AggregateExpression> </Grouping> <Sorting>Ascending</Sorting> </SeriesDefinitions> <Series> <Visible>true</Visible> <Label> <Caption> <Value></Value> <Font> <Alignment/> </Font> </Caption> <Background xsi:type="attribute:ColorDefinition"> <Transparency>0</Transparency> <Red>255</Red> <Green>255</Green> <Blue>255</Blue> </Background> <Outline> <Style>Solid</Style> <Thickness>1</Thickness> <Color> <Transparency>255</Transparency> <Red>0</Red> <Green>0</Green> <Blue>0</Blue> </Color> <Visible>false</Visible> </Outline> <Insets> <Top>0.0</Top> <Left>2.0</Left> <Bottom>0.0</Bottom> <Right>3.0</Right> </Insets> <Visible>false</Visible> </Label> <DataDefinition> <Definition>row["name"]</Definition> </DataDefinition> <SeriesIdentifier></SeriesIdentifier> <DataPoint> <Components> <Type>Orthogonal_Value</Type> </Components> <Separator>, </Separator> </DataPoint> <LabelPosition>Outside</LabelPosition> <Stacked>false</Stacked> </Series> <Grouping> <Enabled>false</Enabled> <GroupingInterval>2</GroupingInterval> <GroupType>Text</GroupType> <AggregateExpression>Sum</AggregateExpression> </Grouping> </SeriesDefinitions> </model:ChartWithoutAxes> ]]></xml-property> </extended-item>
Reassigning to model team to fix the notification mechanism.
This problem is caused by the current mechanism of loading chart. Chart is an extension of Model, and it has its own data model which is transparent to BIRT model. For birt model, the chart report item is a block of properties in the form of a xml property. When loading a chart, model will call chart's api to serialize the xml properties set(chart reportitem) from parent chart to the local chart so that user could do some local changes on local chart. After serializing, the local chart has a copy of parent report item model on itself, which means the local chart comes to be independent from parent chart. Hence, even the parent chart is changed, local chart will not re-serialize the chart report item once again. Does anybody get some idea to solve this problem?
Charts can't to know whether chart are modified by users. 1. All properties of charts are not only in chart model, but also in extended-item partly. For inner Chart, there are no listeners when properties, such as border and dimensions, are changed in property editor. 2. Chart model can be modified in source page. On the contrast, model can get to know if chart are modified by means of XML comparison.
My suggestion is: 1. Chart team provide a flag telling us if chart properties are modified locally. Here chart properties are only the properties in the xml-presentation. Model team will take care the rest properties setting on Model side. 2. If user drag a chart from library to report, and never modifies any property locally, then the flag, we can call it hasLocalProperty, returns false. When report refreshes libraries, local chart will re-serialize the xml-presentation from parent chart to keep synchronization. 3. If user has modified some property locally, the flag returns true, then the chart cames to be independent from its parent. They are not synchronized any longer. And yes Model could compare the xml-presentation property of chart, but I do not think it is reliable to judge a chart model is changed or not by comparing the xml string.
I don't agree that a flag is the right solution. We need to have a mechanism that works for any extended report item. I think this should be handled at the command notification level. For every command executed on the extended item, there is a notification in the report model. Any change in the chart internal model will trigger a command. The UI should listen to this notification and update the chart copy How does it work for other report items?
David, I think the notification/listener mechanism works fine for ROM embedded report item, but not for chart. Actually, now we do adopt notification/listener mechanism. If a library is modified by user, Designer will trigger an event to inform all the reports that has included the changed library. Then report design will reload the changed library. During reloading, report items will updates all the porperty value. When we updating property values, Model has an internal property search strategy, that is, local property value takes a higher priority than parent. But for chart, once initialized, there is always a property "xml-presentation" on local chart. (Chart need localize this property for some display reason) Hence, the "xml-presentation" will not be reloaded no matter whether this property is same as its parents. Model thinks the extended report item has local value of "xml-presentation" and it should take higher priority. That's reason why chart can not keep synchronization with its parents.
To clarify, because Chart has complicated internal elements and its own properties, if user change those Chart properties, it is not possible for Model to just save those changed properties in design file separately. Model does not know any of the Chart internal property and should not know that. So that why the reason once user edit Chart, we will localized all the xml-presentation property value as a whole string in design file. Then, next time when Chart changed in Library, because there is already local value, we will not search the value from parents. Since this is an open issue and can not be resolved easily, set to p5.
(In reply to comment #8) > To clarify, because Chart has complicated internal elements and its own > properties, if user change those Chart properties, it is not possible for Model > to just save those changed properties in design file separately. Model does not > know any of the Chart internal property and should not know that. So that why > the reason once user edit Chart, we will localized all the xml-presentation > property value as a whole string in design file. Then, next time when Chart > changed in Library, because there is already local value, we will not search > the value from parents. > Since this is an open issue and can not be resolved easily, set to p5. If user does not change any properties of a chart, do we have this issue? If user sets the data binding of a chart, does it mean that the properties of the chart is changed and hence will be localized. The inheritance to librarythen will be cut off?
The real reason caused for this is Chart ReportItem can not be inherited. So, when Model create the child extended item form library in report, we have to initialize the Chart report item on extendeditem, otherwise UI can not draw the Chart. If an empty Chart Report item can extend from the parent extended from library, then we don't need to localize all the xml property value. So, the solution so far is we just compare the string value of the xml presentation property, if it is same, then don't save it in design file.
+1 for this solution in 2.2. Do we want to consider using ROM as the model for chart at all? The advantage of using ROM over EMF to represent chart is library/property inheritance support in chart. Any downside of using ROM over EMF? If we do want to make this change, suggest move ROM component from birt.report.model name space to birt.model space so that it can be reused by chart. please keep this bug open and schedule it to future after completing changes in comment #10.
Fixed.