Add text labels to heat map
This commit is contained in:
parent
e250019862
commit
7b9b9bdcd3
2 changed files with 16 additions and 0 deletions
|
|
@ -46,6 +46,18 @@ export function render(weeks, counts) {
|
|||
svg.setAttribute("width", weeks.length * SHIFT + 30);
|
||||
svg.setAttribute("height", SHIFT * 7 + 20);
|
||||
|
||||
// Place the labels first
|
||||
["Mon", "Wed", "Fri"].forEach((label, i) => {
|
||||
const dayLabel = document.createElementNS(svgNS, "text");
|
||||
dayLabel.setAttribute("x", 0);
|
||||
dayLabel.setAttribute("y", (2 * i + 1) * SHIFT + 0.75 * CELL);
|
||||
dayLabel.setAttribute("font-size", 12);
|
||||
|
||||
const text = document.createTextNode(label);
|
||||
dayLabel.appendChild(text);
|
||||
svg.appendChild(dayLabel);
|
||||
});
|
||||
|
||||
weeks.forEach((week, col) => {
|
||||
week.forEach((day, row) => {
|
||||
if (day === null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue