Project

General

Profile

Actions

Task #102759

closed

Remove obsolete configuration option in BarChartWidget to hide label

Added by Christian Buelter 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Dashboard
Target version:
-
Start date:
2024-01-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
no-brainer
Sprint Focus:

Description

In TYPO3 12 bar chart widgets now show a label which did not appear in TYPO3 11. But the old configuration option to hide that label is still present. That configuration option should be removed because it does not have any effect.

Example

Example for the widget "Number of errors in system log" provided by EXT:dashboard

Background

In TYPO3 12 the chart.js library which is used to render the widgets in the dashboard has been updated from version 2.9 to 4.0 (https://docs.typo3.org/c/typo3/cms-dashboard/12.4/en-us/Migration/Index.html#migration).

For chart.js 3.0.0 and above the configuration for hiding the label from bar charts has been changed, see https://www.chartjs.org/docs/latest/migration/v3-migration.html:

legend, title and tooltip namespaces were moved from options to options.plugins.

Solution

In EXT:dashboard, file `Classes/Widgets/BarChartWidget.php` remove the code

                    'legend' => [
                        'display' => false,
                    ],

from

    public function getEventData(): array
    {
        return [
            'graphConfig' => [
                'type' => 'bar',
                'options' => [
                    'maintainAspectRatio' => false,
                    'legend' => [
                        'display' => false,
                    ],

Just for reference: The correct code to hide the label would be


    public function getEventData(): array
    {
        return [
            'graphConfig' => [
                'type' => 'bar',
                'options' => [
                    'maintainAspectRatio' => false,
                    'plugins' => [
                        'legend' => [
                            'display' => false,
                        ],
                    ],


Files

Auswahl_053.png (55.4 KB) Auswahl_053.png Christian Buelter, 2024-01-05 10:11
Auswahl_055.png (34.4 KB) Auswahl_055.png Christian Buelter, 2024-01-05 10:15
Actions

Also available in: Atom PDF