Problem/Motivation
Pareto charts (80/20 rule) are essential business intelligence tools used to identify the most significant factors in a data set. While Highcharts supports Pareto functionality via a dedicated module, the Drupal Charts Highcharts submodule currently lacks an interface to enable this feature. Adding this allows users to overlay a cumulative percentage line on bar and column charts without manual #raw_options configuration.
Steps to reproduce
N/A (Feature Request)
Proposed resolution
- Register the Highcharts
pareto.jslibrary incharts_highcharts.libraries.yml. - Add a global configuration toggle to enable/disable the Pareto library across the site.
- Enhance the Bar and Column chart configuration forms to include an "Enable Pareto line" checkbox and a "Pareto line color" picker.
- Automate the generation of the secondary Y-axis (Percentage) and the linked Pareto series in the
Highchartsplugin logic. - Ensure cumulative values are formatted to two decimal places for tooltips, data labels, and axis labels for better readability.
Remaining tasks
- Review the patch.
- Test with various data sets to ensure the secondary axis scaling is correct.
User interface changes
- Global Settings: A new checkbox "Enable Highcharts' Pareto library" in the Highcharts module configuration.
- Chart Settings: When "Bar" or "Column" is selected, new fields for "Enable Pareto line" and "Pareto line color" will appear in the library-specific options section.
API changes
None. This utilizes existing Highcharts plugin hooks.
Data model changes
The charts_highcharts.schema.yml is updated to include pareto_library in global settings and pareto_line/pareto_color in the bar/column mapping.
Issue fork charts-3570689
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
Comment #2
andileco commentedComment #4
andileco commentedThis is working well for me now.
Comment #5
nikathoneComment #6
andileco commentedComment #7
nikathoneLooks good.
Comment #8
andileco commented