如果我先按上一个按钮,然后按下一个按钮,我的日历将只显示颜色代码。您能告诉我如何加载数据以及在页面加载时将日历着色吗?这是代码- 我尝试以不同的方式订购它,但结果相同。我必须在域选择器中再次单击前进和后退,以使日历具有颜色编码。
(function() {
var cal = new CalHeatMap();
cal.init({
itemSelector: "#example-g",
domain: "month",
subDomain: "x_day",
data: dada,
subDomainTextFormat: "%d",
<!--- start: new Date(new Date().getFullYear(),new Date().getMonth()-1, 0),--->
start: new Date(new Date().getFullYear(),new Date().getMonth()),
minDate: new Date(d.getFullYear(), d.getMonth()),
maxDate: new Date(new Date().getFullYear(),new Date().getMonth() ),
cellSize: 25,
cellPadding: 7,
domainGutter: 23,
range: 1,
tooltip: true,
itemName: ["time", "times"],
onClick: function(date, nb) {
var fusk=moment(date).format('YYYY-MM-DD');
//console.log(fusk);
$("#onClick-placeholder").html("
" +
moment(date).format('YYYY-MMM-DD') + "
Patient Brushed " +
(nb === null ? "unknown" : nb) + " times" + "
Morning Score: "+morning_map[fusk]+"
"+"
Evening Score: "+evening_map[fusk]+"
"
);
},
domainDynamicDimension: false,
previousSelector: "#example-g-PreviousDomain-selector",
nextSelector: "#example-g-NextDomain-selector",
domainLabelFormat: function(date) {
moment.lang("en");
return moment(date).format("MMMM").toUpperCase();
},
subDomainTextFormat: "%d",
legend: [1,2]
});