Advertisement
dhniceday

Untitled

Nov 23rd, 2022
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. aliases:
  3. tags: ['sport']
  4. title: Statisktik Gehen
  5. date-created: 2022-10-31
  6. date-modified: 2022-11-02
  7.  
  8. cssClass:
  9. - row-alt
  10. - table-nowrap
  11.  
  12. ---
  13.  
  14. %% [[2022-10-31]] %%
  15.  
  16. ##### Statisktik "Gehen"
  17.  
  18. ```dataview
  19. TABLE WITHOUT ID
  20.     round(sum(rows.G.distanz),2) AS "∑ km",
  21.     round(sum(rows.G.dauer)) AS "∑ Zeit",
  22.     round(sum(rows.G.distanz)/length(rows), 2) AS "∅ km",
  23.     round(sum(rows.G.dauer)/length(rows)) AS "∅ Zeit",
  24.     round(sum(rows.G.geschwindigkeit)/length(rows), 1) AS "∅ km/h",
  25.     round(max(rows.G.dauer)) AS "max Zeit",
  26.     round(max(rows.G.distanz),2) AS "max km",
  27.     round(max(rows.G.puls-max)) AS "max Puls",
  28.     round(sum(rows.G.hf-schnitt)/length(rows)) AS "∅ HF"
  29. FROM "10 - Daily Notes"
  30. WHERE sport
  31. AND contains(sport.type, "Gehen")
  32. FLATTEN sport.gehen AS G
  33. GROUP BY true
  34. ```
  35. ##### An welchen Tagen bin ich gegangen ?
  36.  
  37. ```dataviewjs
  38. const gruvRedToGreen = ['#FB4934','#F45432','#ED5F31','#E66B2F','#E0762E','#D9822D','#D28D2B','#CC982A','#C5A428','#BEAF27','#B8BB26'];
  39. const onlyBlue = ['#80bfff'];
  40. const AyuRedToGreen = ['#FF7383','#F07A7C','#E18276','#D2896F','#C49169','#B59963','#A6A05C','#98A856','#89AF4F','#7AB749','#6CBF43'];
  41. const colorScale1 = onlyBlue;
  42. const year = 2022;
  43. const showCurrentDayBorder = true;
  44.  
  45. const gehen = {
  46.     year: year,
  47.     colors: {  
  48.         colorScale: colorScale1,
  49.     },
  50.     showCurrentDayBorder: showCurrentDayBorder,
  51.     defaultEntryIntensity: 0,
  52.     intensityScaleStart: 0,
  53.     intensityScaleEnd: 1,
  54.     entries: [],      
  55. };
  56.  
  57. // Gehen
  58. for (let page of dv.pages('"10 - Daily Notes"').where(p => p.sport?.gehen?.dauer).sort(p => p.file.name)) {
  59.     gehen.entries.push({
  60.         date: page.file.name,    
  61.         intensity: page.sport?.gehen?.dauer,
  62.         content: "",
  63.         color: "colorScale",
  64.     })
  65. }
  66. this.container.style.width = "88%";
  67. this.container.style.margin = "auto";
  68. renderHeatmapCalendar(this.container, gehen)
  69.  
  70.  
  71. ```
  72.  
  73. ##### Distanz und Dauer
  74.  
  75. ```dataviewjs
  76. const rawData = await dv.query('TABLE WITHOUT ID file.name, G.distanz, G.dauer FROM "10 - Daily Notes" WHERE sport AND contains(sport.type, "Gehen") FLATTEN sport.gehen AS G');
  77. const rows = rawData.value.values;
  78.  
  79.  
  80. const chartData = {
  81.     data: {
  82.         labels: rows.map(x => x[0]),
  83.         datasets: [{
  84.             type: 'bar',
  85.             label: 'km',
  86.             data: rows.map(x => x[1]),
  87.             barThickness: 7,
  88.             pointStyle: 'cross',
  89.             backgroundColor: ['#80bfff'],
  90.             borderWidth: 1,
  91.             borderColor: ['#80bfff'],
  92.             fill: false,
  93.             xAxisID: 'x2'
  94.             },
  95.             {
  96.             type: 'bar',
  97.             label: 'Minuten',
  98.             data: rows.map(x => x[2]),
  99.             barThickness: 7,
  100.             backgroundColor: ['#707a8c'],
  101.             borderWidth: 1,
  102.             borderColor: ['#707a8c'],
  103.             fill: false,
  104.             xAxisID: 'x1',         
  105.             },
  106.         ],
  107.     },
  108.     options: {
  109.         responsive: true,
  110.         animations: false,
  111.         indexAxis: 'y',
  112.         plugins: {
  113.             legend: {
  114.                 display: true,
  115.                 position: 'bottom',
  116.             },         
  117.         },
  118.         scales: {
  119.             x1: {
  120.                 type: 'linear',
  121.                 display: true,
  122.                 position: 'top',
  123.             },
  124.             x2: {
  125.                 type: 'linear',
  126.                 display: true,
  127.                 position: 'bottom',
  128.             },
  129.         },
  130.     },
  131. }
  132.  
  133. this.container.style.width = "80%";
  134. this.container.style.margin = "auto";
  135.  
  136. window.renderChart(chartData, this.container);
  137. ```
  138.  
  139. ##### Liste
  140. ``` dataview
  141. TABLE WITHOUT ID
  142.     link(file.name) AS "Datum",
  143.     round(G.distanz,1) AS "km",
  144.     round(G.dauer) AS "Minuten",
  145.     round(G.geschwindigkeit,1) AS "km/h",
  146.     round(G.puls-max) as "max. Puls",
  147.     round(G.hf-schnitt) as "∅ HF",
  148.     G.memo AS "Notiz"
  149. FROM "10 - Daily Notes"
  150. WHERE sport
  151. AND contains(sport.type, "Gehen")
  152. FLATTEN sport.gehen AS G
  153. ```
  154. %%
  155.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement