Project

General

Profile

Actions

Task #102759

closed

Remove obsolete configuration option in BarChartWidget to hide label

Added by Christian Buelter 11 months ago. Updated 10 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 #1

Updated by Gerrit Code Review 11 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82402

Actions #2

Updated by Gerrit Code Review 11 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82385

Actions #3

Updated by Oliver Bartsch 11 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF