Note that there are some explanatory texts on larger screens.

plurals
  1. POHighstock returns incorrect x value (datetime) after zoom for column chart
    primarykey
    data
    text
    <p>After any sort of zoom (mouse drag, range selector, date input) the datetime returned from the point click event is usually incorrect. I've not yet found this problem when using an area chart, have found it using both bar and column chart.<br/> To recreate: run the fiddle, zoom using the mouse across a few of the columns, click a datapoint. The alert will show the datetime returned. Notice it's different from the tooltip (which is correct).<br/>Usually fails after first click, even for the same datapoint. <br/> BTW useUTC setting doesn't matter.</p> <p>Fiddle: <a href="http://jsfiddle.net/jrEDT/" rel="nofollow">http://jsfiddle.net/jrEDT/</a></p> <p>Code for completeness:</p> <pre><code>$(function() { var seriesOptions = [], yAxisOptions = [], seriesCounter = 0, names = ['MSFT'], colors = Highcharts.getOptions().colors; $.each(names, function(i, name) { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename='+ name.toLowerCase() +'-c.json&amp;callback=?', function(data) { seriesOptions[i] = { name: name, data: data, type: 'column' }; // As we're loading the data asynchronously, we don't know what order it will arrive. So // we keep a counter and create the chart when all the data is loaded. seriesCounter++; if (seriesCounter == names.length) { createChart(); } }); }); // create the chart when all data is loaded function createChart() { Highcharts.setOptions({ global: { useUTC: false // datetime reflects time on db (ie, local) rather than GMT } }); chart = new Highcharts.StockChart({ chart: { renderTo: 'container', zoomType: 'x' }, exporting: { enabled: false }, rangeSelector: { selected: 4 }, yAxis: { plotLines: [{ value: 0, width: 2, color: 'silver' }], offset: 25 }, plotOptions: { series: { cursor: 'pointer', allowPointSelect: true, point: { events: { click: function() { var series = this.series.name; var utc = this.x; var d = Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x); alert(d); } } } } }, tooltip: { formatter:function(a,b,c){ var d = Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x); return d; }, enable:true }, series: seriesOptions }); } </code></pre> <p>});</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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