Commit 08a76143 authored by Nia Kathoni's avatar Nia Kathoni
Browse files

Issue #3321275 by nikathone: Highcharts should only be initialized when there is config data

parent 49b27b8f
Loading
Loading
Loading
Loading
+5 −1
Changes for modules/charts_highcharts/js/charts_highcharts.js: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,12 +9,16 @@
  Drupal.behaviors.chartsHighcharts = {
    attach: function (context) {
      const contents = new Drupal.Charts.Contents();
      if (drupalSettings.charts.highcharts.global_options) {
      if (drupalSettings.hasOwnProperty('charts') && drupalSettings.charts.highcharts.global_options) {
        Highcharts.setOptions(drupalSettings.charts.highcharts.global_options);
      }
      once('charts-highchart', '.charts-highchart', context).forEach(function (element) {
        const id = element.id;
        let config = contents.getData(id);
        if (!config) {
          return;
        }

        config.chart.renderTo = id;
        new Highcharts.Chart(config);
        if (element.nextElementSibling && element.nextElementSibling.hasAttribute('data-charts-debug-container')) {