forked from highcharts/highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Study for injecting charts without iframe.
- Loading branch information
1 parent
304dd81
commit cae6a3c
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |