Closed notflip closed 2 years ago
Hello!
I'm trying to do a very similar thing, and I've had some successess with the following code:
dv.header (2, 'Habits Counter');
const pages = dv.pages('"A 🔧/RealTime/2022/1° Trimestre/02 Febbraio/W05"')
.sort(p => p.file.link, 'asc')
const labels = pages.map(b=>b["day"]);
const data = pages.map(b=>b["ciga"]);
const chartData = {
type: 'line',
data: {
labels: labels.values,
datasets: [{
label: 'Sigarette',
data: data.values
backgroundColor: [
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)'
],
borderWidth: 1,
tension: 0.2
}]
},
options: {
animations: {
easing: 'linear',
},
scales: {
y: {
beginAtZero: true
}
}
}
}
window.renderChart(chartData, this.container);
I have no knowledge of Javascript, so I'm not able to explain what I did. In fact I'm stuck in trying to add another dataset, if you find a way let me know cuz it's driving me crazy. Best of luck!
I would suggest to ask in the #dataview Channel of Obsidian's Community Discord.
I'm trying to include dataview data from a certain folder, which has a few entries in the frontmatter, for example
I'm trying to achieve this using
But the returned result is only a 0, am I missing something? Thank you!