9 つのカテゴリ (1 ~ 9 のラベル) の定性的な色の凡例を使用して、 cal-heatmapを作成しようとしています。次の CSS を使用して色を設定しています。
<style type="text/css">
.q8{fill:rgb(141, 211, 199);}
.q7{fill:rgb(255, 255, 179);}
.q6{fill:rgb(190, 186, 218);}
.q5{fill:rgb(251, 128, 114);}
.q4{fill:rgb(128, 177, 211);}
.q3{fill:rgb(253, 180, 98);}
.q2{fill:rgb(179, 222, 105);}
.q1{fill:rgb(252, 205, 229);}
.q0{fill:rgb(217, 217, 217);}
これとともに:
var cal_cluster = new CalHeatMap();
cal_cluster.init({
itemSelector: "#chart2",
itemName: ["Cluster", "Cluster"],
domain: "month",
subDomain: "day",
domainLabelFormat: "%b-%Y",
data: "data.json",
start: new Date(2012, 02),
maxDate: new Date(2013, 04),
cellSize: 16,
range: 5, animationDuration: 1000,
subDomainTextFormat: "%d",
nextSelector: "#domainDynamicDimension-next",
previousSelector: "#domainDynamicDimension-previous",
legend: [1,2,3,4,5,6,7,8,9],
legendCellSize: 15,
});
ただし、最後の 2 つのカテゴリは正しくレンダリングされません。
ただし、legendColors
オプションを使用すると適切に機能します (ただし、順次スケールは必要ありません)。
legendColors: {
empty: "#ededed",
min: "#40ffd8",
max: "#f20013"
}
また、cal-heatmap のカテゴリ カラー スケールを作成するより良い方法はありますか?