Пример #1
0
    def __init__(self,
                 arg=None,
                 active=None,
                 activebgcolor=None,
                 bgcolor=None,
                 bordercolor=None,
                 borderwidth=None,
                 currentvalue=None,
                 font=None,
                 len=None,
                 lenmode=None,
                 minorticklen=None,
                 name=None,
                 pad=None,
                 steps=None,
                 stepdefaults=None,
                 templateitemname=None,
                 tickcolor=None,
                 ticklen=None,
                 tickwidth=None,
                 transition=None,
                 visible=None,
                 x=None,
                 xanchor=None,
                 y=None,
                 yanchor=None,
                 **kwargs):
        """
        Construct a new Slider object
        
        Parameters
        ----------
        arg
            dict of properties compatible with this constructor or
            an instance of plotly.graph_objs.layout.Slider
        active
            Determines which button (by index starting from 0) is
            considered active.
        activebgcolor
            Sets the background color of the slider grip while
            dragging.
        bgcolor
            Sets the background color of the slider.
        bordercolor
            Sets the color of the border enclosing the slider.
        borderwidth
            Sets the width (in px) of the border enclosing the
            slider.
        currentvalue
            plotly.graph_objs.layout.slider.Currentvalue instance
            or dict with compatible properties
        font
            Sets the font of the slider step labels.
        len
            Sets the length of the slider This measure excludes the
            padding of both ends. That is, the slider's length is
            this length minus the padding on both ends.
        lenmode
            Determines whether this slider length is set in units
            of plot "fraction" or in *pixels. Use `len` to set the
            value.
        minorticklen
            Sets the length in pixels of minor step tick marks
        name
            When used in a template, named items are created in the
            output figure in addition to any items the figure
            already has in this array. You can modify these items
            in the output figure by making your own item with
            `templateitemname` matching this `name` alongside your
            modifications (including `visible: false` or `enabled:
            false` to hide it). Has no effect outside of a
            template.
        pad
            Set the padding of the slider component along each
            side.
        steps
            plotly.graph_objs.layout.slider.Step instance or dict
            with compatible properties
        stepdefaults
            When used in a template (as
            layout.template.layout.slider.stepdefaults), sets the
            default property values to use for elements of
            layout.slider.steps
        templateitemname
            Used to refer to a named item in this array in the
            template. Named items from the template will be created
            even without a matching item in the input figure, but
            you can modify one by making an item with
            `templateitemname` matching its `name`, alongside your
            modifications (including `visible: false` or `enabled:
            false` to hide it). If there is no template or no
            matching item, this item will be hidden unless you
            explicitly show it with `visible: true`.
        tickcolor
            Sets the color of the border enclosing the slider.
        ticklen
            Sets the length in pixels of step tick marks
        tickwidth
            Sets the tick width (in px).
        transition
            plotly.graph_objs.layout.slider.Transition instance or
            dict with compatible properties
        visible
            Determines whether or not the slider is visible.
        x
            Sets the x position (in normalized coordinates) of the
            slider.
        xanchor
            Sets the slider's horizontal position anchor. This
            anchor binds the `x` position to the "left", "center"
            or "right" of the range selector.
        y
            Sets the y position (in normalized coordinates) of the
            slider.
        yanchor
            Sets the slider's vertical position anchor This anchor
            binds the `y` position to the "top", "middle" or
            "bottom" of the range selector.

        Returns
        -------
        Slider
        """
        super(Slider, self).__init__('sliders')

        # Validate arg
        # ------------
        if arg is None:
            arg = {}
        elif isinstance(arg, self.__class__):
            arg = arg.to_plotly_json()
        elif isinstance(arg, dict):
            arg = copy.copy(arg)
        else:
            raise ValueError("""\
The first argument to the plotly.graph_objs.layout.Slider 
constructor must be a dict or 
an instance of plotly.graph_objs.layout.Slider""")

        # Handle skip_invalid
        # -------------------
        self._skip_invalid = kwargs.pop('skip_invalid', False)

        # Import validators
        # -----------------
        from plotly.validators.layout import (slider as v_slider)

        # Initialize validators
        # ---------------------
        self._validators['active'] = v_slider.ActiveValidator()
        self._validators['activebgcolor'] = v_slider.ActivebgcolorValidator()
        self._validators['bgcolor'] = v_slider.BgcolorValidator()
        self._validators['bordercolor'] = v_slider.BordercolorValidator()
        self._validators['borderwidth'] = v_slider.BorderwidthValidator()
        self._validators['currentvalue'] = v_slider.CurrentvalueValidator()
        self._validators['font'] = v_slider.FontValidator()
        self._validators['len'] = v_slider.LenValidator()
        self._validators['lenmode'] = v_slider.LenmodeValidator()
        self._validators['minorticklen'] = v_slider.MinorticklenValidator()
        self._validators['name'] = v_slider.NameValidator()
        self._validators['pad'] = v_slider.PadValidator()
        self._validators['steps'] = v_slider.StepsValidator()
        self._validators['stepdefaults'] = v_slider.StepValidator()
        self._validators[
            'templateitemname'] = v_slider.TemplateitemnameValidator()
        self._validators['tickcolor'] = v_slider.TickcolorValidator()
        self._validators['ticklen'] = v_slider.TicklenValidator()
        self._validators['tickwidth'] = v_slider.TickwidthValidator()
        self._validators['transition'] = v_slider.TransitionValidator()
        self._validators['visible'] = v_slider.VisibleValidator()
        self._validators['x'] = v_slider.XValidator()
        self._validators['xanchor'] = v_slider.XanchorValidator()
        self._validators['y'] = v_slider.YValidator()
        self._validators['yanchor'] = v_slider.YanchorValidator()

        # Populate data dict with properties
        # ----------------------------------
        _v = arg.pop('active', None)
        self['active'] = active if active is not None else _v
        _v = arg.pop('activebgcolor', None)
        self[
            'activebgcolor'] = activebgcolor if activebgcolor is not None else _v
        _v = arg.pop('bgcolor', None)
        self['bgcolor'] = bgcolor if bgcolor is not None else _v
        _v = arg.pop('bordercolor', None)
        self['bordercolor'] = bordercolor if bordercolor is not None else _v
        _v = arg.pop('borderwidth', None)
        self['borderwidth'] = borderwidth if borderwidth is not None else _v
        _v = arg.pop('currentvalue', None)
        self['currentvalue'] = currentvalue if currentvalue is not None else _v
        _v = arg.pop('font', None)
        self['font'] = font if font is not None else _v
        _v = arg.pop('len', None)
        self['len'] = len if len is not None else _v
        _v = arg.pop('lenmode', None)
        self['lenmode'] = lenmode if lenmode is not None else _v
        _v = arg.pop('minorticklen', None)
        self['minorticklen'] = minorticklen if minorticklen is not None else _v
        _v = arg.pop('name', None)
        self['name'] = name if name is not None else _v
        _v = arg.pop('pad', None)
        self['pad'] = pad if pad is not None else _v
        _v = arg.pop('steps', None)
        self['steps'] = steps if steps is not None else _v
        _v = arg.pop('stepdefaults', None)
        self['stepdefaults'] = stepdefaults if stepdefaults is not None else _v
        _v = arg.pop('templateitemname', None)
        self[
            'templateitemname'] = templateitemname if templateitemname is not None else _v
        _v = arg.pop('tickcolor', None)
        self['tickcolor'] = tickcolor if tickcolor is not None else _v
        _v = arg.pop('ticklen', None)
        self['ticklen'] = ticklen if ticklen is not None else _v
        _v = arg.pop('tickwidth', None)
        self['tickwidth'] = tickwidth if tickwidth is not None else _v
        _v = arg.pop('transition', None)
        self['transition'] = transition if transition is not None else _v
        _v = arg.pop('visible', None)
        self['visible'] = visible if visible is not None else _v
        _v = arg.pop('x', None)
        self['x'] = x if x is not None else _v
        _v = arg.pop('xanchor', None)
        self['xanchor'] = xanchor if xanchor is not None else _v
        _v = arg.pop('y', None)
        self['y'] = y if y is not None else _v
        _v = arg.pop('yanchor', None)
        self['yanchor'] = yanchor if yanchor is not None else _v

        # Process unknown kwargs
        # ----------------------
        self._process_kwargs(**dict(arg, **kwargs))

        # Reset skip_invalid
        # ------------------
        self._skip_invalid = False
Пример #2
0
    def __init__(self,
                 arg=None,
                 active=None,
                 activebgcolor=None,
                 bgcolor=None,
                 bordercolor=None,
                 borderwidth=None,
                 currentvalue=None,
                 font=None,
                 len=None,
                 lenmode=None,
                 minorticklen=None,
                 pad=None,
                 steps=None,
                 tickcolor=None,
                 ticklen=None,
                 tickwidth=None,
                 transition=None,
                 visible=None,
                 x=None,
                 xanchor=None,
                 y=None,
                 yanchor=None,
                 **kwargs):
        """
        Construct a new Slider object
        
        Parameters
        ----------
        arg
            dict of properties compatible with this constructor or
            an instance of plotly.graph_objs.layout.Slider
        active
            Determines which button (by index starting from 0) is
            considered active.
        activebgcolor
            Sets the background color of the slider grip while
            dragging.
        bgcolor
            Sets the background color of the slider.
        bordercolor
            Sets the color of the border enclosing the slider.
        borderwidth
            Sets the width (in px) of the border enclosing the
            slider.
        currentvalue
            plotly.graph_objs.layout.slider.Currentvalue instance
            or dict with compatible properties
        font
            Sets the font of the slider step labels.
        len
            Sets the length of the slider This measure excludes the
            padding of both ends. That is, the slider's length is
            this length minus the padding on both ends.
        lenmode
            Determines whether this slider length is set in units
            of plot *fraction* or in *pixels. Use `len` to set the
            value.
        minorticklen
            Sets the length in pixels of minor step tick marks
        pad
            Set the padding of the slider component along each
            side.
        steps
            plotly.graph_objs.layout.slider.Step instance or dict
            with compatible properties
        tickcolor
            Sets the color of the border enclosing the slider.
        ticklen
            Sets the length in pixels of step tick marks
        tickwidth
            Sets the tick width (in px).
        transition
            plotly.graph_objs.layout.slider.Transition instance or
            dict with compatible properties
        visible
            Determines whether or not the slider is visible.
        x
            Sets the x position (in normalized coordinates) of the
            slider.
        xanchor
            Sets the slider's horizontal position anchor. This
            anchor binds the `x` position to the *left*, *center*
            or *right* of the range selector.
        y
            Sets the y position (in normalized coordinates) of the
            slider.
        yanchor
            Sets the slider's vertical position anchor This anchor
            binds the `y` position to the *top*, *middle* or
            *bottom* of the range selector.

        Returns
        -------
        Slider
        """
        super(Slider, self).__init__('sliders')

        # Validate arg
        # ------------
        if arg is None:
            arg = {}
        elif isinstance(arg, self.__class__):
            arg = arg.to_plotly_json()
        elif isinstance(arg, dict):
            arg = copy.copy(arg)
        else:
            raise ValueError("""\
The first argument to the plotly.graph_objs.layout.Slider 
constructor must be a dict or 
an instance of plotly.graph_objs.layout.Slider""")

        # Import validators
        # -----------------
        from plotly.validators.layout import (slider as v_slider)

        # Initialize validators
        # ---------------------
        self._validators['active'] = v_slider.ActiveValidator()
        self._validators['activebgcolor'] = v_slider.ActivebgcolorValidator()
        self._validators['bgcolor'] = v_slider.BgcolorValidator()
        self._validators['bordercolor'] = v_slider.BordercolorValidator()
        self._validators['borderwidth'] = v_slider.BorderwidthValidator()
        self._validators['currentvalue'] = v_slider.CurrentvalueValidator()
        self._validators['font'] = v_slider.FontValidator()
        self._validators['len'] = v_slider.LenValidator()
        self._validators['lenmode'] = v_slider.LenmodeValidator()
        self._validators['minorticklen'] = v_slider.MinorticklenValidator()
        self._validators['pad'] = v_slider.PadValidator()
        self._validators['steps'] = v_slider.StepsValidator()
        self._validators['tickcolor'] = v_slider.TickcolorValidator()
        self._validators['ticklen'] = v_slider.TicklenValidator()
        self._validators['tickwidth'] = v_slider.TickwidthValidator()
        self._validators['transition'] = v_slider.TransitionValidator()
        self._validators['visible'] = v_slider.VisibleValidator()
        self._validators['x'] = v_slider.XValidator()
        self._validators['xanchor'] = v_slider.XanchorValidator()
        self._validators['y'] = v_slider.YValidator()
        self._validators['yanchor'] = v_slider.YanchorValidator()

        # Populate data dict with properties
        # ----------------------------------
        v = arg.pop('active', None)
        self.active = active if active is not None else v
        v = arg.pop('activebgcolor', None)
        self.activebgcolor = activebgcolor if activebgcolor is not None else v
        v = arg.pop('bgcolor', None)
        self.bgcolor = bgcolor if bgcolor is not None else v
        v = arg.pop('bordercolor', None)
        self.bordercolor = bordercolor if bordercolor is not None else v
        v = arg.pop('borderwidth', None)
        self.borderwidth = borderwidth if borderwidth is not None else v
        v = arg.pop('currentvalue', None)
        self.currentvalue = currentvalue if currentvalue is not None else v
        v = arg.pop('font', None)
        self.font = font if font is not None else v
        v = arg.pop('len', None)
        self.len = len if len is not None else v
        v = arg.pop('lenmode', None)
        self.lenmode = lenmode if lenmode is not None else v
        v = arg.pop('minorticklen', None)
        self.minorticklen = minorticklen if minorticklen is not None else v
        v = arg.pop('pad', None)
        self.pad = pad if pad is not None else v
        v = arg.pop('steps', None)
        self.steps = steps if steps is not None else v
        v = arg.pop('tickcolor', None)
        self.tickcolor = tickcolor if tickcolor is not None else v
        v = arg.pop('ticklen', None)
        self.ticklen = ticklen if ticklen is not None else v
        v = arg.pop('tickwidth', None)
        self.tickwidth = tickwidth if tickwidth is not None else v
        v = arg.pop('transition', None)
        self.transition = transition if transition is not None else v
        v = arg.pop('visible', None)
        self.visible = visible if visible is not None else v
        v = arg.pop('x', None)
        self.x = x if x is not None else v
        v = arg.pop('xanchor', None)
        self.xanchor = xanchor if xanchor is not None else v
        v = arg.pop('y', None)
        self.y = y if y is not None else v
        v = arg.pop('yanchor', None)
        self.yanchor = yanchor if yanchor is not None else v

        # Process unknown kwargs
        # ----------------------
        self._process_kwargs(**dict(arg, **kwargs))