Advertisement
dhniceday

Untitled

Jun 22nd, 2023
3,443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. aliases:
  3. tags: ['health', 'selfImprovement']
  4. title: Statistik Gesundheit
  5. date-created: 2022-11-17
  6. date-modified: 2022-11-17
  7.  
  8. cssClass:
  9. - wide-view
  10. ---
  11.  
  12. %% [[2022-11-17]] %%
  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. const SimpleRedToGreen = ['#02ff0e','#daa500','#ff0018']
  19.  
  20.  
  21. const colorScale1 = gruvRedToGreen;
  22. const year = 2023;
  23. const showCurrentDayBorder = true;
  24. // Ziele
  25. const tSchritte = 5000;
  26. const tWasser = 4;
  27. const tSchlafDauer = 480;
  28. let SchlafDauerStunden = tSchlafDauer / 60
  29. const tSchlafDauerMin = 300
  30. let SchlafDauerMinStunden = tSchlafDauerMin / 60
  31. const tSchlafQuali = 75;
  32. const tSchlafQualiMin = 0;
  33.  
  34. const schritte = {
  35.     year: year,
  36.     colors: {  
  37.         colorScale: colorScale1,
  38.     },
  39.     showCurrentDayBorder: showCurrentDayBorder,
  40.     defaultEntryIntensity: 0,
  41.     intensityScaleStart: 0,
  42.     intensityScaleEnd: tSchritte,
  43.     entries: [],      
  44. };
  45.  
  46. const schlafdauer = {
  47.     year: year,
  48.     colors: {  
  49.         colorScale: colorScale1,
  50.     },
  51.     showCurrentDayBorder: showCurrentDayBorder,
  52.     defaultEntryIntensity: 0,
  53.     intensityScaleStart: tSchlafDauerMin,
  54.     intensityScaleEnd: tSchlafDauer,
  55.     entries: [],      
  56. };
  57.  
  58. const schlafquali = {
  59.     year: year,
  60.     colors: {  
  61.         colorScale: colorScale1,
  62.     },
  63.     showCurrentDayBorder: showCurrentDayBorder,
  64.     defaultEntryIntensity: 0,
  65.     intensityScaleStart: 40,
  66.     intensityScaleEnd: tSchlafQuali,
  67.     entries: [],      
  68. };
  69.  
  70. // Schritte
  71. dv.el('small', '🦶 **' + tSchritte + '**');
  72. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schritte).sort(p => p.file.name)) {
  73.     schritte.entries.push({
  74.         date: page.file.name,    
  75.         intensity: page.gesundheit?.schritte,
  76.         content: "",
  77.         color: "colorScale",
  78.     })
  79. };
  80. dv.span('---')
  81. renderHeatmapCalendar(this.container, schritte);
  82. dv.span('---')
  83.  
  84. // Schlafzeit
  85. dv.el('small', '😴-🕗 **' + SchlafDauerStunden + '**');
  86. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafdauer).sort(p => p.file.name)) {
  87.     schlafdauer.entries.push({
  88.         date: page.file.name,    
  89.         intensity: page.gesundheit?.schlafdauer,
  90.         content: "",
  91.         color: "colorScale",
  92.     })
  93. }
  94. dv.span('---')
  95. renderHeatmapCalendar(this.container, schlafdauer);
  96. dv.span('---')
  97.  
  98. // Schlafqualität
  99. dv.el('small', '😴-📈 **' + tSchlafQuali + '**');
  100. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.gesundheit?.schlafquali).sort(p => p.file.name)) {
  101.     schlafquali.entries.push({
  102.         date: page.file.name,    
  103.         intensity: page.gesundheit?.schlafquali,
  104.         content: "",
  105.         color: "colorScale",
  106.     })
  107. }
  108. dv.span('---')
  109. renderHeatmapCalendar(this.container, schlafquali);
  110. dv.span('---')
  111.  
  112. this.container.style.width = "80%";
  113. this.container.style.margin = "auto";
  114. ```
  115.  
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement