Open anstadnik opened 8 months ago
I have the same problem and hope to fix it soon.
const data = dv.current()
const chartData = {
type: 'line',
data: {
labels: ['2023-01', '2023-02', '2023-03', '2023-04'],
datasets: [{
label: 'Kobe',
data: [60, 70, 80, 90]
},{
label: 'Jordan',
data: [90, 80, 80, 70]
}]
}
}
window.renderChart(chartData, this.container);
Apparently that feature only works for chart code block, so as a workaround I used
dv.paragraph(`\`\`\`chart
...
\`\`\``);
A little late to the party, but I came across the same issue with the axis labels on my radar graphs and found a solution. After a bit of digging into ChartJS, I found that it's possible to specify colours manually. Using your example:
```dataviewjs
const chartData = {
type: 'line',
data: {
labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
datasets: [
{
label: 'Title 1',
data: [1, 2, 3, 4, 5],
backgroundColor: [
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)'
],
borderWidth: 1,
},
{
label: 'Title 2',
data: [5, 4, 3, 2, 1],
},
{
label: 'Title 3',
data: [8, 2, 5, -1, 4],
}
]
},
};
window.renderChart(chartData, this.container);
Describe the bug
When using window.renderChart, there are no theme colors.
Relevant errors (if available)
No response
Steps to reproduce
Plot a graph using window.renderChart.
Expected Behavior
First graph should use theme colors.
Additional context
Code