Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.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 Stockchart添加第二个xAxis_Javascript_Highcharts_Axis_Highstock - Fatal编程技术网

Javascript 如何向Highcharts Stockchart添加第二个xAxis

Javascript 如何向Highcharts Stockchart添加第二个xAxis,javascript,highcharts,axis,highstock,Javascript,Highcharts,Axis,Highstock,我有一个现有的高股价图表,其中有一个xAxis和一个yAxis。我的目标是添加第二个xAxis,只需按一个按钮就可以添加数据。 我的代码如下所示: showDrehzahl: function() { console.log('add axis function called'); var chart = $('#mycontainer').highcharts(); //Second xAxis chart.addAxis({ id: 'drehzahl', title

我有一个现有的高股价图表,其中有一个xAxis和一个yAxis。我的目标是添加第二个xAxis,只需按一个按钮就可以添加数据。 我的代码如下所示:

showDrehzahl: function() {

console.log('add axis function called');

var chart = $('#mycontainer').highcharts();

//Second xAxis
chart.addAxis({ 
    id: 'drehzahl',
    title: {
        text: 'Drehzahl'
    },
    lineWidth: 2,
    lineColor: '#000000',
    opposite: true
},true);

console.log('add series');

console.log(chart);

chart.addSeries({
    name: 'Drehzahl',
    type: 'spline',
    color: '#000000',
    xAxis: 'drehzahl',
    data: [49.9, 9, 10.4, 12.2, 14.0, 16.0, 13.6, 14.5, 6.4, 14.1, 9.6, 5.4]
});
}

添加序列数据时,找不到xAxis对象。我在id和数组长度“xAxis:1”的帮助下尝试了绑定。 甚至可以将addAxis方法应用于Highstock图表,还是仅应用于Highcharts

非常感谢您的帮助

它在3.0.10中工作,请参见:


非常感谢你,这就是问题所在。更新到3.0.10版后,它可以正常工作。
var chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'container'
    },
    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]
    }]
});

$("#b").click(function () {
    chart.addAxis({
        id: 'drehzahl',
        lineWidth: 2,
        lineColor: '#000000',
        opposite: true
    }, true);

    chart.addSeries({
        type: 'spline',
        color: '#000000',
        xAxis: 'drehzahl',
        data: [49.9, 9, 10.4, 12.2, 14.0, 16.0, 13.6, 14.5, 6.4, 14.1, 9.6, 5.4]
    });
});