Inspired by the SamplingXYLineRenderer in 1.0.13, I wanted to create an efficient renderer that is doing the rendering in form of shapes. That renderer should be useful for datasets with a large (> 100K) number of items.
Various approaches how these datasets could be renderer have been discussed in the forum.
One of these ideas is the basis for the present renderer: if several identical shapes are drawn at the same pixel, only one shape will be visible. The others do not need to be rendered.
Previous approaches have used the old way of rendering one item at a time and skipped shapes that would be rendered on top of another.
However, in order to get a chart that is as close to a normal XYShapeRenderer as possible, the shapes in the background, that correspond to an item with a low itemIndex, would need to be omitted!
In order to achieve that, the present renderer first goes through the items in reverse order. For each item, the position is calculated, and if that position is already occupied, the item is not rendered.
This requires that the old drawing item by item convention was bypassed, and that all items of an entire series are analyzed and rendered in a single pass, i. e. the series is rendered at the first opportunity, and subsequent calls to drawItem return immediately.
The name of the renderer might be misleading: it does not XYShapeRenderer and cannot handle XYZDatasets.
Log in to post a comment.