Problem/Motivation

The charts_highcharts plugin provides global toggles under its configuration form (e.g., Enable Pareto library, Enable Color Axis, Enable Solid Gauge, etc.). However the selection of these charts, as well as their features remain present in the UI even when they're not enabled.

  • Broken Submission Handler: the pareto_library configuration property is explicitly missing in Highcharts::submitConfigurationForm, making it impossible for administrators to save the global Pareto toggle.
  • Dangling UI Elements: the plugin attaches Pareto, Color Axis, and Solid Gauge configuration elements onto #chart_type base settings forms regardless of them being enabled or not.
  • Invalid Chart Types Persist: If you disable a Highcharts library that implements an entirely distinct chart type (e.g., Solid Gauge, Heatmap, Dumbbell), the plugin does not deregister those types. This allows site builders to select "Solid Gauge" from the chart type dropdown even when the backend library javascript is disabled.

Steps to reproduce

  1. Navigate to /admin/config/content/charts and attempt to check/save "Enable Highcharts' 'Pareto' library". It fails to persist.
  2. Uncheck "Enable Highcharts' 'Solid Gauge' library".
  3. Create or edit a View using a Bar chart. Observe that "Enable Pareto line" and "Pareto line color" are still rendered in the settings UI.
  4. Attempt to change the chart type and observe that "Solid Gauge" is still a selectable option.
  5. Observe that if you use a Pareto chart prior to toggling the option off (or hacking it via database), the charts_highcharts/pareto library block is still rendered in the source code.

Proposed resolution

Modify \Drupal\charts_highcharts\Plugin\chart\Library\Highcharts to strictly adhere to global library configurations:

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork charts-3585470

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cballenar created an issue.

cballenar’s picture

Would love to get another pair of eyes on this. I don't know if there's anything in the roadmap from the maintainers for how to handle these type of library dependent options.

If these features are available as toggles in the Highcharts settings then it makes sense for the entire feature to be enabled/disabled accordingly, including related UI.

A big motivation for these changes in our case is that some of these features are not user friendly and having all these options available just adds complexity to an already busy interface. The submitted MR allows us to show only the features we have enabled.

cballenar’s picture

A possible issue with this is in how all this is part of the "Default" settings. Based on its description:

"The settings on this page are used to set default settings. They do not affect existing charts."

But I don't understand why enabling/disabling Highcharts features is in this section at all. Shouldn't they be considered global? Would it make sense to move these outside of the Default section and onto its own "Library Features" section to more accurately reflect these as global settings.

---

With that said, I think given the way things are currently setup, the work from MR!191 is still valid since the module was already enabling/disabling features.