ElementStacks

HTML

<script src="http://highcharts.com/js/testing.js"></script>
<div id="container" style="height: 400px"></div>

JavaScript

/** 
 * An attempt to extend the Highcharts library, with a "band" type graph.
 * Could be used to display confidence intervals or error bands.
 * 
 * Things I have come cross, that i would have changed in Highcharts.
 * * A method in the Series class which the Axis class can use to
 *   get series extremety values when it calculates ticks and scale.
 *   
 *   Now the Axis class iterates over the values itself, not giving the series class
 *   the chance to  override these values.
 *   In this band chart example, I would provide  minimum and maximum values
 *   from the confidence interval, and not the centerline.
 *
 * * Less hardcoding/detecting of series.type in variety of classes
 *   to handle differnces in rendering. Why not implement some sane default
 *   properties, and override these, or implement more methods and ask the classes.
 *
 *   In this example, I get really different results wether the type is 'line'
 *   or 'area', when what I want is somewhere in between.
 *   What I did in my own enviroment and not here, was to leave type = 'area' initially,
 *   so I get the right marker in legend,  and changed it to 'line' in translate
 *   method to get the correct scaling along the axis... It is a dirty hack.
 *
 */
var BandSeries = Highcharts.extendClass(Highcharts.Series, {
    /**
     * Can't use 'area', because then yAxis is forced to start from 0...
     * But then i can't control the shape of the symbol in legend...
     */
    //type: 'area',
    /**
     * Do not draw symbols
     */
    getSymbol: function() {},
    /**
     * Do not draw points
     */
    drawPoints: function() {},
    /**
     * Override the setData method
     * An example on how to call parent method when you only have to
     * override a little bit, and your code can be run before or after.
     */
    setData: function(data, redraw) {
        //Do stuff before setting data
        //Call "parent" method, but in this context
       ...