highcharts - Highstock: An issue on mobile devices, a chart with dual Y-axis's after a drag will move the bottom Y-axis to the top of the chart -
chart: http://jsfiddle.net/ku9uy/
issue: on mobile devices if drag chart left or right bottom y-axis moves top.
screenshot: http://i.imgur.com/t1svo9e.png
devices: android tablet 4.1 (and simulator), iphone 5
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><title></title> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script src="http://code.highcharts.com/stock/highstock.js"></script> <style type="text/css"> body{ height:100% } div.fullscreen{ display:block; position:absolute; top:0; left:0; width:100%; height:100%; }</style> <script type='text/javascript'> //<![cdata[ $(document).ready(function() { var dataarray = [[1362960000000,102.369297],[1363046400000,102.516221],[1363132800000,102.534587],[1363219200000,103.339855],[1363305600000,102.975359],[1363564800000,103.21692],[1363651200000,103.502322],[1363737600000,104.003827],[1363824000000,103.245219],[1363910400000,103.759425],[1364169600000,103.43168],[1364256000000,103.418946],[1364342400000,104.200173],[1364428800000,105.066165],[1364774400000,105.08453],[1364860800000,105.78528],[1364947200000,104.90088],[1365033600000,105.029435],[1365120000000,105.41797],[1365379200000,105.013929],[1365465600000,108.751608],[1365552000000,111.21087]]; var volumearray = [[1362960000000,36635430],[1363046400000,39259460],[1363132800000,29103210],[1363219200000,55917300],[1363305600000,92711920],[1363564800000,44828020],[1363651200000,51902970],[1363737600000,35454210],[1363824000000,34234570],[1363910400000,28720830],[1364169600000,44153930],[1364256000000,27831650],[1364342400000,36048960],[1364428800000,55455610],[1364774400000,29203120],[1364860800000,28460380],[1364947200000,35064470],[1365033600000,45267600],[1365120000000,50928780],[1365379200000,34759720],[1365465600000,77737850],[1365552000000,71116620]]; var chartheight = $('#chartcontainer').height(); var onepercent = chartheight / 100; window.chart = new highcharts.stockchart({ chart : { backgroundcolor: 'lightgrey', plotbackgroundcolor: 'white', zoomtype : 'x', renderto : 'chartcontainer', //borderradius : 0, spacingtop : 0, spacingleft : 0, spacingright : 0, spacingbottom: 0, margintop : 0, marginleft : 0, marginright : 0, marginbottom: 0 }, rangeselector : {selected : 0, enabled : false }, scrollbar: {enabled: false }, navigator: {enabled: false }, yaxis: [ { title: { text: 'price (usd)' }, maxpadding: 0.1, height: onepercent * 50, linewidth: 1, opposite: true }, { title: { text: 'volume' }, height: onepercent * 10, offset: 0, top: onepercent * 80, linewidth: 1, opposite: true } ], xaxis : [ { type: 'datetime', //linecolor: 'black', linewidth: 1, ordinal: false, tickposition: 'outside', gridlinewidth: 1, gridzindex: 1, datetimelabelformats: { second: '%y-%m-%d<br/>%h:%m:%s', minute: '%y-%m-%d<br/>%h:%m', hour: '%y-%m-%d<br/>%h:%m', day: '%y<br/>%m-%d', week: '%y<br/>%m-%d', month: '%y-%m', year: '%y' }} ], series : [ { data : dataarray, name : 'microsoft corporation (nasdaqgs:msft)', linecolor: 'blue', tooltip: { valuedecimals: 2 }, yaxis: 0, type : 'area', fillcolor : { lineargradient : { x1: 0, y1: 0, x2: 0, y2: 1 }, stops : [[0, highcharts.getoptions().colors[0]], [1, 'rgba(0,0,0,0)']]}}, { data : volumearray, name : 'volume', type : 'area', yaxis: 1, fillcolor : { lineargradient : { x1: 0, y1: 0, x2: 0, y2: 1 }, stops : [[0, highcharts.getoptions().colors[1]], [1, 'rgba(0,0,0,0)']]}} ]}); text = chart.renderer.text("my text").add(); textbbox = text.getbbox(); x = chart.plotleft + (chart.plotwidth * 0.5) - (textbbox.width * 0.5); y = chart.plottop + (chart.plotheight * 0.5) - (textbbox.height * 0.5); text.attr({x: x, y: y}); }); //]]> </script></head><body><div id="chartcontainer" class="fullscreen"></div></body></html>
it known bug, reported our developers here: https://github.com/highslide-software/highcharts.com/issues/1701
Comments
Post a Comment