2013-11-04 57 views
1

這裏似乎預期Highstock標誌位置正確的Y軸與頂級設定

http://jsfiddle.net/gCuLJ/1/

我只是創建了具有固定的頂部和高度y軸一highstock圖表highstock不工作。

然後我添加了一個新的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 
     }); 


}); 
+0

作者在[github](https://github.com/highslide-software/highcharts.com/issues/2425)報告。 –

+0

有完全相同的問題! – Nick

+0

添加新系列時使用yAxis:'secondY' – Maruf

回答

1

答案就在這裏:http://jsfiddle.net/nmccready/wXZ4H/1/https://github.com/highslide-software/highcharts.com/issues/2425

您需要爲您需要的任何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 
     }); 



}); 

});