react-chartjs-2 icon indicating copy to clipboard operation
react-chartjs-2 copied to clipboard

Hide axis when dataset is turned off

Open alex-mironov opened this issue 4 years ago • 1 comments

I'm using 2 axes for different datasets. When the dataset is turned off 0 0.1, 0.2 is shown on the corresponding axis. Is there any way to hide the axis or adjust its ticks when the dataset is turned off? Screen Shot 2019-12-12 at 11 05 40

alex-mironov avatar Dec 12 '19 09:12 alex-mironov

Hi @alex-mironov 👋

You can achieve this by using display: 'auto' when configuring axes.

scales: {
    y: {
      type: 'linear' as const,
      display: 'auto',
      ...
    },
    ...
  },

So on disabling a dataset the axis linked to it will also be hidden.

Arantiryo avatar May 14 '22 12:05 Arantiryo