@@ -0,0 +1,3187 @@
+%0Aimport json%0Aimport pandas as pd%0A%0Afrom IPython.display import display, Javascript, Markdown%0A%0Afrom ._config import JS_LIBS_ONE, JS_LIBS_TWO, JS_SAVE%0Afrom .scripts import JS_JSON_PARSE%0A%0A%0Aclass GlobalOptions:%0A    %22%22%22%0A    Used to pass global options to Highcharts object%0A%0A    API: https://api.highcharts.com/highcharts%0A    Demos: https://www.highcharts.com/demo%0A    %22%22%22%0A%0A    def __init__(self, data):%0A        self.options = data%0A        self.js = None%0A%0A    def _json_dumps(self, obj):%0A        return pd.io.json.dumps(obj)%0A%0A    def create(self):%0A%0A        if isinstance(self.options, dict):%0A            json_options = self._json_dumps(self.options)%0A        else:%0A            json_options = self.options%0A%0A        js_default = %22%22%22%0A        if (window.HCDefaults == undefined) %7B%0A            window.HCDefaults = $.extend(true, %7B%7D, Highcharts.getOptions(), %7B%7D);%0A            console.log('Highcharts global default options accessible as HCDefaults');%0A        %7D%0A        %22%22%22%0A%0A        js_option = %22%22%22%0A        var options = %25s;%0A        %25s%0A        window.globalOptions = $.extend(true, %7B%7D, options);%0A        console.log(globalOptions);%0A        if (window.globalOptions == undefined) %7B%0A            window.globalOptions = %7B%7D;%0A        %7D%0A%0A        console.log('Highcharts global options accessible as globalOptions');%0A        %22%22%22 %25 (json_options, JS_JSON_PARSE)%0A%0A        js_call = 'Highcharts.setOptions(options);'%0A%0A        js = %22%22%22%0A        // the Jupyter notebook loads jquery.min.js  and require.js and at the top of the page%0A        // then to make jquery available inside a require module%0A        // the trick is http://www.manuel-strehl.de/dev/load_jquery_before_requirejs.en.html%0A        define('jquery', %5B%5D, function() %7B%0A            return jQuery;%0A        %7D);%0A%0A        require(%25s, function() %7B%0A            require(%25s, function() %7B%0A                %25s%0A                %25s%0A                %25s%0A            %7D);%0A        %7D);%0A        %22%22%22 %25 (JS_LIBS_ONE, JS_LIBS_TWO, js_default, js_option, js_call)%0A%0A        return js%0A%0A    def inject(self, verbose=True):%0A        if not self.js:%0A            self.js = self.create()%0A        if verbose:%0A            md = %22%22%22%0AHighcharts **global options** set in this cell:  %0A%60%60%60json%0A%7B%7D%0A%60%60%60%0A%22%22%22.format(self._json_dumps(self.options))%0A            display(Markdown(md))%0A        display(Javascript(self.js))%0A%0A    def reset(self, verbose=False):%0A        js_reset = %22%22%22%0A        let ResetOptions = function() %7B%0A            if (window.HCDefaults)%7B%0A                var defaultOptions = Highcharts.getOptions();%0A                for (var prop in defaultOptions) %7B%0A                    if (typeof defaultOptions%5Bprop%5D !== 'function') %7B%0A                        delete defaultOptions%5Bprop%5D%0A                    %7D%0A                    else %7B%0A                        console.log(prop);%0A                    %7D;%0A                %7D%0A                Highcharts.setOptions(window.HCDefaults);%0A                console.log('Highcharts global options reset to default ie HCDefaults');%0A            %7D%0A        %7D%0A        ResetOptions();%0A        %22%22%22%0A%0A        if verbose:%0A            md = %22%22%22%0AHighcharts **global options** reset to default.  %0A%22%22%22%0A            display(Markdown(md))%0A        display(Javascript(js_reset))%0A

Add global options management