cal-heatmap
cal-heatmap copied to clipboard
displaying value/data from json
Hi,
I'm unable to display the value in subDomainTextFormat when data: is from a json file. If it's a local variable it works fine, but I need it to work with .json for ajax.
Heres an example: http://embed.plnkr.co/giWBM1R2B0yzIr6xfSvq/
Hope someone can help
I found a way to do it:
subDomainTextFormat: function(date ,value) {
var date = parseInt((new Date(date).getTime() / 1000).toFixed(0))
var finval = 0;
$.ajax({
url: 'test.json',
async: false,
dataType: 'json',
success: function (response) {
$.each(response, function(i, field){
if(date == i){
console.log("found: "+field);
finval = field;
return finval;
}
})
}
});
if (finval == 0){finval = "";}
return finval;
},
It's certainly not optimised and will get slower the more data there is and creates a LOT of requests... but it works!
Just realised the last update was a year ago. Is project maintained anymore and likely to be patched?
Having the same issue...was hoping to display values from my "week" subdomain into the cell.
@0xRoM thanks for the tip but it's going to be too much json to unpack quickly.
Fixed in v4