Advertisement
dhniceday

Untitled

Nov 27th, 2022 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Frontmatter structure:
  3.  
  4. ---
  5. title: '2022-11-25'
  6. gesundheit:
  7.   schritte: 123
  8.   wasser: 1
  9.   schlafdauer: 123
  10.   schlafquali: 12
  11. ---
  12. */
  13.  
  14. ```dataviewjs
  15. const gruvRedToGreen = ['#FB4934','#F45432','#ED5F31','#E66B2F','#E0762E','#D9822D','#D28D2B','#CC982A','#C5A428','#BEAF27','#B8BB26'];
  16. const vibrantRedToGreen20 = ['#FF0000','#F10D00','#E41A00','#D62800','#C93500','#BB4300','#AE5000','#A15D00','#936B00','#867800','#788600','#6B9300','#5DA100','#50AE00','#43BB00','#35C900','#28D600','#1AE400','#0DF100','#00FF00'];
  17. const AyuRedToGreen = ['#FF7383','#F07A7C','#E18276','#D2896F','#C49169','#B59963','#A6A05C','#98A856','#89AF4F','#7AB749','#6CBF43'];
  18.  
  19.  
  20. const colorScale1 = AyuRedToGreen;
  21. const year = 2022;
  22. const showCurrentDayBorder = true;
  23. // Ziele
  24. const tSchritte = 6000;
  25. const tWasser = 6;
  26. const tSchlafDauer = 480;
  27. let SchlafDauerStunden = tSchlafDauer / 60
  28. const tSchlafDauerMin = 300
  29. let SchlafDauerMinStunden = tSchlafDauerMin / 60
  30. const tSchlafQuali = 100;
  31. const tSchlafQualiMin = 70;
  32.  
  33. const schritte = {
  34.     year: year,
  35.     colors: {  
  36.         colorScale: colorScale1,
  37.     },
  38.     showCurrentDayBorder: showCurrentDayBorder,
  39.     defaultEntryIntensity: 0,
  40.     intensityScaleStart: 0,
  41.     intensityScaleEnd: tSchritte,
  42.     entries: [],      
  43. };
  44.  
  45. const wasser = {
  46.     year: year,
  47.     colors: {  
  48.         colorScale: colorScale1,
  49.     },
  50.     showCurrentDayBorder: showCurrentDayBorder,
  51.     defaultEntryIntensity: 0,
  52.     intensityScaleStart: 0,
  53.     intensityScaleEnd: tWasser,
  54.     entries: [],      
  55. };
  56.  
  57. const schlafdauer = {
  58.     year: year,
  59.     colors: {  
  60.         colorScale: colorScale1,
  61.     },
  62.     showCurrentDayBorder: showCurrentDayBorder,
  63.     defaultEntryIntensity: 0,
  64.     intensityScaleStart: tSchlafDauerMin,
  65.     intensityScaleEnd: tSchlafDauer,
  66.     entries: [],      
  67. };
  68.  
  69. const schlafquali = {
  70.     year: year,
  71.     colors: {  
  72.         colorScale: colorScale1,
  73.     },
  74.     showCurrentDayBorder: showCurrentDayBorder,
  75.     defaultEntryIntensity: 0,
  76.     intensityScaleStart: 30,
  77.     intensityScaleEnd: tSchlafQuali,
  78.     entries: [],      
  79. };
  80.  
  81. // Schritte
  82. dv.el('small', '🦶 **' + tSchritte + '**');
  83. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schritte).sort(p => p.file.name)) {
  84.     schritte.entries.push({
  85.         date: page.file.name,    
  86.         intensity: page.gesundheit?.schritte,
  87.         content: "",
  88.         color: "colorScale",
  89.     })
  90. };
  91. renderHeatmapCalendar(this.container, schritte);
  92.  
  93. // Wasser
  94. dv.el('small', '🥤 **' + tWasser + '**');
  95. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.wasser).sort(p => p.file.name)) {
  96.     wasser.entries.push({
  97.         date: page.file.name,    
  98.         intensity: page.gesundheit?.wasser,
  99.         content: "",
  100.         color: "colorScale",
  101.     })
  102. };
  103. renderHeatmapCalendar(this.container, wasser);
  104.  
  105. // Schlafzeit
  106. dv.el('small', '😴-🕗 **' + SchlafDauerStunden + '**');
  107. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafdauer).sort(p => p.file.name)) {
  108.     schlafdauer.entries.push({
  109.         date: page.file.name,    
  110.         intensity: page.gesundheit?.schlafdauer,
  111.         content: "",
  112.         color: "colorScale",
  113.     })
  114. }
  115. renderHeatmapCalendar(this.container, schlafdauer);
  116.  
  117. // Schlafqualität
  118. dv.el('small', '😴-📈 **' + tSchlafQuali + '**');
  119. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafquali).sort(p => p.file.name)) {
  120.     schlafquali.entries.push({
  121.         date: page.file.name,    
  122.         intensity: page.gesundheit?.schlafquali,
  123.         content: "",
  124.         color: "colorScale",
  125.     })
  126. }
  127. renderHeatmapCalendar(this.container, schlafquali);
  128.  
  129. this.container.style.width = "80%";
  130. this.container.style.margin = "auto";
  131.  
  132. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement