Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HighCharts轴在导出时翻转_Javascript_Jquery_Charts_Highcharts - Fatal编程技术网

Javascript HighCharts轴在导出时翻转

Javascript HighCharts轴在导出时翻转,javascript,jquery,charts,highcharts,Javascript,Jquery,Charts,Highcharts,我的web应用程序中有一个Highchart。在浏览器中,它正常显示,如下所示: chart.addSeries({ type: 'bar', name: 'Rings per day ', data: barData, pointInterval: mainInterval }); chart.addSeries({ type: 'spline', name: 'Accumilative rings ', data: spline1Da

我的web应用程序中有一个Highchart。在浏览器中,它正常显示,如下所示:

chart.addSeries({
    type: 'bar',
    name: 'Rings per day ',
    data: barData,
    pointInterval: mainInterval
});
chart.addSeries({

    type: 'spline',
    name: 'Accumilative rings ',
    data: spline1Data,
    yAxis: 1,
});
chart.addSeries({
    type: 'spline',
    name: 'Planned Progress ',
    data: spline2Data,
    yAxis: 1,
    color: "#FF0000"
});

但是,当我导出图表时,它会翻转轴,并以下图结束:

以下是我在Highchart中使用的选项

var options = ({
        chart: {
            renderTo: 'chartDiv'
        },
        credits: {
            enabled: false
        },
        title: {
            text: ''
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            type: 'datetime',
            tickInterval:  7200 * 10000,
            allowDecimals:false,
            labels: {
                format: '{value}',                   
                rotation: 30,
                align: 'left',                  
            },

            title: {
                text: 'Date'
            }
        },
        yAxis: [{
            title: {
                text: 'No. of rings'
            },
            min: 0
        },

        { // Secondary yAxis
            gridLineWidth: 0,
            min: 0,
            title: {
                text: 'Accumulative Rings',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            labels: {
                format: '{value} Ring',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            opposite: true,
        }

        ],
        tooltip: {
            shared: true
        },
        legend: { backgroundColor: 'rgba(211,223,181,0.6)', layout: 'vertical', align: 'left', verticalAlign: 'top', floating: true, borderWidth: 0, x: 70 },
        plotOptions: {
            spline: {
                marker: {
                    enabled: false
                },

            }               
        }
    });
我的图表中有三个系列,条形图可以有0个值。 数据来自一个ajax服务,我将其放入一个数组中,然后添加到图表中,如下所示:

chart.addSeries({
    type: 'bar',
    name: 'Rings per day ',
    data: barData,
    pointInterval: mainInterval
});
chart.addSeries({

    type: 'spline',
    name: 'Accumilative rings ',
    data: spline1Data,
    yAxis: 1,
});
chart.addSeries({
    type: 'spline',
    name: 'Planned Progress ',
    data: spline2Data,
    yAxis: 1,
    color: "#FF0000"
});

我的图表怎么了?

bar
系列是关键部分<代码>条形图系列强制翻转要渲染的图表。在您的情况下,请使用
。它在您的浏览器上显示的方式不同,因为您很可能拥有Highcharts的旧版本。

提供实时演示会很好。您是如何尝试导出.chartOptions的?请记住,导出功能与图表本身不同。它可以有其他选项,有时在默认情况下,它已经有了其他选项。类似于条形图,其默认视图类似于您提供的第二幅图像。
bar
series是关键部分<代码>条形图系列强制翻转要渲染的图表。在您的情况下,请使用
。它在浏览器上的显示方式有所不同,因为很可能是因为您使用的是Highcharts的旧版本。谢谢@PawełFus这是解决方案,请添加回答:)