我在我的asp.net网站中加入了cal-heatmap,只要我通过数组引用数据,初始化为init方法之上的变量,一切正常,但是一旦我创建新文本,事情就会停止显示在visual studio中将文件重命名为datas-years.json,并在“数据”中引用它。属性,请帮帮我?
var cal = new CalHeatMap();
var data = { "1420498800": 20, "1420585200": 40, "1420671600": 60, "1420758000": 1, "1421103600": 2, "1421190000": 90, "1421276400": 1, "1421362800": 1, "1421622000": 1, "1421708400": 1, "1422226800": 1, "1422313200": 1, "1422399600": 2, "1422486000": 1, "1422572400": 1, "1423695600": 3, "1424127600": 2, "1424214000": 1, "1424300400": 3, "1424386800": 1, "1424646000": 2, "1424732400": 1, "1424818800": 2, "1424905200": 2, "1424991600": 1, "1425337200": 1, "1425855600": 4, "1426201200": 2, "1426460400": 2, "1426546800": 1, "1426633200": 2, "1426719600": 1, "1426806000": 1, "1427065200": 1, "1427151600": 1, "1427238000": 2, "1427324400": 1, "1427670000": 2, "1428361200": 2, "1428447600": 2, "1428534000": 3, "1428620400": 3, "1428966000": 2, "1429138800": 2, "1429225200": 1, "1429484400": 2, "1429570800": 1, "1429657200": 2, "1429743600": 2, "1429830000": 3 };
cal.init({
data: data,
itemName: ["volunteer", "volunteers"],
start: new Date(2015, 0, 1, 1),
domain: "month",
subDomain: "day",
cellSize: 15,
subDomainTextFormat: "%d",
range: 12,
legend: [20, 40, 60, 80],
});
下面的是通过单独的文件引用,所有这些都在visual studio
下var cal = new CalHeatMap();
cal.init({
datatype:JSON,
data: "datas-years.json",
itemName: ["volunteer", "volunteers"],
start: new Date(2015, 0, 1, 1),
domain: "month",
subDomain: "day",
cellSize: 15,
subDomainTextFormat: "%d",
range: 12,
//highlight: new Date(2016, 1, 15),
legend: [20, 40, 60, 80],
});
我也想知道将日期转换为秒格式的最佳方法是什么,当我在现场实施时,我应该确保它以秒格式添加到json文件中,或者它可以就像2 / 26/2015?然后从json文件借用时将其转换为秒?请指导我,谢谢
编辑:
目录
中datas-years.json文件中的数据[{ #&34; 1420498800":20, #&34; 1420585200":40, #&34; 1420671600":80, " 1421708400":1, " 1422226800":1, " 1422313200":1, " 1422399600":2, " 1422486000":1 }]