I am getting this
Uncaught SyntaxError: Unexpected identifier error
, Why ? I think i have used the syntax properly ?
// I've revised it
var json;
json = '{"1438905600":0,"1438992000":0}';
setTimeout( $('#example-heatmap').each(function() {
if( json != null ){
var obj = $.parseJSON(json);
var now = new Date();
new CalHeatMap().init({
data: obj,
start: new Date(2016, 0),
cellSize: 11,
range: 9,
domain: 'month',
domainLabelFormat: '%Y-%m',
itemSelector: '#example-heatmap',
legend: [1, 3, 5, 7],
legendColors: {
min: '#efefef',
max: 'steelblue',
empty: '#efefef'
},
tooltip: true
//start: new Date(now.getFullYear(), now.getMonth() - 9)
});
} else {
setTimeout( arguments.callee, 100 );
}
}));
scripttag in your HTML, right? Not in a separate JavaScript file?