The following error messages appear when trying to access a charts example at charts/example/display (on PHP 7.4).

Notice: Undefined index: grouping in Drupal\charts_chartjs\Plugin\chart\Chartjs->buildOptions() (line 105 of modules/contrib/charts/modules/charts_chartjs/src/Plugin/chart/Chartjs.php).

Notice: Undefined index: legend in Drupal\charts_chartjs\Plugin\chart\Chartjs->buildLegend() (line 141 of modules/contrib/charts/modules/charts_chartjs/src/Plugin/chart/Chartjs.php).

Comments

extect created an issue. See original summary.

extect’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

Patch attached.

andileco’s picture

StatusFileSize
new1.01 KB

A couple changes to the patch.

andileco’s picture

StatusFileSize
new2.22 KB

One other small change.

andileco’s picture

StatusFileSize
new1.01 KB

So annoyed...included a patch file in the last patch.

  • andileco committed 7f8b9a1 on 8.x-3.x
    Issue #3135079 by andileco, extect: Undefined index legend & grouping
    
andileco’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

attisan’s picture

Component: Chart.js Integration » Chart API
StatusFileSize
new986 bytes

Discard this if I'm wrong, but I could not find an option for making options['legend'] == TRUE . As selecting
to "none" would result in it being empty it would be best if the check is only like if (!empty($options['legend_position'])) { ... (see attached patch against 3.2).