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
568 stars 26 forks source link

[Bug]: #58

Open dxcore35 opened 2 years ago

dxcore35 commented 2 years ago

Describe the bug

The "Width: x%" throw error: Screen Shot 2022-07-30 at 09 17 46

Relevant errors (if available)

No response

Steps to reproduce

Try to set width property inside DataviewJS block

Expected Behavior

No response

Additional context

No response

Code

// First, get all notes:
const notes = dv.pages();

const positive = dv.pages().where(f => f.spectrum == "positive").length;
const negative = dv.pages().where(f => f.spectrum == "negative").length;

// ... and put those in an array for later visualization:
const dataArray = [positive, negative];

// Now let's setup the data for the chart:
const chartData = {
   labels: ['Negative', 'Positive'],
   datasets: [
      {
         label: "Characteristics",
         legend: false,
         data: dataArray,
         backgroundColor: [
            'rgba(255, 99, 132, 0.2)',
            'rgba(128, 192, 32, 0.3)',
         ],
         borderColor: [
            'rgba(192, 0, 128, 1.0)',
            'rgba(128, 192, 32, 1.0)',
         ],
         borderWidth: 1,
      }
   ]
}

// Let's configure the chart:
const config = {
   type: 'pie',
   data: chartData,
   labelColors: true,
// width: 50% <<<<<<<<<<<<<<<<<
}

// Lastly, let's render the chart:

window.renderChart(config, this.container)

Operating system

macOS