rickshaw icon indicating copy to clipboard operation
rickshaw copied to clipboard

Workaround for inconsistent series data in unstacked area charts

Open andig opened this issue 12 years ago • 1 comments

After implementation of issue #121 it is still not easily possible to create such chart:

  • on initialization, validateSeries and stackData are being called before graph.renderer.unstack = true can be set
  • this leads to the infamousstacked series cannot have differing numbers of points: 2 vs 6; see Rickshaw.Series.fill() exception

Workaround I've found is to subclass the area chart renderer and use that:

Rickshaw.namespace('Rickshaw.Graph.Renderer.UnstackedArea');
Rickshaw.Graph.Renderer.UnstackedArea = Rickshaw.Class.create(Rickshaw.Graph.Renderer.Area, {
    name: 'unstackedarea',
    defaults: function($super) {
        return Rickshaw.extend($super(), {
            unstack: true,
            fill: false,
            stroke: false
        });
    }
} );

This works as unstack is already true when Rickshaw.Graph gets created.

Is there a more elegant solution?

andig avatar Jul 12 '13 11:07 andig

At the moment, this is a good workaround. We've run into this from time to time too. We'll look into moving that validation to happen around the stacking rather than from within the graph constructor.

dchester avatar Aug 06 '13 20:08 dchester