From 88208fc542fe0af3484ea6c190e48397646a6e37 Mon Sep 17 00:00:00 2001 From: antonbardera <48566394+antonbardera@users.noreply.github.com> Date: Wed, 15 May 2024 18:38:07 +0200 Subject: [PATCH] Typos correction on dates and tooltip --- src/index.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.md b/src/index.md index e22da62..e872c1d 100644 --- a/src/index.md +++ b/src/index.md @@ -91,7 +91,12 @@ const colorPlot = { label: "% volum embassat" } -const dateFormat = d3.timeFormat("%x"); +const dateFormat = (date) => { + const month = date.getMonth(); + const nexe = month === 3 || month === 7 || month === 9 ? "d'" : "de "; + return d3.timeFormat("%e ")(date)+nexe+d3.timeFormat("%B de %Y")(date); +} +//d3.timeFormat("%x"); const sortInput = Inputs.radio(new Map([["% volum embassat", true], ["capacitat", false]]), {value: true, label: "Ordenar per:", format: ([name, value]) => `${name}`}) const sort = Generators.input(sortInput); @@ -207,7 +212,7 @@ ${ fill: "pct", stroke: d => chroma(colorScale(d.pct)).darken(1).hex(), strokeWidth: .6, - title: (d) => `${d.name}\n${d.pct}%\n${d.level} hm³`, + title: (d) => `${d.name}\n${d.pct.toLocaleString('ca-ES')}%\n${d.level.toLocaleString('ca-ES')} hm³`, insetTop: 0.2, insetBottom: 0.2, tip: true