Advertisement
dhniceday

New Notes per Day

Nov 28th, 2022 (edited)
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---
  2. aliases:
  3. tags:
  4. date-created: 2022-11-13
  5. date-modified: 2022-11-14
  6. title: New Notes per Day
  7. ---
  8.  
  9. %% [[2022-11-13]] %%
  10.  
  11. ##### New Notes this week
  12.  
  13. ```dataviewjs
  14. const rawData = await dv.query('TABLE length(rows.file.name) FROM "" FLATTEN dateformat(file.ctime, "yyyy-MM-dd") AS D GROUP BY D SORT D DESC LIMIT 7 ');
  15. const rows = rawData.value.values;
  16.  
  17. const chartData = {
  18.     type: 'bar',
  19.     data: {
  20.         labels: rows.map(x => x[0]),
  21.         datasets: [{
  22.             label: 'Notes per day',
  23.             data: rows.map(x => x[1]),
  24.             backgroundColor: ['#80bfff'],
  25.             borderWidth: 2,
  26.             barThickness: 50,
  27.             borderColor: ['#80bfff'],
  28.             }],
  29.     },
  30.     options: {
  31.         indexAxis: 'x',
  32.         plugins: {
  33.             legend: false,
  34.         },
  35.     },
  36. };
  37.  
  38. this.container.style.width = "85%";
  39. this.container.style.margin = "auto";
  40. window.renderChart(chartData, this.container);
  41. ```
  42. %%
  43. ## Data
  44.  
  45. ```dataview
  46. TABLE
  47. length(rows.file.name) as Qty
  48. FROM ""
  49. flatten dateformat(file.ctime, "yyyy-MM-dd") as Date
  50. group by Date
  51. sort Date
  52. ```
  53. %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement