Highcharts 顶部设置的yAxis的Highstock标志位置不正确

Highcharts 顶部设置的yAxis的Highstock标志位置不正确,highcharts,highstock,Highcharts,Highstock,看来highstock并没有像预期的那样发挥作用 我只是用yaxis创建了一个高股价图表,上面和高度都是固定的 然后我添加了一个新的y轴,其顶部和高度设置为将图表堆叠在第一个y轴的下方 现在,我在第二个y轴系列上设置了一些标志 在第一个y轴系列的某个地方显示了标志 添加按钮处理程序代码: $('#button').click(function() { var chart = $('#container').highcharts(); chart.addAxis({

看来highstock并没有像预期的那样发挥作用

我只是用yaxis创建了一个高股价图表,上面和高度都是固定的

然后我添加了一个新的y轴,其顶部和高度设置为将图表堆叠在第一个y轴的下方

现在,我在第二个y轴系列上设置了一些标志

在第一个y轴系列的某个地方显示了标志

添加按钮处理程序代码:

$('#button').click(function() {
    var chart = $('#container').highcharts();

    chart.addAxis({
        id:'secondY',            
        top:300,// making this 140 positions flags correctly
        height:150
    });

    chart.addSeries({
        id:'adbe',
        yAxis:'secondY',
        name: 'ADBE', 
        data: ADBE
    });
    $(this).attr('disabled', true);

    chart.addSeries(
    // the event marker flags
        {
            type : 'flags',
            data : [{
                x : Date.UTC(2011, 3, 25),
                title : 'H',
                text : 'Euro Contained by Channel Resistance'
            }, {
                x : Date.UTC(2011, 3, 28),
                title : 'G',
                text : 'EURUSD: Bulls Clear Path to 1.50 Figure'
            }],
            onSeries : 'adbe',
            shape : 'circlepin',
            width : 16
        });


});
答案是:和

您需要为您需要的任何yAxis分配一个id

$(function() {
$('#container').highcharts('StockChart', {
    chart: {
            zoomType: 'x',
            marginTop: 100, //avoid overlapping with navigator
            spacingLeft: 0
        },
    scrollbar: {
        enabled: false
    },

    navigator: {
        enabled: true,
        top: 40
    },

    rangeSelector: {
        selected: 1
    },
    yAxis:[{
        id: 'firstY',
        top:140,
        height:150
    }],
    series: [{
        id:'msft',
        name: 'MSFT',            
        data: MSFT,
        yAxis: 'firstY'
    }]
});

$('#button').click(function() {
    var chart = $('#container').highcharts();

    chart.addAxis({
        title:'duh',
        id:'secondY',            
        top:300,
        height:150
    });

    chart.addSeries({
        id:'adbe',
        yAxis:'secondY',
        name: 'ADBE', 
        data: ADBE
    });
    $(this).attr('disabled', true);

    chart.addSeries(
    // the event marker flags
        {
        yAxis:'firstY',
            type : 'flags',
            data : [{
                x : Date.UTC(2011, 3, 25),
                title : 'H',
                text : 'Euro Contained by Channel Resistance'
            }, {
                x : Date.UTC(2011, 3, 28),
                title : 'G',
                text : 'EURUSD: Bulls Clear Path to 1.50 Figure'
            }],
            onSeries : 'msft',
            shape : 'circlepin',
            width : 16
        });



});
}))

答案就在这里:和

您需要为您需要的任何yAxis分配一个id

$(function() {
$('#container').highcharts('StockChart', {
    chart: {
            zoomType: 'x',
            marginTop: 100, //avoid overlapping with navigator
            spacingLeft: 0
        },
    scrollbar: {
        enabled: false
    },

    navigator: {
        enabled: true,
        top: 40
    },

    rangeSelector: {
        selected: 1
    },
    yAxis:[{
        id: 'firstY',
        top:140,
        height:150
    }],
    series: [{
        id:'msft',
        name: 'MSFT',            
        data: MSFT,
        yAxis: 'firstY'
    }]
});

$('#button').click(function() {
    var chart = $('#container').highcharts();

    chart.addAxis({
        title:'duh',
        id:'secondY',            
        top:300,
        height:150
    });

    chart.addSeries({
        id:'adbe',
        yAxis:'secondY',
        name: 'ADBE', 
        data: ADBE
    });
    $(this).attr('disabled', true);

    chart.addSeries(
    // the event marker flags
        {
        yAxis:'firstY',
            type : 'flags',
            data : [{
                x : Date.UTC(2011, 3, 25),
                title : 'H',
                text : 'Euro Contained by Channel Resistance'
            }, {
                x : Date.UTC(2011, 3, 28),
                title : 'G',
                text : 'EURUSD: Bulls Clear Path to 1.50 Figure'
            }],
            onSeries : 'msft',
            shape : 'circlepin',
            width : 16
        });



});

}))

由作者在报道。有完全相同的问题!在添加新系列时,请使用yAxis:“secondY”,作者报告,地址为。具有完全相同的版本!添加新系列时,请使用yAxis:“secondY”