如何摆脱 ChartJS 中的轴线?

How to get rid of axis lines in ChartJS?

我已经玩了两天 ChartJS,我似乎无法摆脱浅灰色轴线(垂直和水平)。

Screenshot of my chart, indication the lines I'd like to remove

由于这是一个 Laravel 项目,我正在使用 ConsoleTV 的图表包。 图表代码如下:

$this->options([
      'legend' => [
        'display' => false
      ],
      'scales' => [
        'xAxes' => [
          'gridLines'=> [
            'drawOnChartArea' => 'false',
            'display' => 'false',
          ],
          'display' => 'false',
        ],
      ],
      'elements' => [
        'line' => [
          'backgroundColor' => 'rgba(71, 15, 244, 0.2)',
          'borderColor' => '#470ff4'
        ],
      ],
      'title' => [
        'display' => false,
      ]
    ]);

...渲染成...(一行):

options: {"maintainAspectRatio":false,"scales":{"xAxes":{"gridLines":{"drawOnChartArea":"false","display":"false"},"display":"false"},"yAxes":[{"ticks":{"beginAtZero":true}}]},"legend":{"display":false},"elements":{"line":{"backgroundColor":"rgba(71, 15, 244, 0.2)","borderColor":"#470ff4"}},"title":{"display":false}}

为了便于阅读,我尝试对其进行格式化:

options: 
   {"maintainAspectRatio":false,
    "scales":{
      "xAxes":{
        "gridLines": {
          "drawOnChartArea":"false",
          "display":"false"
        },
      "display":"false"
     },
     "yAxes":
       [{"ticks":{
         "beginAtZero":true
         }}
        ]},
     "legend":{"display":false},"elements":{"line":{"backgroundColor":"rgba(71, 15, 244, 0.2)","borderColor":"#470ff4"}},"title":{"display":false}}

如您所见,我已尝试将多个显示值设置为 false。 任何帮助将不胜感激!

提前致谢。

编辑 到目前为止没有帮助的是添加这一行,尽管我完全相信它应该有效。这没有意义。我也查看了其他解决方案,但是,给出的答案不起作用。

脚本的加载顺序: 负责人:1.ChartJS 正文:1.图表canvas,2.图表配置

$this->options([
          'scales' => [
            'xAxes' => [
              'gridLines'=> [
                 'lineWidth' => 0
              ]
            ],
            'yAxes' => [
              'gridLines'=> [
                 'lineWidth' => 0
              ]
            ],
          ],
        ]);

我找到了一种方法来禁用 Laravel Charts'(ConsoleTV)ChartJS 上的轴。包本身有两种方法。

在图表模板 class 中,我添加了这两个函数:

public function __construct()
     {
       parent::__construct();
       // ...

       $this->displayAxes(false);
       $this->minimalist(true);

       // ...
     }