/* Automate testing of module somewhat */
var nav = Highcharts.win.navigator,
isMSBrowser = /Edge\/|Trident\/|MSIE /.test(nav.userAgent),
isEdgeBrowser = /Edge\/\d+/.test(nav.userAgent),
containerEl = document.getElementById('container'),
parentEl = containerEl.parentNode,
oldDownloadURL = Highcharts.downloadURL;
function addText(text) {
var heading = document.createElement('h2');
heading.innerHTML = text;
parentEl.appendChild(heading);
}
function addURLView(title, url) {
var iframe = document.createElement('iframe');
if (isMSBrowser && Highcharts.isObject(url)) {
addText(title +
': Microsoft browsers do not support Blob iframe.src, test manually'
);
return;
}
iframe.src = url;
iframe.width = 400;
iframe.height = 300;
iframe.title = title;
iframe.style.display = 'inline-block';
parentEl.appendChild(iframe);
}
function fallbackHandler(options) {
if (options.type !== 'image/svg+xml' && isEdgeBrowser ||
options.type === 'application/pdf' && isMSBrowser) {
addText(options.type + ' fell back on purpose');
} else {
throw 'Should not have to fall back for this combination. ' +
options.type;
}
}
Highcharts.downloadURL = function (dataURL, filename) {
// Emulate toBlob behavior for long URLs
if (dataURL.length > 2000000) {
dataURL = Highcharts.dataURLtoBlob(dataURL);
if (!dataURL) {
throw 'Data URL length limit reached';
}
}
// Show result in an iframe instead of downloading
addURLView(filename, dataURL);
};
Highcharts.Chart.prototype.exportTest = function (type) {
this.exportChartLocal({
type: type
}, {
title: {
text: type
},
subtitle: {
text: false
}
});
};
Highcharts.Chart.prototype.callbacks.push(function (chart) {
if (!chart.options.chart.forExport) {
var menu =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.