def add_chart_options(self, options = None, **kwargs): """ pass chart chart_options in a dictionary and/or as keyword arguments options that are nested javascript object properties can be indicated with dots. or underscores. For example, hAxis.direction be passed in these ways add_chart_options(hAxis_direction = 1) add_chart_options({'hAxis_direction': 1) add_chart_options({'hAxis.direction': 1) The full json notation can also be used: add_chart_options({'hAxis': {'direction': 1}}) """ # Set chart to empty dictionary if user has nulled it out. if self.chart_options == None: self.chart_options = {} if options == None and not kwargs: # user is resetting options self.chart_options = {} else: if options == None: options = {} if kwargs: options.update(kwargs) _add_dict_to_dict(self.chart_options, options)
def add_state(self, state = None, **kwargs): if self._state == None: self._state = {} if state: _add_dict_to_dict(self._state, state) if kwargs: _add_dict_to_dict(self._state, kwargs)
def add_div_styles(self, style_dict = None, **kwargs): """ pass styles for the chart div in a dictionary or as keyword arguments """ if self.div_styles == None: self.div_styles = {} if style_dict == None and not kwargs: # user is resetting styles self.div_styles = {} else: if style_dict == None: style_dict = {} if kwargs: style_dict.update(kwargs) _add_dict_to_dict(self.div_styles, style_dict)
def add_options(self, options = None, **kwargs): """ pass chart chart_options in a dictionary and/or as keyword arguments options that are nested javascript object properties can be indicated with dots. or underscores. For example, hAxis.direction be passed in these ways add_chart_options(hAxis_direction = 1) add_chart_options({'hAxis_direction': 1) add_chart_options({'hAxis.direction': 1) The full json notation can also be used: add_chart_options({'hAxis': {'direction': 1}}) """ if self._options == None: self._options = {} if options: _add_dict_to_dict(self._options, options) if kwargs: _add_dict_to_dict(self._options, kwargs)