score:2
The problem is your JSON data. It is not in a format that Highstock can immediately utilize to show as datetime
on the x-axis. The problem is that your strings, for example "30 June 2014 19:14", are not timestamps.
The x-axis needs timestamps in milliseconds (since 1. January 1970). Beware that some timestamps received from other sources may be in seconds, not milliseconds. If that is the problem you must multiply them by 1000.
When using strings it won't really make sense to Highstock, so Highstock just pretends the timestamp of your data is 0, 1, 2... which translates to 00:00:00.000 (0 milliseconds), 00:00:00.001 (1 millisecond), 00:00:00.002 (2 milliseconds)...
You need to convert your string representation of a date into a timestamp. I'm not sure if you can manipulate the format you receieve your JSON in, but if you can't you can post-process it to transform the data, like this (JSFiddle example):
var data = [
["30 June 2014 19:15",24],
["30 June 2014 19:16",41],
["30 June 2014 19:17",12],
["30 June 2014 19:18",8]
];
var timestampData = [];
for(i in data) {
timestampData.push([new Date(data[i][0]).getTime(), data[i][3]]);
}
$('#container').highcharts({
...
series: [{
data: timestampData
}]
});
The essence here is that new Date(data[i][0])
parses your string into a Date-object with values for year, month day... And you then use the getTime()
function of that object to get the timestamp.
Source: stackoverflow.com
Related Query
- how to display the date at X axis and other column at y axis in highcharts
- how to display 2 same highcharts without duplicate the code
- How to make the Y Axis values not start from 0 in highcharts? How to display forcefully display the last category data on X axis in HighCharts ?
- Highstock - How can i display the open, high, low, close in the line or area charts tooltip
- How to disable the date and time mentioned in the navigator part and not on the x axis in highstock?
- Strange character in the Highstock source code
- How to set the default display block position on the time line of highstock charts?
- How to display maximum and minimum value on the basis of date selected in High Charts?
- How to display the date on the x-axis in highstock?
- How do I display the Y axis on top of the X?
- Highstock - how to shift the X axis
- How to display Date in Highcharts tooltip or below the categories
- Highstock - Display last chart point in the center of the Y axis
- How to add the years in xAxis date format while exporting? Also how to add the data source during the exporting?
- Time display at x axis instead of date display in highstock
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- How to use the tooltip formatter and still display chart color (like it does by default)?
- how to set the interval of points on Y - Axis highcharts
- How replicate the value of Y Axis on both sides of the axis in Highcharts
- How can I get the max value of a y axis at highcharts?
- Highcharts - How to display legend symbol inside the tooltip
- How can I change the unit at y axis dynamically at Highcharts?
- How to display highchart y axis with constistant data
- how to change highstock date to persian date
- How to change axis label size when exporting in Highcharts / Highstock
- How to extract the data from highstock chart
- How to hide series via the legend in highstock ?
- r- how to display the labels on the highcharter objects all the time
- How can I get the navigator selection from a Highstock chart?
- how to get the axis value when I click on a cursor in highstock(high charts)?
More Query from same tag
- Ember.js and Highcharts: how to render a graph only after slow-loading model data has been loaded?
- How to remove the gap between the bar in my barchart with barwidth defined in highcharts
- How set options from HIGHCHARTS in a chart using vue chartkick
- High charts Tool tip is not supporting in IE10 and IE8 and Mozilla with more data
- Highcharts error #15: www.highcharts.com/errors/15
- How to change label double number in highchart
- parse JavaScript object to render highcharts
- Get base64 image from public highchart export server
- Highcharts - plotLines won't render
- Rendering Mathjax in Highcharts
- highchart dynamic binding using asp.net
- How would I convert this array to this json format
- Can't disconnect line chart with [null,null] and irregular intervals in Highcharts
- Highcharts Symbol in Legend
- Trouble parsing XML into JSON - Javascript
- How to get the data labels below the xAxis in a column graph
- styling of particular segments in highchart axis
- Angular2: highcharts-angular chart doesn't render
- Highstock rangeSelector from days in the future
- Highcharts Unable to set value of the property 'point': object is null or undefined
- In HIGHCHARTS unable to set the max point in the gauge
- Plot float up & down beyond y-axis in StockChart while dragging navigator
- Adding images to tooltips in Highmaps
- Loading Highcharts from MySQL using Java
- Highcharts - Column labels with different widths are not aligned
- Generate HighChart between two dates using Ajax
- Looping data inside highchart.js using type column chart
- hover on a point in highcharts graph using playwright and typescript
- Highcharts time series combo graph where few months data is null
- How to define colorAxis dataClasses for solid gauge chart?