Reputation: 1
i have a data's from 1931 to yesterday in db. i am using python django models for getting data and disply the highstock. the chart is displaying only particular 15 days in x axis and range selector is also not working. here i have attached the jsfiddle code for your refernece.....any help thatks a lot ...strucked in this issues for last 2 days....
Highcharts.stockChart('container', { chart: { type: 'line' }, rangeSelector: { allButtonsEnabled: true, selected: 2 }, title: { text: '% of S&P 500 members above their 50 dma' },
yAxis: [{
lineWidth: 1,
height :100,
opposite: true,
tickposition:'outside',
visible:true
}, {
lineWidth: 0,
height :100,
opposite: true,
tickposition:'outside',
top :170,
visible:true,
}],
series: [{
yAxis: 0,
name: 'S&P 500',
data: {{ sp500_series }},
color: 'green',
tooltip: {
valueDecimals: 2
}
}, {
yAxis: 1,
xAxis:0,
y :-30,
name: 'dma50',
data: {{ dma50_series }},
color: 'red',
tooltip: {
valueDecimals: 2
}
}]
});
the data samples are
series: [{ yAxis: 0, name: 'S&P 500', data: [ [ 637266600.0, 336.0 ], [ 637353000.0, 336.87 ], [ 637439400.0, 338.07 ], [ 637525800.0, 341.91 ], [ 637785000.0, 343.53 ], [ 637871400.0, 341.57 ], ....... ........ ......
my output is enter image description here
Upvotes: 0
Views: 202
Reputation: 39099
The output is correct. Highcharts uses Unix Timestamp in milliseconds for dates. Your first sample x value: 637266600.0
is Thu Jan 08 1970 09:01:06 GMT+0000
For example 0
is Thu Jan 01 1970 00:00:00 GMT+0000
, so for previous dates you need to use negative values.
Live demo: http://jsfiddle.net/BlackLabel/6y3znsma/
Upvotes: 0