phibr0 / obsidian-charts

Charts - Obsidian Plugin | Create editable, interactive and animated Charts in Obsidian via Chart.js
https://charts.phib.ro/
GNU Affero General Public License v3.0
546 stars 25 forks source link

[Bug]: Width modifier not respected in Live Preview. #76

Open mattsbennett opened 1 year ago

mattsbennett commented 1 year ago

Describe the bug

Width modifier not respected in Live Preview.

Steps to reproduce

Create a pie chart with a width modifier (e.g. 400px). Width is respected in Reading view, but not Live Preview view.

Expected Behavior

Width modifier is respected in Live Preview.

Code

type: pie
labels: [Money Supply (M1++),'Total Credit (Household, Financial & Non-financial)']
series:
  - title: Title 1
    data: [2108964000000,10126710000000]
tension: 0.2
width: 400px
labelColors: true
fill: true
beginAtZero: false
bestFit: false
bestFitTitle: undefined
bestFitNumber: 0

Operating system

macOS

JanUlrichR commented 11 months ago

Can confirm this problem. A workaround is to add a custom stylesheet:

div:has(>canvas){
    width: 500px ;
    height: 500px ;
}

However this is still not the optimal solution. I guess the problem is related to here.