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.
-
set globalAdapter=null, as if there is no window.HighchartsAdapter defined.
-
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.