Note that there are some explanatory texts on larger screens.

plurals
  1. POHighcharts' getExtremes function can't return correct dataMax
    primarykey
    data
    text
    <p>I am using one highchart to control another one. After setting the chart.evetns.selection, chart.yAxis.getExtremes can't return correct dataMax if I zoom a tiny region. However, if I click once again, then it return the correct one. Any suggestion to avoid this? here is my code: <a href="http://jsfiddle.net/tianhuidong/Jhupu/" rel="nofollow">http://jsfiddle.net/tianhuidong/Jhupu/</a></p> <pre><code>$(function () { $('#container1').highcharts({ chart: { events: { selection: function (event) { m1 = event.xAxis[0].min m2 = event.xAxis[0].max var chart1 = $('#container1').highcharts() var chart2 = $('#container2').highcharts() chart1.xAxis[0].setExtremes(m1, m2); chart2.xAxis[0].setExtremes(m1, m2); }, click: function (event) { var chart1 = $('#container1').highcharts() var chart2 = $('#container2').highcharts() xx = chart1.xAxis[0].getExtremes() yy = chart1.yAxis[0].getExtremes() alert(yy.min) alert(yy.dataMax) alert(yy.userMax) alert(Object.keys(yy)) chart1.xAxis[0].setExtremes(xx.dataMin, xx.dataMax); chart1.yAxis[0].setExtremes(yy.dataMin, yy.dataMax); chart2.xAxis[0].setExtremes(xx.dataMin, xx.dataMax); } }, zoomType: 'xy' }, tooltip: { crosshairs: true }, plotOptions: { series: { events: { legendItemClick: function (event) { var chart1 = $('#container1').highcharts() var chart2 = $('#container2').highcharts() //alert(Object.keys(chart1.series[0])) chart2.series[0].hide() //chart2.showResetZoom() //alert(Object.keys(chart.resetZoomButton)) } } } }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, series: [{ data: [29.9, 71.5, 186.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 186.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); }); $(function () { $('#container2').highcharts({ xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 116.4, 194.1, 95.6, 54.4, 29.9, 71.5, 186.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload