Skip to content

Highchart v2.1.7 in the SDK. Fail to load splunk.ui.charting.js if v3 highchart is used in web project #25

@jovezhong

Description

@jovezhong

I am using the latest master branch of Splunk JavaScript SDK, together with Highchart v3 in a PhoneGap project. But the splunk.ui.charting.js failed to be loaded.

splunk.ui.charting.js line 13041

 dataLabels: merge(defaultLabelOptions, {

"Uncaught TypeError: undefined is not a function"

It turns to be something related to HighchartsAdapter. The highchart in JS SDK (v2.1.7) doesn't define any HighchartsAdapter in window object, but the high chart.js in my PhoneGap project (v3.0.2) has such global variable defined.

There are 2 quick and dirty solutions to fix this.

  1. set globalAdapter=null, as if there is no window.HighchartsAdapter defined.

  2. just to redefine the merge function. Change line 12066 of splunk.ui.charting.js

      line:12066:   //merge = adapter.merge,
      merge = function () {
      var args = arguments;
      return jQuery.extend(true, null, args[0], args[1], args[2],args[3]);
      },
    

By doing so, the script can be loaded and executed correctly and all charts show up.

However, it will be great if we can fix the SDK code to sandbox the embed HighCharts, or simply upgrade the HighChart to v3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions