`
lee1177
  • 浏览: 117813 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

jquery flot x轴时间差8小时问题

阅读更多

使用flot时x轴为时间数据从后台传时间过来,但现实后发现显示的是UTC时间,跟本地时间差8小时,查了下资料用tickFormatter解决了。

var options = {
        lines: { show: true },
        points: { show: true },
        grid: { hoverable: true},
        xaxis: { 
        	mode: "time",
        	timeformat: "%H:%M:%S",
        	tickFormatter: function (val, axis) {
	            var d = new Date(val);
	            return d.toLocaleTimeString();//转为当地时间格式
	        }
        }
    };
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics