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]: Use of the ChartJS options inside Obsidian #80

Closed The-Inamati closed 1 year ago

The-Inamati commented 1 year ago

Describe the bug

First of all,

Thank you very much for your work. This plugin has been very helpful to me.

Regarding the use of options in the chart. I have been trying to add labels to the axis with something like:

const chartData = {
  type: 'bar',
  data: {
    labels: rows.map(x => x[0]),
    datasets: [
      {
        label: '',
        data: rows.map(x => x[1]),
        backgroundColor: ['#859900'],
        borderColor: 'transparent',
        hoverBorderColor: 'transparent'
      }
    ]
  },
  options: {
    legend: {
      display: false
    },
    scales: {
      yAxes: [
        {
          scaleLabel: {
            display: true,
            labelString: 'Number of Tickets'
          }
        }
      ],
      xAxes: [
        {
          scaleLabel: {
            display: true,
            labelString: 'Days'
          }
        }
      ]
    }
  }
};

and I also tried to remove the label by setting the legend to false in the options but none of it worked.

Are these kind of options supported by your plugin? Are there some ChartJS options that are supported and some not?

Relevant errors (if available)

No response

Steps to reproduce

Just try to add a title to the chart Axis

Expected Behavior

No response

Additional context

No response

Code

No response

Operating system

Windows

The-Inamati commented 1 year ago

Fixed it. Thanks for your help