读书人

关于highchart【续】,该怎么处理

发布时间: 2013-06-26 14:29:32 作者: rapoo

关于highchart【续】
额、、、 为什么连打酱油的都没。。。
这个fomatter 可以达到效果


formatter: function () {
if (this.value < parseInt(data.time[0][0].replace("/Date(", "").replace("+0800)/", ""), 10)) {
//按照比例获取数据源中的元素

var width = $("#container").width();//获取宽度
var a = Math.round(width / this.value);
var b = Math.round(data.time[0].length / a);
var c;
if (data.time[0][b] == undefined) {
c = ChangeDateFormat(data.time[0][data.time[0].length - 1]);
}
else {
c = ChangeDateFormat(data.time[0][b]);
}
date = c;
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();


var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var sec = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
c = date.getFullYear() + "-" + month + "-" + currentDate + "-" + hours + ":" + min + ":" + sec;

return c;
}
var date = new Date(this.value);
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var sec = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();

var c = date.getFullYear() + "-" + month + "-" + currentDate + "-" + hours + ":" + min + ":" + sec;



return c;
},




但是。。。。。 如果这么做之后 tooltip(提示框)还有很多缩放的功能都得重新fomatter。。。。 这个。。。
还是得请教下为什么数据源的时间会被初始化的问题、、、、 不然工作量老大了、、、

前面的帖子:http://bbs.csdn.net/topics/390499556,
http://bbs.csdn.net/topics/390498188。

关于highchart【续】,该怎么处理
求教~~ 求喷

读书人网 >JavaScript

热点推荐