i m working on highcharts i need to show the graph having starting and ending date like low date is 2013-08-10 and high date is 2013-08-20 with different colors each line, i have done with the numbers but cant do with dates can any one help me??
series: [{
name: 'Initiatives',
data: [{
x: 0,
y: ['2013-08-4','2013-08-16'],
fillColor: "red"
},{
x: 1,
y: ['2013-08-2','2013-09-9'],
fillColor: "blue"
}]
}]
If you want to plot dats, you can use the javascript Date.UTC function:
y: [Date.UTC(2013,7,4),Date.UTC(2013,7,16)],
Note, the Javascript months start at zero, to August is 7.
You should try something like:
data: [{
x: 0,
low:Date.UTC(2013,7,4),
high:Date.UTC(2013,7,16),
color: "red"
},{
x: 1,
low: Date.UTC(2013,7,2),
high:Date.UTC(2013,8,9),
color: "blue"
}]
In highcharts, you can also do the number of milliseconds since 1970-01-01 00:00:00 UTC
series: [{
name: 'Initiatives',
data: [{
x: 0,
y: [1375574400000, 1376611200000],
fillColor: "red"
},{
x: 1,
y: [1375401600000, 1378684800000],
fillColor: "blue"
}]
}]
This is useful if you're generating the chart data in another language.
In ruby for example, it's easy: Date.parse('2013-09-9').strftime('%Q')