holroy
December 21, 2024, 8:18pm
2
It might be a better idea to use dataviewjs to execute the initial query, even if that is an ordinary dataview query, and then manipulate that data a little and render it as a graph from within the query. Here are three different threads discussing similar stuff:
I understood what you explained. And works properly.
What we did now is that we sum up the outcome of the day, fabulous. What I also wanted to achieve is to sum up the days themselves. Meaning I have a graph where I can see how the outcome affects the prior days. Adding up …
For instance:
day1.outcome: 1.4
day2.outcome: -0.5
day3.outcome: 2.4
On day2 I would have sum.value of day1 + day2
on day3, a sum.value of day1 + day2 + day3
and so on …
Err… I would have to create another hidden va…
To reiterate your question, you want to create a line graph based upon data from journals, where each journal is named something like 2024-03-24-Samstag, and the criteria for the graph are:
The labels (and range) is to be the last seven days (aka x dimension)
One set of the y dimension are completed tasks on that day for a given tag
If possible, add multiple set for the y dimension for different tags
So in a super simplified world this could be presented in a table view as
date
Tag1
Tag …
Oh thank you! I fixed that and I fixed the const “chartDate” → “chartData” and now everything is working.
dv.span("**Squat Log**")
const pages = dv.pages('"Journal/1 Daily"').sort(p => p.file.name)
const dates = pages.map(p => p.file.name)
const squats = pages.map(p => p.squat).values
const chartData = {
type: 'line',
data: {
labels: dates,
datasets: [{
label: 'Squat (lb)',
data: squats,
backgroundColor: [
'rgba(53, 252, 167, 1)'
],
borderColor: [
'rgba(138, 102, …