update method

  1. @override
void update(
  1. List<ImmutableSeries<D>> seriesList,
  2. bool isAnimating
)
inherited

Generates rendering data needed to paint the data on the chart.

This is called during the post layout phase of the chart draw cycle.

Implementation

@override
void update(List<ImmutableSeries<D>> seriesList, bool isAnimating) {
  // _visibleTreeMapRectKeys is used to remove any [_AnimatedTreeMapRect]s
  // that were rendered in the previous draw cycles, but no longer have a
  // corresponding datum in the new series data.
  final _visibleTreeMapRectKeys = <D>{};

  for (final series in seriesList) {
    if (series.data.isNotEmpty) {
      final root = series.data.first as TreeNode<Object>;
      // Configures the renderer element for root node.
      _configureRootRendererElement(root);

      // Applies tiling algorithm to each node.
      for (final datum in series.data) {
        final node = datum as TreeNode<Object>;
        tile(node);
        final element = _getRendererElement(node)..refreshPaintProperties();
        final rect = _createAnimatedTreeMapRect(element);
        _visibleTreeMapRectKeys.add(rect.key);
      }
    }
  }

  _animatedTreeMapRects.forEach((_, rect) {
    if (!_visibleTreeMapRectKeys.contains(rect.key)) {
      rect.animateOut();
    }
  });
}