I have a HeatMap calendar project () where I am attempting to populate it with dynamic data. My approach involves extracting various dates from a file and converting them into milliseconds in order to create the necessary key-value pair for the calendar.
This is how I'm currently implementing it:
var aux = {};
var dataJSON = {};
for(var i=0; i<activity.length; i++) {
var date = new Date(activity[i].date);
var ms = date.getTime();
aux[ms] = 1;
dataJSON = JSON.stringify(aux);
}
Upon printing the result of dataJSON, it appears that I am generating the correct object:
{"1426204800000":1,"1426464000000":1,"1426636800000":1,...}
However, despite this seemingly accurate output, the populated calendar remains empty. Below is my current calendar setup configuration:
var cal = new CalHeatMap();
cal.init({
itemSelector: "#cal-heatmap",
domain: "month",
subDomain: "x_day",
start: new Date(init),
data: dataJSON
});
Interestingly, when I replaced the dynamic data with static data, the calendar rendered as expected:
var dataJSON = {"1420498800":2,"1420585200":4,"1420671600":2,...};
Additionally, I encountered a GET error from d3.js which displayed:
GET http://localhost:9000/%7B%221426204800000%22:2,%2...%221433721600000%22:2%7D
Aborted
If anyone could shed light on where I might be going wrong, I would greatly appreciate it. Thank you in advance.