Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Frontmatter structure:
- ---
- title: '2022-11-25'
- gesundheit:
- schritte: 123
- wasser: 1
- schlafdauer: 123
- schlafquali: 12
- ---
- */
- ```dataviewjs
- const gruvRedToGreen = ['#FB4934','#F45432','#ED5F31','#E66B2F','#E0762E','#D9822D','#D28D2B','#CC982A','#C5A428','#BEAF27','#B8BB26'];
- const vibrantRedToGreen20 = ['#FF0000','#F10D00','#E41A00','#D62800','#C93500','#BB4300','#AE5000','#A15D00','#936B00','#867800','#788600','#6B9300','#5DA100','#50AE00','#43BB00','#35C900','#28D600','#1AE400','#0DF100','#00FF00'];
- const AyuRedToGreen = ['#FF7383','#F07A7C','#E18276','#D2896F','#C49169','#B59963','#A6A05C','#98A856','#89AF4F','#7AB749','#6CBF43'];
- const colorScale1 = AyuRedToGreen;
- const year = 2022;
- const showCurrentDayBorder = true;
- // Ziele
- const tSchritte = 6000;
- const tWasser = 6;
- const tSchlafDauer = 480;
- let SchlafDauerStunden = tSchlafDauer / 60
- const tSchlafDauerMin = 300
- let SchlafDauerMinStunden = tSchlafDauerMin / 60
- const tSchlafQuali = 100;
- const tSchlafQualiMin = 70;
- const schritte = {
- year: year,
- colors: {
- colorScale: colorScale1,
- },
- showCurrentDayBorder: showCurrentDayBorder,
- defaultEntryIntensity: 0,
- intensityScaleStart: 0,
- intensityScaleEnd: tSchritte,
- entries: [],
- };
- const wasser = {
- year: year,
- colors: {
- colorScale: colorScale1,
- },
- showCurrentDayBorder: showCurrentDayBorder,
- defaultEntryIntensity: 0,
- intensityScaleStart: 0,
- intensityScaleEnd: tWasser,
- entries: [],
- };
- const schlafdauer = {
- year: year,
- colors: {
- colorScale: colorScale1,
- },
- showCurrentDayBorder: showCurrentDayBorder,
- defaultEntryIntensity: 0,
- intensityScaleStart: tSchlafDauerMin,
- intensityScaleEnd: tSchlafDauer,
- entries: [],
- };
- const schlafquali = {
- year: year,
- colors: {
- colorScale: colorScale1,
- },
- showCurrentDayBorder: showCurrentDayBorder,
- defaultEntryIntensity: 0,
- intensityScaleStart: 30,
- intensityScaleEnd: tSchlafQuali,
- entries: [],
- };
- // Schritte
- dv.el('small', '🦶 **' + tSchritte + '**');
- for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schritte).sort(p => p.file.name)) {
- schritte.entries.push({
- date: page.file.name,
- intensity: page.gesundheit?.schritte,
- content: "",
- color: "colorScale",
- })
- };
- renderHeatmapCalendar(this.container, schritte);
- // Wasser
- dv.el('small', '🥤 **' + tWasser + '**');
- for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.wasser).sort(p => p.file.name)) {
- wasser.entries.push({
- date: page.file.name,
- intensity: page.gesundheit?.wasser,
- content: "",
- color: "colorScale",
- })
- };
- renderHeatmapCalendar(this.container, wasser);
- // Schlafzeit
- dv.el('small', '😴-🕗 **' + SchlafDauerStunden + '**');
- for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafdauer).sort(p => p.file.name)) {
- schlafdauer.entries.push({
- date: page.file.name,
- intensity: page.gesundheit?.schlafdauer,
- content: "",
- color: "colorScale",
- })
- }
- renderHeatmapCalendar(this.container, schlafdauer);
- // Schlafqualität
- dv.el('small', '😴-📈 **' + tSchlafQuali + '**');
- for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafquali).sort(p => p.file.name)) {
- schlafquali.entries.push({
- date: page.file.name,
- intensity: page.gesundheit?.schlafquali,
- content: "",
- color: "colorScale",
- })
- }
- renderHeatmapCalendar(this.container, schlafquali);
- this.container.style.width = "80%";
- this.container.style.margin = "auto";
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement