Screen charts do not display data at some zoom levels

I use Highcharts / Highstock to build a fairly large amount of data (~ 10,000 points). Data consists of Date objects on the X axis and floats on Y, formatted as such: [[(date), 1.728], [(date), 0.346], ...] . Dates are always 1 hour apart and there are no gaps in the data.

When the chart range is> = 21 days (for example, a chart of at least 21 days), the chart displays correctly. Whenever the range is less than this, the chart becomes empty, and a tooltip displays each point as having a value of Y 0.0. The Y values ​​for these points exist in the array (I see them in Firebug), but they do not appear on the diagram. This is how I initialize it:

 mainChart = new Highcharts.StockChart({ chart: { renderTo: 'linegraph' }, rangeSelector: { buttons: [{ type: 'day', count: 1, text: '1 d' }, { type: 'week', count: 1, text: '1 wk' }, { type: 'month', count: 1, text: '1 mo' }, { type: 'year', count: 1, text: '1 yr' }, { type: 'all', text: 'All' }], selected: 2 }, series: [{ name: 'Electricity usage (kWh)', data: graphData, tooltip: { valueDecimals: 2, valueSuffix: "kWh" } }], }); 
+6
source share
2 answers

Turns out you can't use Date on the x-axis of your data. Instead, use a Unix date timestamp: Date.getTime() . The main pillars of FloppyDisk to point me in the right direction.

+2
source

I had the same problem, but everything was fine with timestamps on the X axis.

Allowed it by sorting the data in ascending order (provided, firstly, in the reverse order).

+3
source

Source: https://habr.com/ru/post/919161/


All Articles