1from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
2import copy as _copy
3
4
5class Rangeselector(_BaseLayoutHierarchyType):
6
7    # class properties
8    # --------------------
9    _parent_path_str = "layout.xaxis"
10    _path_str = "layout.xaxis.rangeselector"
11    _valid_props = {
12        "activecolor",
13        "bgcolor",
14        "bordercolor",
15        "borderwidth",
16        "buttondefaults",
17        "buttons",
18        "font",
19        "visible",
20        "x",
21        "xanchor",
22        "y",
23        "yanchor",
24    }
25
26    # activecolor
27    # -----------
28    @property
29    def activecolor(self):
30        """
31        Sets the background color of the active range selector button.
32
33        The 'activecolor' property is a color and may be specified as:
34          - A hex string (e.g. '#ff0000')
35          - An rgb/rgba string (e.g. 'rgb(255,0,0)')
36          - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
37          - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
38          - A named CSS color:
39                aliceblue, antiquewhite, aqua, aquamarine, azure,
40                beige, bisque, black, blanchedalmond, blue,
41                blueviolet, brown, burlywood, cadetblue,
42                chartreuse, chocolate, coral, cornflowerblue,
43                cornsilk, crimson, cyan, darkblue, darkcyan,
44                darkgoldenrod, darkgray, darkgrey, darkgreen,
45                darkkhaki, darkmagenta, darkolivegreen, darkorange,
46                darkorchid, darkred, darksalmon, darkseagreen,
47                darkslateblue, darkslategray, darkslategrey,
48                darkturquoise, darkviolet, deeppink, deepskyblue,
49                dimgray, dimgrey, dodgerblue, firebrick,
50                floralwhite, forestgreen, fuchsia, gainsboro,
51                ghostwhite, gold, goldenrod, gray, grey, green,
52                greenyellow, honeydew, hotpink, indianred, indigo,
53                ivory, khaki, lavender, lavenderblush, lawngreen,
54                lemonchiffon, lightblue, lightcoral, lightcyan,
55                lightgoldenrodyellow, lightgray, lightgrey,
56                lightgreen, lightpink, lightsalmon, lightseagreen,
57                lightskyblue, lightslategray, lightslategrey,
58                lightsteelblue, lightyellow, lime, limegreen,
59                linen, magenta, maroon, mediumaquamarine,
60                mediumblue, mediumorchid, mediumpurple,
61                mediumseagreen, mediumslateblue, mediumspringgreen,
62                mediumturquoise, mediumvioletred, midnightblue,
63                mintcream, mistyrose, moccasin, navajowhite, navy,
64                oldlace, olive, olivedrab, orange, orangered,
65                orchid, palegoldenrod, palegreen, paleturquoise,
66                palevioletred, papayawhip, peachpuff, peru, pink,
67                plum, powderblue, purple, red, rosybrown,
68                royalblue, rebeccapurple, saddlebrown, salmon,
69                sandybrown, seagreen, seashell, sienna, silver,
70                skyblue, slateblue, slategray, slategrey, snow,
71                springgreen, steelblue, tan, teal, thistle, tomato,
72                turquoise, violet, wheat, white, whitesmoke,
73                yellow, yellowgreen
74
75        Returns
76        -------
77        str
78        """
79        return self["activecolor"]
80
81    @activecolor.setter
82    def activecolor(self, val):
83        self["activecolor"] = val
84
85    # bgcolor
86    # -------
87    @property
88    def bgcolor(self):
89        """
90        Sets the background color of the range selector buttons.
91
92        The 'bgcolor' property is a color and may be specified as:
93          - A hex string (e.g. '#ff0000')
94          - An rgb/rgba string (e.g. 'rgb(255,0,0)')
95          - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
96          - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
97          - A named CSS color:
98                aliceblue, antiquewhite, aqua, aquamarine, azure,
99                beige, bisque, black, blanchedalmond, blue,
100                blueviolet, brown, burlywood, cadetblue,
101                chartreuse, chocolate, coral, cornflowerblue,
102                cornsilk, crimson, cyan, darkblue, darkcyan,
103                darkgoldenrod, darkgray, darkgrey, darkgreen,
104                darkkhaki, darkmagenta, darkolivegreen, darkorange,
105                darkorchid, darkred, darksalmon, darkseagreen,
106                darkslateblue, darkslategray, darkslategrey,
107                darkturquoise, darkviolet, deeppink, deepskyblue,
108                dimgray, dimgrey, dodgerblue, firebrick,
109                floralwhite, forestgreen, fuchsia, gainsboro,
110                ghostwhite, gold, goldenrod, gray, grey, green,
111                greenyellow, honeydew, hotpink, indianred, indigo,
112                ivory, khaki, lavender, lavenderblush, lawngreen,
113                lemonchiffon, lightblue, lightcoral, lightcyan,
114                lightgoldenrodyellow, lightgray, lightgrey,
115                lightgreen, lightpink, lightsalmon, lightseagreen,
116                lightskyblue, lightslategray, lightslategrey,
117                lightsteelblue, lightyellow, lime, limegreen,
118                linen, magenta, maroon, mediumaquamarine,
119                mediumblue, mediumorchid, mediumpurple,
120                mediumseagreen, mediumslateblue, mediumspringgreen,
121                mediumturquoise, mediumvioletred, midnightblue,
122                mintcream, mistyrose, moccasin, navajowhite, navy,
123                oldlace, olive, olivedrab, orange, orangered,
124                orchid, palegoldenrod, palegreen, paleturquoise,
125                palevioletred, papayawhip, peachpuff, peru, pink,
126                plum, powderblue, purple, red, rosybrown,
127                royalblue, rebeccapurple, saddlebrown, salmon,
128                sandybrown, seagreen, seashell, sienna, silver,
129                skyblue, slateblue, slategray, slategrey, snow,
130                springgreen, steelblue, tan, teal, thistle, tomato,
131                turquoise, violet, wheat, white, whitesmoke,
132                yellow, yellowgreen
133
134        Returns
135        -------
136        str
137        """
138        return self["bgcolor"]
139
140    @bgcolor.setter
141    def bgcolor(self, val):
142        self["bgcolor"] = val
143
144    # bordercolor
145    # -----------
146    @property
147    def bordercolor(self):
148        """
149        Sets the color of the border enclosing the range selector.
150
151        The 'bordercolor' property is a color and may be specified as:
152          - A hex string (e.g. '#ff0000')
153          - An rgb/rgba string (e.g. 'rgb(255,0,0)')
154          - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
155          - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
156          - A named CSS color:
157                aliceblue, antiquewhite, aqua, aquamarine, azure,
158                beige, bisque, black, blanchedalmond, blue,
159                blueviolet, brown, burlywood, cadetblue,
160                chartreuse, chocolate, coral, cornflowerblue,
161                cornsilk, crimson, cyan, darkblue, darkcyan,
162                darkgoldenrod, darkgray, darkgrey, darkgreen,
163                darkkhaki, darkmagenta, darkolivegreen, darkorange,
164                darkorchid, darkred, darksalmon, darkseagreen,
165                darkslateblue, darkslategray, darkslategrey,
166                darkturquoise, darkviolet, deeppink, deepskyblue,
167                dimgray, dimgrey, dodgerblue, firebrick,
168                floralwhite, forestgreen, fuchsia, gainsboro,
169                ghostwhite, gold, goldenrod, gray, grey, green,
170                greenyellow, honeydew, hotpink, indianred, indigo,
171                ivory, khaki, lavender, lavenderblush, lawngreen,
172                lemonchiffon, lightblue, lightcoral, lightcyan,
173                lightgoldenrodyellow, lightgray, lightgrey,
174                lightgreen, lightpink, lightsalmon, lightseagreen,
175                lightskyblue, lightslategray, lightslategrey,
176                lightsteelblue, lightyellow, lime, limegreen,
177                linen, magenta, maroon, mediumaquamarine,
178                mediumblue, mediumorchid, mediumpurple,
179                mediumseagreen, mediumslateblue, mediumspringgreen,
180                mediumturquoise, mediumvioletred, midnightblue,
181                mintcream, mistyrose, moccasin, navajowhite, navy,
182                oldlace, olive, olivedrab, orange, orangered,
183                orchid, palegoldenrod, palegreen, paleturquoise,
184                palevioletred, papayawhip, peachpuff, peru, pink,
185                plum, powderblue, purple, red, rosybrown,
186                royalblue, rebeccapurple, saddlebrown, salmon,
187                sandybrown, seagreen, seashell, sienna, silver,
188                skyblue, slateblue, slategray, slategrey, snow,
189                springgreen, steelblue, tan, teal, thistle, tomato,
190                turquoise, violet, wheat, white, whitesmoke,
191                yellow, yellowgreen
192
193        Returns
194        -------
195        str
196        """
197        return self["bordercolor"]
198
199    @bordercolor.setter
200    def bordercolor(self, val):
201        self["bordercolor"] = val
202
203    # borderwidth
204    # -----------
205    @property
206    def borderwidth(self):
207        """
208        Sets the width (in px) of the border enclosing the range
209        selector.
210
211        The 'borderwidth' property is a number and may be specified as:
212          - An int or float in the interval [0, inf]
213
214        Returns
215        -------
216        int|float
217        """
218        return self["borderwidth"]
219
220    @borderwidth.setter
221    def borderwidth(self, val):
222        self["borderwidth"] = val
223
224    # buttons
225    # -------
226    @property
227    def buttons(self):
228        """
229        Sets the specifications for each buttons. By default, a range
230        selector comes with no buttons.
231
232        The 'buttons' property is a tuple of instances of
233        Button that may be specified as:
234          - A list or tuple of instances of plotly.graph_objs.layout.xaxis.rangeselector.Button
235          - A list or tuple of dicts of string/value properties that
236            will be passed to the Button constructor
237
238            Supported dict properties:
239
240                count
241                    Sets the number of steps to take to update the
242                    range. Use with `step` to specify the update
243                    interval.
244                label
245                    Sets the text label to appear on the button.
246                name
247                    When used in a template, named items are
248                    created in the output figure in addition to any
249                    items the figure already has in this array. You
250                    can modify these items in the output figure by
251                    making your own item with `templateitemname`
252                    matching this `name` alongside your
253                    modifications (including `visible: false` or
254                    `enabled: false` to hide it). Has no effect
255                    outside of a template.
256                step
257                    The unit of measurement that the `count` value
258                    will set the range by.
259                stepmode
260                    Sets the range update mode. If "backward", the
261                    range update shifts the start of range back
262                    "count" times "step" milliseconds. If "todate",
263                    the range update shifts the start of range back
264                    to the first timestamp from "count" times
265                    "step" milliseconds back. For example, with
266                    `step` set to "year" and `count` set to 1 the
267                    range update shifts the start of the range back
268                    to January 01 of the current year. Month and
269                    year "todate" are currently available only for
270                    the built-in (Gregorian) calendar.
271                templateitemname
272                    Used to refer to a named item in this array in
273                    the template. Named items from the template
274                    will be created even without a matching item in
275                    the input figure, but you can modify one by
276                    making an item with `templateitemname` matching
277                    its `name`, alongside your modifications
278                    (including `visible: false` or `enabled: false`
279                    to hide it). If there is no template or no
280                    matching item, this item will be hidden unless
281                    you explicitly show it with `visible: true`.
282                visible
283                    Determines whether or not this button is
284                    visible.
285
286        Returns
287        -------
288        tuple[plotly.graph_objs.layout.xaxis.rangeselector.Button]
289        """
290        return self["buttons"]
291
292    @buttons.setter
293    def buttons(self, val):
294        self["buttons"] = val
295
296    # buttondefaults
297    # --------------
298    @property
299    def buttondefaults(self):
300        """
301        When used in a template (as
302        layout.template.layout.xaxis.rangeselector.buttondefaults),
303        sets the default property values to use for elements of
304        layout.xaxis.rangeselector.buttons
305
306        The 'buttondefaults' property is an instance of Button
307        that may be specified as:
308          - An instance of :class:`plotly.graph_objs.layout.xaxis.rangeselector.Button`
309          - A dict of string/value properties that will be passed
310            to the Button constructor
311
312            Supported dict properties:
313
314        Returns
315        -------
316        plotly.graph_objs.layout.xaxis.rangeselector.Button
317        """
318        return self["buttondefaults"]
319
320    @buttondefaults.setter
321    def buttondefaults(self, val):
322        self["buttondefaults"] = val
323
324    # font
325    # ----
326    @property
327    def font(self):
328        """
329        Sets the font of the range selector button text.
330
331        The 'font' property is an instance of Font
332        that may be specified as:
333          - An instance of :class:`plotly.graph_objs.layout.xaxis.rangeselector.Font`
334          - A dict of string/value properties that will be passed
335            to the Font constructor
336
337            Supported dict properties:
338
339                color
340
341                family
342                    HTML font family - the typeface that will be
343                    applied by the web browser. The web browser
344                    will only be able to apply a font if it is
345                    available on the system which it operates.
346                    Provide multiple font families, separated by
347                    commas, to indicate the preference in which to
348                    apply fonts if they aren't available on the
349                    system. The Chart Studio Cloud (at
350                    https://chart-studio.plotly.com or on-premise)
351                    generates images on a server, where only a
352                    select number of fonts are installed and
353                    supported. These include "Arial", "Balto",
354                    "Courier New", "Droid Sans",, "Droid Serif",
355                    "Droid Sans Mono", "Gravitas One", "Old
356                    Standard TT", "Open Sans", "Overpass", "PT Sans
357                    Narrow", "Raleway", "Times New Roman".
358                size
359
360        Returns
361        -------
362        plotly.graph_objs.layout.xaxis.rangeselector.Font
363        """
364        return self["font"]
365
366    @font.setter
367    def font(self, val):
368        self["font"] = val
369
370    # visible
371    # -------
372    @property
373    def visible(self):
374        """
375        Determines whether or not this range selector is visible. Note
376        that range selectors are only available for x axes of `type`
377        set to or auto-typed to "date".
378
379        The 'visible' property must be specified as a bool
380        (either True, or False)
381
382        Returns
383        -------
384        bool
385        """
386        return self["visible"]
387
388    @visible.setter
389    def visible(self, val):
390        self["visible"] = val
391
392    # x
393    # -
394    @property
395    def x(self):
396        """
397        Sets the x position (in normalized coordinates) of the range
398        selector.
399
400        The 'x' property is a number and may be specified as:
401          - An int or float in the interval [-2, 3]
402
403        Returns
404        -------
405        int|float
406        """
407        return self["x"]
408
409    @x.setter
410    def x(self, val):
411        self["x"] = val
412
413    # xanchor
414    # -------
415    @property
416    def xanchor(self):
417        """
418        Sets the range selector's horizontal position anchor. This
419        anchor binds the `x` position to the "left", "center" or
420        "right" of the range selector.
421
422        The 'xanchor' property is an enumeration that may be specified as:
423          - One of the following enumeration values:
424                ['auto', 'left', 'center', 'right']
425
426        Returns
427        -------
428        Any
429        """
430        return self["xanchor"]
431
432    @xanchor.setter
433    def xanchor(self, val):
434        self["xanchor"] = val
435
436    # y
437    # -
438    @property
439    def y(self):
440        """
441        Sets the y position (in normalized coordinates) of the range
442        selector.
443
444        The 'y' property is a number and may be specified as:
445          - An int or float in the interval [-2, 3]
446
447        Returns
448        -------
449        int|float
450        """
451        return self["y"]
452
453    @y.setter
454    def y(self, val):
455        self["y"] = val
456
457    # yanchor
458    # -------
459    @property
460    def yanchor(self):
461        """
462        Sets the range selector's vertical position anchor This anchor
463        binds the `y` position to the "top", "middle" or "bottom" of
464        the range selector.
465
466        The 'yanchor' property is an enumeration that may be specified as:
467          - One of the following enumeration values:
468                ['auto', 'top', 'middle', 'bottom']
469
470        Returns
471        -------
472        Any
473        """
474        return self["yanchor"]
475
476    @yanchor.setter
477    def yanchor(self, val):
478        self["yanchor"] = val
479
480    # Self properties description
481    # ---------------------------
482    @property
483    def _prop_descriptions(self):
484        return """\
485        activecolor
486            Sets the background color of the active range selector
487            button.
488        bgcolor
489            Sets the background color of the range selector
490            buttons.
491        bordercolor
492            Sets the color of the border enclosing the range
493            selector.
494        borderwidth
495            Sets the width (in px) of the border enclosing the
496            range selector.
497        buttons
498            Sets the specifications for each buttons. By default, a
499            range selector comes with no buttons.
500        buttondefaults
501            When used in a template (as layout.template.layout.xaxi
502            s.rangeselector.buttondefaults), sets the default
503            property values to use for elements of
504            layout.xaxis.rangeselector.buttons
505        font
506            Sets the font of the range selector button text.
507        visible
508            Determines whether or not this range selector is
509            visible. Note that range selectors are only available
510            for x axes of `type` set to or auto-typed to "date".
511        x
512            Sets the x position (in normalized coordinates) of the
513            range selector.
514        xanchor
515            Sets the range selector's horizontal position anchor.
516            This anchor binds the `x` position to the "left",
517            "center" or "right" of the range selector.
518        y
519            Sets the y position (in normalized coordinates) of the
520            range selector.
521        yanchor
522            Sets the range selector's vertical position anchor This
523            anchor binds the `y` position to the "top", "middle" or
524            "bottom" of the range selector.
525        """
526
527    def __init__(
528        self,
529        arg=None,
530        activecolor=None,
531        bgcolor=None,
532        bordercolor=None,
533        borderwidth=None,
534        buttons=None,
535        buttondefaults=None,
536        font=None,
537        visible=None,
538        x=None,
539        xanchor=None,
540        y=None,
541        yanchor=None,
542        **kwargs
543    ):
544        """
545        Construct a new Rangeselector object
546
547        Parameters
548        ----------
549        arg
550            dict of properties compatible with this constructor or
551            an instance of
552            :class:`plotly.graph_objs.layout.xaxis.Rangeselector`
553        activecolor
554            Sets the background color of the active range selector
555            button.
556        bgcolor
557            Sets the background color of the range selector
558            buttons.
559        bordercolor
560            Sets the color of the border enclosing the range
561            selector.
562        borderwidth
563            Sets the width (in px) of the border enclosing the
564            range selector.
565        buttons
566            Sets the specifications for each buttons. By default, a
567            range selector comes with no buttons.
568        buttondefaults
569            When used in a template (as layout.template.layout.xaxi
570            s.rangeselector.buttondefaults), sets the default
571            property values to use for elements of
572            layout.xaxis.rangeselector.buttons
573        font
574            Sets the font of the range selector button text.
575        visible
576            Determines whether or not this range selector is
577            visible. Note that range selectors are only available
578            for x axes of `type` set to or auto-typed to "date".
579        x
580            Sets the x position (in normalized coordinates) of the
581            range selector.
582        xanchor
583            Sets the range selector's horizontal position anchor.
584            This anchor binds the `x` position to the "left",
585            "center" or "right" of the range selector.
586        y
587            Sets the y position (in normalized coordinates) of the
588            range selector.
589        yanchor
590            Sets the range selector's vertical position anchor This
591            anchor binds the `y` position to the "top", "middle" or
592            "bottom" of the range selector.
593
594        Returns
595        -------
596        Rangeselector
597        """
598        super(Rangeselector, self).__init__("rangeselector")
599
600        if "_parent" in kwargs:
601            self._parent = kwargs["_parent"]
602            return
603
604        # Validate arg
605        # ------------
606        if arg is None:
607            arg = {}
608        elif isinstance(arg, self.__class__):
609            arg = arg.to_plotly_json()
610        elif isinstance(arg, dict):
611            arg = _copy.copy(arg)
612        else:
613            raise ValueError(
614                """\
615The first argument to the plotly.graph_objs.layout.xaxis.Rangeselector
616constructor must be a dict or
617an instance of :class:`plotly.graph_objs.layout.xaxis.Rangeselector`"""
618            )
619
620        # Handle skip_invalid
621        # -------------------
622        self._skip_invalid = kwargs.pop("skip_invalid", False)
623        self._validate = kwargs.pop("_validate", True)
624
625        # Populate data dict with properties
626        # ----------------------------------
627        _v = arg.pop("activecolor", None)
628        _v = activecolor if activecolor is not None else _v
629        if _v is not None:
630            self["activecolor"] = _v
631        _v = arg.pop("bgcolor", None)
632        _v = bgcolor if bgcolor is not None else _v
633        if _v is not None:
634            self["bgcolor"] = _v
635        _v = arg.pop("bordercolor", None)
636        _v = bordercolor if bordercolor is not None else _v
637        if _v is not None:
638            self["bordercolor"] = _v
639        _v = arg.pop("borderwidth", None)
640        _v = borderwidth if borderwidth is not None else _v
641        if _v is not None:
642            self["borderwidth"] = _v
643        _v = arg.pop("buttons", None)
644        _v = buttons if buttons is not None else _v
645        if _v is not None:
646            self["buttons"] = _v
647        _v = arg.pop("buttondefaults", None)
648        _v = buttondefaults if buttondefaults is not None else _v
649        if _v is not None:
650            self["buttondefaults"] = _v
651        _v = arg.pop("font", None)
652        _v = font if font is not None else _v
653        if _v is not None:
654            self["font"] = _v
655        _v = arg.pop("visible", None)
656        _v = visible if visible is not None else _v
657        if _v is not None:
658            self["visible"] = _v
659        _v = arg.pop("x", None)
660        _v = x if x is not None else _v
661        if _v is not None:
662            self["x"] = _v
663        _v = arg.pop("xanchor", None)
664        _v = xanchor if xanchor is not None else _v
665        if _v is not None:
666            self["xanchor"] = _v
667        _v = arg.pop("y", None)
668        _v = y if y is not None else _v
669        if _v is not None:
670            self["y"] = _v
671        _v = arg.pop("yanchor", None)
672        _v = yanchor if yanchor is not None else _v
673        if _v is not None:
674            self["yanchor"] = _v
675
676        # Process unknown kwargs
677        # ----------------------
678        self._process_kwargs(**dict(arg, **kwargs))
679
680        # Reset skip_invalid
681        # ------------------
682        self._skip_invalid = False
683