日期highstock高图 [英] date highstock highchart
本文介绍了日期highstock高图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(function(){
$ .getJSON('http:/ /www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json& callback =?',function(data){
//创建图表
window.chart = new Highcharts.StockChart({
图表:{
renderTo:'container'
},
rangeSelector:{
选中:0
},
标题:{
text:'TTm'
},
系列:[{
名称:'AAPL股票价格',
数据:[[1113868800000,37.09],
[1113955200000,35.51],
[1114041600000,37.18],
[1114128000000, 35.50],
[1114387200000,36.98],
[1114473600000,36.19],
[1114560000000,35.95],
[1114646400000,35.54],
[1114732800000, 36.06]],
类型:'area',
阈值:null,
工具提示:{
valueDecimals:2
},
fillColor:{
linearGradient:{
x1:0,
y1:0,
x2 :0,
y2:1
},
stops:[[0,Highcharts.getOptions()。colors [0]],[1,'rgba(0,0,0, 0)']]
}
解决方案
数字是以毫秒为单位的Unix时间(我认为是纪元时间)。它是javascript处理时间值的方式。
传递要添加到图表中的数据的值时,它可能看起来像 01/01/1928 00:00:00
。为了得到这个适合HighCharts使用的格式,你可以这样做(在JavaScript中):
Date.parse('01 / 01/1928 00:00:00')
can some one tell me how to read this date : [1113955200000,35.51], this code 1113955200000 gives me Tuesday apr 19 2005 any ideas ?????? what this numbers means and how to convert
$(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl- c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart : {
renderTo : 'container'
},
rangeSelector : {
selected : 0
},
title : {
text : 'TTm'
},
series : [{
name : 'AAPL Stock Price',
data :[[1113868800000,37.09],
[1113955200000,35.51],
[1114041600000,37.18],
[1114128000000,35.50],
[1114387200000,36.98],
[1114473600000,36.19],
[1114560000000,35.95],
[1114646400000,35.54],
[1114732800000,36.06]],
type : 'area',
threshold : null,
tooltip : {
valueDecimals : 2
},
fillColor : {
linearGradient : {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops : [[0, Highcharts.getOptions().colors[0]], [1, 'rgba(0,0,0,0)']]
}
解决方案
That number is the Unix time (epoch time I think) in miliseconds. It is how javascript handles time values.
When passing values from your data to be added to the chart it may look like 01/01/1928 00:00:00
. To get this into the appropriate format for HighCharts to use you can do (in javascript):
Date.parse('01/01/1928 00:00:00')
这篇关于日期highstock高图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文