score:42
internally highcharts uses javascript date numbers (the number of milliseconds since jan 1st 1970) to represent dates. see mozilla reference.
to get dates on an axis you will first need to set the axis type to 'datetime':
xaxis: {
type: 'datetime'
}
you have a few options when specifying the series data (all three examples produce the same chart):
setting a start point and using a fixed interval between points
pointstart: date.utc(2012, 2, 6, 10), pointinterval: 1000 * 60 * 60, data: [5, 6, 4]
specifying the exact date using the date.utc method. this way its readable for humans:
data: [ [date.utc(2012, 2, 6, 10), 5], [date.utc(2012, 2, 6, 11), 6], [date.utc(2012, 2, 6, 12), 4]]
or specifying the epoch time directly:
[[1331028000000, 5], [1331031600000, 6], [1331035200000, 4]]
example on jsfiddle
score:4
adding to @eolsson, epoch time is usually the way to go since technically, date() objects are javascript, not json, and you're unlikely to find an off-the-shelf serializer that generates them.
you'll want to format the date, too, something like this --
xaxis: {
type: 'datetime',
labels: {
formatter: function() {
return highcharts.dateformat('%e %b', this.value*1000); // milliseconds not seconds
},
}
}
the date formatting is done php style.
Source: stackoverflow.com
Related Query
- What format does the highcharts js library accept for dates?
- Highmaps: what is the code for a county?
- jspdf is not able to capture the div content properly for highcharts to download as pdf format
- Why does this Highcharts graph only show tooltip for the first and last nodes?
- How do I use dates from a LinkedHashMap for the x-axis on a Highcharts line graph (using Thymeleaf)?
- Simple, Open source PHP wrapper for Highcharts library
- Slider implementation for the dates on the x-axis not working correctly in Highcharts
- How to get the correct the date-time format for highcharts in R (using rcharts)
- Tooltip in Highcharts doesn't show the right format for Date
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- What is the solution for Highcharts hover
- What is the format of 'date' when for highchart?
- what should be the initial dataset from millions of data points for stock line highcharts
- Why does highcharts not accept an array for second y axis?
- Highcharts setExtremes() does not display the correct interval for one day
- How to get highcharts dates in the x axis?
- Customize tooltip and format the number to 2 decimal places of highcharts
- Highcharts - How to set custom colors for the series
- What is the best strategy for testing D3/HighCharts/SVG?
- Why does HighCharts reverse the order of my series?
- Customizing the Stockchart range selector buttons from HighCharts library in GWT (and Javascript in general)
- Why are the labels for my opposite yaxis in Highcharts not showing up?
- Sort the series data for every X-Axis in Highcharts
- Add onclick event on chart made with the highcharts library
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- How to completely disable the mouse/finger interaction for highcharts
- Format Highcharts xAxis for stock data
- How to customize the crosshair Line for Highcharts
- What should be the right borderWidth in a solidgauge Highcharts chart?
- How to format datetime for (x,y) pair data for Highcharts
More Query from same tag
- Changing the scale of yAxis on Highstock to draw plot line
- unequal intervals on gauge Highcharts (or other libraries)
- HighCharts using Themeroller
- Highcharts: Multiple series, one chart, select individual series
- Gradient fill for react-highcharts' line chart
- HighCharts plugin JQuery
- Highcharts legend events style edit
- Highstocks component react error
- Create a highchart graphic using angular.js
- Zoom function breaks the xAxis labels and creates chart gaps when exiting zoom
- How to show progrss bar in highchart while loading data?
- HighStocks/HighCharts scrollbar not displaying with large datasets causing xAxis labels to disappear and making bars not show
- I want show NO DATA AVAILABLE with backside grid lines in highcharts
- Highcharts not rendering in jQuery tooltip
- Highcharts - how to update series in angular?
- Highcharts sankey draggable nodes
- How do I increase the number of points in a live updating spline chart?
- Highcharts: Fade other columns when mouse over one column
- Set minPointLength for one of two series in highchart
- Modify the color of series in highcharts-ng
- highchart change chart by choosing month in drop down
- Highcharts change or add color for name in a array of point.names and y
- Highcharts - Sunburst partition
- How to change the palette colors of a highcharter column plot which depends on a variable?
- Repeat labels in each x position on polar graph
- HighCharts Keep Vertical Line on Click Event
- highcharts missing x axis labels when stacking two charts
- Highcharts dataLabels not showing in all levels of drilldown
- How to make stacked column chart percentages exceed 100% in highcharts
- Highcarts doesn't load my JSON data