Remove Axis from Chart (Pie)

I've created a pie chart, but there are axis that appear. I have tried to remove these via the getOptions method, but it doesn't remove them. Strangely when I enable them, they appear twice.
protected function getOptions(): array
{
return [
'scales' => [
'yAxis' => [
'display' => false,
],
'xAxis' => [
'display' => false,
],
],
];
}
protected function getOptions(): array
{
return [
'scales' => [
'yAxis' => [
'display' => false,
],
'xAxis' => [
'display' => false,
],
],
];
}
Solution:
Ah, what I actually needed was to use x and y instead of xAxis and yAxis.
Jump to solution
3 Replies
Skjena
Skjena16mo ago
use the grid options in the axes to control this. Here is the link from the API https://www.chartjs.org/docs/latest/api/interfaces/CartesianScaleOptions.html#grid You should configure the options something like this
'scales' => [
'x' => [
'grid' => [
'display' => false
]
]
'scales' => [
'x' => [
'grid' => [
'display' => false
]
]
Interface: CartesianScaleOptions | Chart.js
Open source HTML5 Charts for your website
Solution
trovster
trovster16mo ago
Ah, what I actually needed was to use x and y instead of xAxis and yAxis.
trovster
trovsterOP16mo ago
I thought I tried this, but it must've been cached…
Want results from more Discord servers?
Add your server