score:6

Accepted answer

the difficulty is the granularity: highcharts draws one single svg path for the series' points, and associates that one path with the gradient. if your series data is relatively linear however, the following approximation might be useful. see the jsfiddle that i've created:

assuming that your series data is not static, my demo includes two series and a function that, for each series, attempts to dynamically create the lineargradient that comes closest to your requirement:

function getlineargradient(series) {
    var lasty0=null, lasty1=null, maxy0=null, maxy1=null;
    $.each(series.data, function(key,value) {
        maxy0 = math.max(value[1],maxy0);
        maxy1 = math.max(value[2],maxy1);
        lasty0 = value[1];
        lasty1 = value[2];
    });
    var firsty0 = series.data[0][2],
        firsty1 = series.data[0][2]
    ;
    var miny0=maxy0, miny1=maxy1;
    $.each(series.data, function(key,value) {
        miny0 = math.min(value[1],miny0);
        miny1 = math.min(value[2],miny1);
    });
    var miny = miny0,
        maxy = maxy1,
        heighty = maxy - miny
    ;        
    var gradient = {
            x1: 10 + ( ((firsty0-miny) / heighty) * 80 ) + "%",
            y1: "10%",
            x2: 10 + ( ((lasty1-miny) / heighty) * 80 ) + "%",
            y2: "90%"
    };
    return gradient;
};

of course, this approach is not a full-blown solution and only useful if you're dealing with data that approximately follows a linear curve. here's the jsfiddle

score:2

i don't have any example, nor do i know for sure if it is already in the specifications, but i am pretty sure the only way to accomplish this effect would be using svg mash gradients.

you could use the path points as boundary points for the mash matrix and get the effect you want.

see here for further information.


Related Query

More Query from same tag