Anagio
Anagio

Reputation: 3075

highcharts reversed yAxis but keep fill area below spline?

The yAxis in my chart is reversed and has a fill area, this put the fill area above the spline. Is there a way to keep the fill area below the spline when the axis is reversed?

A working jsfiddle here

$(function () {
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'areaspline'
            },
            title: {
                text: 'Average fruit consumption during one week'
            },
            legend: {
                layout: 'vertical',
                align: 'left',
                verticalAlign: 'top',
                x: 150,
                y: 100,
                floating: true,
                borderWidth: 1,
                backgroundColor: '#FFFFFF'
            },
            xAxis: {
                categories: [
                    'Monday',
                    'Tuesday',
                    'Wednesday',
                    'Thursday',
                    'Friday',
                    'Saturday',
                    'Sunday'
                ]
            },
            yAxis: {
                title: {
                    text: 'Fruit units'
                },
                reversed:true,
            },
            tooltip: {
                formatter: function() {
                    return ''+
                    this.x +': '+ this.y +' units';
                }
            },
            credits: {
                enabled: false
            },
            plotOptions: {
                areaspline: {
                    fillOpacity: 0.5
                }
            },
            series: [{
                name: 'John',
                data: [3, 4, 3, 5, 4, 10, 12]
            }, {
                name: 'Jane',
                data: [1, 3, 4, 3, 3, 5, 4]
            }]
        });
    });

});

Upvotes: 1

Views: 1558

Answers (2)

CortoMaltese
CortoMaltese

Reputation: 141

What worked for me was setting the threshold explicitly to null:

{
    ... (other series properties)
    threshold: null,
    ...
}

Upvotes: 2

Ahmed ElGamil
Ahmed ElGamil

Reputation: 179

if you change the threshold to be like this jsfiddle

highcharts threshold ref here

 plotOptions: {
                areaspline: {
                    fillOpacity: 0.5,
                    threshold: 12
                }

Upvotes: 4

Related Questions