Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-charting-dev] Structuring generated SVG output


I've been looking at the current code base of the Chart Engine and I have some concerns regarding the drawing order of the charts.  

As you know there's a notifyStuctureChanged on the RuntimeContext class that signals the SVG renderer to structure the generated output.  Adding "structure" in this case means grouping SVG drawing primitives.  For example, in SVG I can group a "line" and a "rectangle" as follows:

<g id="mygroup">
<line x1="0" y1="0" x2="10" y2="10"/>
<rect x="0" y="0" width="10" height="10"/>
</g>

The above generated output relies on the fact that the notificaiton happens before and after drawing the line and rectangle.  However, the charting engine makes use of a cache that is implemeted by DeferredCache.  From this class I can gather that it defers the drawing of markers, lines, labels and planes.  Since the drawing of these chart components are "deferred" the notification of the structural change will not correctly group these elements.  The resulting generated output is as follows:

<g id="mygroup">
</g>
<line x1="0" y1="0" x2="10" y2="10"/>
<rect x="0" y="0" width="10" height="10"/>

I realize the existence of the DeferredCache object provides some form of optimization.  However, I'm curious why this class only has "add" methods. Shouldn't there be getter methods on this class to reuse cached objects?  I would like to understand the usefulness of this class and figure out how to corretly notify the svg renderer when to group drawing primitives.

Thanks,

Sheldon.

Back to the top