1

有人在 Highcharts 中完成了 MTD 和 QTD 的实现吗?下面是 MTD 实现,完成后计算将传递给范围选择器。

var currentDate = new Date("March 05, 2013 00:00:00");
var tempDate = new Date(currentDate.getTime());
tempDate.setDate(1);
mtdCount = parseInt((currentDate.getTime() - tempDate.getTime())/(24 * 3600 * 1000));

options = {

chart: {
renderTo: 'container',
zoomType: 'xy'
}

rangeSelector: {
selected: 1,

buttons: [{
type: 'day',
count: mtdCount,
text: 'MTD'
}, {
type: 'all',
text: 'All'
}]
}

};

Highcharts.setOptions({
global: {
useUTC: false
}
});

但是结果是无效的,比如当前日期是 2013 年 3 月 5 日。因此假设这个当前日期在 MTD 中的日期范围是从 2013 年 3 月 1 日到 2013 年 3 月 5 日,但最终是 2013 年 2 月 28 日到 3 月 5 日2013 年。

我不确定根本问题在哪里?谢谢你。

4

1 回答 1

0

你的时区是什么时候?您必须通过偏移将所有数据的时间转换为 UTC+0:00。

于 2013-03-19T02:30:43.890 回答