[英]Error using Javascript dot notation
I get Uncaught TypeError: undefined is not a function
at the date
line. 我收到
Uncaught TypeError: undefined is not a function
在date
行Uncaught TypeError: undefined is not a function
。 Removing .setHours(this.getHours()-6)
it runs just fine but I need to offset for timezone purposed. 删除
.setHours(this.getHours()-6)
可以正常运行,但我需要针对时区进行补偿。 In this case CST or -6 hours. 在这种情况下,CST或-6小时。 I believe I am misusing dot notation.
我相信我滥用点符号。 As a note
AmCharts.stringToDate(
is returning a Date
object. 注意,
AmCharts.stringToDate(
返回一个Date
对象。
var lineChartData = [
{
date: AmCharts.stringToDate("2014-04-18 13:44:39", "YYYY-MM-DD JJ:NN:SS").setHours(this.getHours()-6),
ambUp: 67.21,
ambDown: 62.83,
ext: 47.75,
in: 44.15,
out: 44.38,
freeze: 23.45,
fridge: 46.29,
diff: 2.14,
diff2: 0.2250
},
];
Seems like this
is not what you think it is. 似乎
this
不是您想的那样。 There is no special scope in properties like that, you should use an extra variable to reference the date twice 像这样的属性没有特殊的作用域,您应该使用一个额外的变量两次引用日期
var date = AmCharts.stringToDate("2014-04-18 13:44:39", "YYYY-MM-DD JJ:NN:SS");
date.setHours(date.getHours() - 6);
var lineChartData = [{
date: date,
ambUp: 67.21,
ambDown: 62.83,
ext: 47.75,
in : 44.15,
out: 44.38,
freeze: 23.45,
fridge: 46.29,
diff: 2.14,
diff2: 0.2250
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.