In our last recipe, we set up a foundation for extension that at the moment, just aliases Highcharts. In this recipe, we will see how we can add functions to our extension to make it more useful.
To get started, perform the following steps:
Add some new variables to our extension, as shown in the following code:
(function(w, H, $) { var me, NAME, MAJOR, MINOR, PUBLISHED; w.MyExtension = w.MyExtension || {}; me = w.MyExtension; // --- Private variables --- NAME = 'MyExtension'; MAJOR = 1; MINOR = 0; PUBLISHED = new Date(2013, 11, 26); // --- Global functions --- me.Chart = me.Chart || Highcharts.Chart; }(window, Highcharts, jQuery));
Create a
getVersionInfo
function, as shown in the following code:(function(w, H, $) { var me, NAME, MAJOR, MINOR, PUBLISHED, formatDate; w.MyExtension = w.MyExtension || {}; me...