highcharts扭转了yAxis但保持填充区域低于样条曲线?

时间:2013-03-17 09:50:43

标签: highcharts

我的图表中的yAxis是反转的并且有一个填充区域,这会将填充区域放在样条曲线上方。当轴反转时,有没有办法将填充区域保持在样条曲线下方?

工作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]
            }]
        });
    });

});

2 个答案:

答案 0 :(得分:4)

如果您将阈值更改为此jsfiddle

highcharts threshold ref here

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

答案 1 :(得分:1)

对我有用的是将阈值明确设置为null:

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