I want to track mu daily meditiation practice, in minutes.
In my Daily note, I have Meditation under Properties, which it is set to Numbers.
I want to set my scale from 1 to 150 and the Heatmap should color my practice accordingly. So, for example, if I mark that I have meditated 140 minutes, it should colour it with the darkest color from my palette.
The problem is that the code doesn’t use my defined scale from 1-150, but it just sets it from the Daily practises used. So if the smallest amount of meditation time was 50 minutes, it will see that as the minimum and if the maximum I have meditated was 134 minutes, it would set that as the maximum.
So instead of 50 being orange, it is treated as the minimum value, and it colors it yellow.
I took the code from the Example vault of the Heatmap plugin and tried to appropriate it, but can’t seem to figure it out.
// Update this object
const trackerData = {
colorScheme: {paletteName: "danger", CustomColors: [] },
IntensityScaleStart: 1,
IntensityScaleEnd: 150,
entries: [],
separateMonths: true,
heatmapTitle: "Meditation",
heatmapSubtitle: "In minutes",
}
// Path to the folder with notes
const PATH_TO_YOUR_FOLDER = "8 Daily Journal";
// Name of the parameter you want to see on this heatmap
const MEDITATION = 'Meditation';
// You need dataviewjs plugin to get information from your pages
for (let page of dv.pages(`"${PATH_TO_YOUR_FOLDER}"`).where((p) => p[MEDITATION])) {
const [day, month, year] = page.file.name.split("-");
const isoDate = `${year}-${month}-${day}`; // Convert to YYYY-MM-DD
trackerData.entries.push({
date: isoDate,
intensity: page[MEDITATION],
content: await dv.span(`[](${page.file.name})`)
});
}
/* Optional: sort entries chronologically
trackerData.entries.sort((a, b) => new Date(a.date) - new Date(b.date)); */
renderHeatmapTracker(this.container, trackerData);
If I click on Legend on my heatmap, it shows me how the entry values are treated. But the Range should start at 0 and end with 150, and not like below: