|| | |||Browse by category|
In SWT, why my chart legend doesn't get repaint when I change my chart renderer's style?
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.