What I’m trying to do
Hello, I would like to ask if somebody knows how to render a chart and to take the full width of the note. I’m currently using the Minimal theme
Things I have tried
https://charts.phibr0.de/ (Obsidian Charts Documentation site)
Chart.js | Chart.js (chart.js site)
I checked on both the documentation pages but couldn’t find a solution.
That’s an example code I’m using:
var key = "category"
const result = await dv.query(`
TABLE
category,
total
FROM csv("db.csv")
WHERE direction="Out" AND category!=null
GROUP BY ` + key + `
FLATTEN sum(rows.amount) as total
`)
if (result.successful) {
var labels = [],
data = [];
// Reformat into correct chart input
Object.entries(result.value.values).map(
(entry) => labels.push(entry[1][1])
);
Object.entries(result.value.values).map(
(entry) => data.push(entry[1][2])
);
const chartData = {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: key,
data: data,
backgroundColor: [
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)'
],
borderWidth: 1,
}]
}
};
//dv.paragraph(data);
window.renderChart(chartData, this.container);
//this.container.style.width = "200%";
}
else {
dv.h1("~~~~\n" + result.error + "\n~~~~") }