Skip to content

Commit

Permalink
Study for injecting charts without iframe.
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Oct 28, 2015
1 parent 304dd81 commit cae6a3c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ rules:
object-curly-spacing: [2, "always"]
operator-linebreak: [2, "after"]
space-before-function-paren: [2, {"anonymous": "always", "named": "never"}] # JSLint style
strict: 0
quotes: [2, "single"]
30 changes: 30 additions & 0 deletions studies/injected-chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function ($) {

/**
* Create the chart
* @returns {undefined}
*/
function addChart() {
$('#container').highcharts({
title: {
text: 'This chart is injected from a crossdomain JS file'
},
series: [{
data: [1, 3, 2, 4]
}]
});
}


// Below this line is functionality to load scripts and apply the chart
if (!$) {
return;
}

if (typeof Highcharts === 'undefined') {
$.getScript('//code.highcharts.com/highcharts.js', addChart);
} else {
addChart();
}

}(window.jQuery));

0 comments on commit cae6a3c

Please sign in to comment.