The chart legend doesn't get repaint when changing chart renderer's style in SWT

Article ID: 2361
Last updated: 29 May, 2018
Article ID: 2361
Last updated: 29 May, 2018
Revision: 3
Views: 759
Posted: 11 Oct, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

In SWT, why my chart legend doesn't get repaint when I change my chart renderer's style?

Answer

Each time the IlvChartRenderer's style changed, the legend will remove all the existing legend items and

recreate the items to reflect the new changes.

In the Swing application, the main container that stores the chart and the legend is re-validated. This causes the validation to be propagated to the container's children tree (the chart's legend is a leaf of this tree). As a result, the chart's legend is being repainted correctly.

In SWT environment, new legend items are also created when IlvChartRenderer's style is changed.

Unfortunately, the main container is not re-validated, and, as there is not propagation of the main container's validation, the legend item is not being updated. Consequently, the IlvLegend.paintChildren will skip the legend item's repaint.

To workaround this, you need to explicitly force the validation of the chart's legend each time you change the IlvChartRenderer's style by calling the validate() method of the component's top-level ancestor.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2361
Last updated: 29 May, 2018
Revision: 3
Views: 759
Posted: 11 Oct, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category