shutterstock / rickshaw

JavaScript toolkit for creating interactive real-time graphs
https://shutterstock.github.io/rickshaw
MIT License
6.53k stars 941 forks source link

Workaround for inconsistent series data in unstacked area charts #277

Open andig opened 11 years ago

andig commented 11 years ago

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

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?

dchester commented 11 years ago

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.