score:0
In v4.1.0 series.pointIntervalUnit
was introduced. Use that option to define irregular intervals between points (e.g. day, month, year).
Old Answer (Highcharts < 4.1.0):
Unfortunately it's not possible - pointInterval
just increments by given number, so irregular value is not possible. However, you can set directly x-value, see: http://jsfiddle.net/kUBdb/2/
The good thing about JS is that
Date.UTC(2007, 10, 10) == Date.UTC(2005,34, 10)
returns true, so you can freely increment month by one.
score:0
You can populate the xaxis value (by month) dynamically and push together with yxais data. The code would be like:
var s = {name: 'serial name', data: []},
serialData = [], categories = [];
var flatData = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],
startDate = Date.UTC(2000, 1, 1);
// Set the xaxis value as first day of month
for (var i = 0; i < flatData.length; i++) {
var d = new Date();
d.setTime(startDate);
d.setMonth(d.getMonth() + i);
categories.push(d.getTime());
}
for (var i = 0; i < flatData.length; i++) {
s.data.push([categories[i], flatData[i]]);
}
serialData.push(s);
$('#canvas').highcharts({
......
xAxis: {
type: 'datetime',
}
serial: serialData
});
Then the xaxis labels would be 'by month'. Here is the example: JSFiddle.
The idea is imported from here: HighCharts Demo.
score:0
You can manually generate date tags and add them to the data list like this:
series: [{
data: [["Jan 1, 2005", 0], ["Feb 1, 2005", 0], ..., ["Dec 1, 2005", 54.4]],
pointInterval: 24 * 3600 * 1000 * 31,
pointStart: Date.UTC(2005, 0, 01)
}]
This way, you can use the pointInterval as is (for approximate view on x-Axis), and use the tag on the chart dots (for the exact data).
If you zoom into the chart you will see slight overlap between the dots and the x-Axis ticks, but if you don't need perfect alignment this should do the trick.
To generate the date tags (e.g. "Jan 1, 2005") I would do something like this:
var data = [0, 0, 0, 0, 0, 0, 0, 148.5, 216.4, 194.1, 95.6, 54.4];
var date = new Date("January 1, 2005");
var monthNameList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
for (i = 0; x < data.length; i++)
{
var stringDate = monthNameList[date.getMonth()] + " 1, " + date.getFullYear();
resultList.push(stringDate);
date.setMonth(date.getMonth() + 1);
}
Then add each item to the data.
Edited: I think the first answer above is a very neat way to generate date tags. (Check the JSFiddle)
score:1
The other answers to this are out of date.
Now all you need to do is add the pointIntervalUnit property. You can combine this with pointInterval to draw irregular intervals :
Highcharts.chart('container', {
...
plotOptions: {
series: {
pointStart: Date.UTC(2015, 0, 1),
pointIntervalUnit: 'month'
}
},
...
See: https://api.highcharts.com/highcharts/plotOptions.series.pointInterval
Source: stackoverflow.com
Related Query
- How to set PointIntervals per month in HighChart
- Highchart / Highstock how to set color of individual ohlc or candle?
- How to set series-label to false by default and change the color of series label text in highchart
- How to set border in column chart - Highchart
- How to set Highchart datetime format to minute?
- How do I set the highchart gantt headers as fixed when I scroll vertically
- How to set a Maximum yAxis range for HighChart graph?
- How to set the highchart and the table horizontally?
- How to set Precision-ToolTip in Highchart
- how to set chart in center on full screen view in highchart
- How can you set colors per level in a Highcharts Sunburst chart?
- how to add data from database and set it to data serie in highchart C#
- How to set highchart global options IN R
- how to set the height of subtitle in highchart without defining height of the container?
- Highchart How to set pie chart sliced distance gap wider to one another
- How to set highchart legend style?
- How to set an option in Highchart inactive by default
- How to set highchart boxplot size
- How to set the static series name to the element result based on the categories in the HighChart
- How can i set the json encode result to the highchart series data using getJSON
- How to set different colors for bars based on value in Highchart bar chart?
- How to set color for non plotting Area in HighChart
- How to set different bar width in the same series Highchart
- How to set a 24h range on the y-axis of a column highchart
- How to set the x-axis to start at the bottom of the chart in highchart
- Vue highchart how to set language
- How to set scrollbar in highchart tooltip?
- How to render Gantt Highchart from data source
- Highchart spline Cut Off when reach to maximum scale value. How can it fixed?. I have attached may sample code on body
- When there is a plotband and a plotline emerging from yAxis how to set a particular width for plotband only in highchart
More Query from same tag
- How to remove white background on a simple bar chart?
- BorderRadius Using HighCharts HeatMap
- Combining drag of jquery to change highcharts Height using CSS
- All series data are equal highcharts
- Highcarts in Laravel
- Dynamically creating mutiple Highcharts charts in Angular directive
- Can I with highcharts column stacking on hover not highlighting the whole serie
- Highcharts Pie chart return slice animation on mouseout
- Highcharts: displaying data sets from one series
- Highcharts: Placement of data labels in the middle of sections of Pie Chart
- Highcharts 3.0 version changes in exporting options?
- Cannot send Highcharts to back (z-index) of page
- Plot bar chart from top to bottom
- Highchart not printing json when I add extra line to redirect
- Highchart - yAxis - 1,000 should be displayed like 1000
- Is it possible to combine mutiple charts with one navigator in highcharts stock?
- how to set chart in center on full screen view in highchart
- Display the sum of track values in activity gauge inner radius while rendering
- How to show/hide categories with checkbox using highcharts?
- Tooltip outside working in highcharts but not in highstock
- add to tooltip additional values from array
- How to implement mapbubble in highmaps using custom maps json generated using qgis?
- issues with HighCharts
- How To Set Different Colors For Different Plots In A Same Chart?
- Show only time labels on xAxis. Highcharts
- Angular: Programatically adding multiple y-axes to highstock with navigator
- How to get highcharts dates in the x axis?
- How can I have both a legend and data labels, with different labels, in Highcharts?
- Highcharts how to use JavaScript variable as series data source?
- how to call high chart in asp.net