1from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
2import copy as _copy
3
4
5class Dimension(_BaseTraceHierarchyType):
6
7    # class properties
8    # --------------------
9    _parent_path_str = "parcoords"
10    _path_str = "parcoords.dimension"
11    _valid_props = {
12        "constraintrange",
13        "label",
14        "multiselect",
15        "name",
16        "range",
17        "templateitemname",
18        "tickformat",
19        "ticktext",
20        "ticktextsrc",
21        "tickvals",
22        "tickvalssrc",
23        "values",
24        "valuessrc",
25        "visible",
26    }
27
28    # constraintrange
29    # ---------------
30    @property
31    def constraintrange(self):
32        """
33        The domain range to which the filter on the dimension is
34        constrained. Must be an array of `[fromValue, toValue]` with
35        `fromValue <= toValue`, or if `multiselect` is not disabled,
36        you may give an array of arrays, where each inner array is
37        `[fromValue, toValue]`.
38
39        The 'constraintrange' property is an info array that may be specified as:
40
41        * a list or tuple of 2 elements where:
42    (0) The 'constraintrange[0]' property is a number and may be specified as:
43          - An int or float
44    (1) The 'constraintrange[1]' property is a number and may be specified as:
45          - An int or float
46
47        * a 2D list where:
48    (0) The 'constraintrange[i][0]' property is a number and may be specified as:
49          - An int or float
50    (1) The 'constraintrange[i][1]' property is a number and may be specified as:
51          - An int or float
52
53        Returns
54        -------
55        list
56        """
57        return self["constraintrange"]
58
59    @constraintrange.setter
60    def constraintrange(self, val):
61        self["constraintrange"] = val
62
63    # label
64    # -----
65    @property
66    def label(self):
67        """
68        The shown name of the dimension.
69
70        The 'label' property is a string and must be specified as:
71          - A string
72          - A number that will be converted to a string
73
74        Returns
75        -------
76        str
77        """
78        return self["label"]
79
80    @label.setter
81    def label(self, val):
82        self["label"] = val
83
84    # multiselect
85    # -----------
86    @property
87    def multiselect(self):
88        """
89        Do we allow multiple selection ranges or just a single range?
90
91        The 'multiselect' property must be specified as a bool
92        (either True, or False)
93
94        Returns
95        -------
96        bool
97        """
98        return self["multiselect"]
99
100    @multiselect.setter
101    def multiselect(self, val):
102        self["multiselect"] = val
103
104    # name
105    # ----
106    @property
107    def name(self):
108        """
109        When used in a template, named items are created in the output
110        figure in addition to any items the figure already has in this
111        array. You can modify these items in the output figure by
112        making your own item with `templateitemname` matching this
113        `name` alongside your modifications (including `visible: false`
114        or `enabled: false` to hide it). Has no effect outside of a
115        template.
116
117        The 'name' property is a string and must be specified as:
118          - A string
119          - A number that will be converted to a string
120
121        Returns
122        -------
123        str
124        """
125        return self["name"]
126
127    @name.setter
128    def name(self, val):
129        self["name"] = val
130
131    # range
132    # -----
133    @property
134    def range(self):
135        """
136        The domain range that represents the full, shown axis extent.
137        Defaults to the `values` extent. Must be an array of
138        `[fromValue, toValue]` with finite numbers as elements.
139
140        The 'range' property is an info array that may be specified as:
141
142        * a list or tuple of 2 elements where:
143    (0) The 'range[0]' property is a number and may be specified as:
144          - An int or float
145    (1) The 'range[1]' property is a number and may be specified as:
146          - An int or float
147
148        Returns
149        -------
150        list
151        """
152        return self["range"]
153
154    @range.setter
155    def range(self, val):
156        self["range"] = val
157
158    # templateitemname
159    # ----------------
160    @property
161    def templateitemname(self):
162        """
163        Used to refer to a named item in this array in the template.
164        Named items from the template will be created even without a
165        matching item in the input figure, but you can modify one by
166        making an item with `templateitemname` matching its `name`,
167        alongside your modifications (including `visible: false` or
168        `enabled: false` to hide it). If there is no template or no
169        matching item, this item will be hidden unless you explicitly
170        show it with `visible: true`.
171
172        The 'templateitemname' property is a string and must be specified as:
173          - A string
174          - A number that will be converted to a string
175
176        Returns
177        -------
178        str
179        """
180        return self["templateitemname"]
181
182    @templateitemname.setter
183    def templateitemname(self, val):
184        self["templateitemname"] = val
185
186    # tickformat
187    # ----------
188    @property
189    def tickformat(self):
190        """
191        Sets the tick label formatting rule using d3 formatting mini-
192        languages which are very similar to those in Python. For
193        numbers, see: https://github.com/d3/d3-3.x-api-
194        reference/blob/master/Formatting.md#d3_format And for dates
195        see: https://github.com/d3/d3-time-format#locale_format We add
196        one item to d3's date formatter: "%{n}f" for fractional seconds
197        with n digits. For example, *2016-10-13 09:15:23.456* with
198        tickformat "%H~%M~%S.%2f" would display "09~15~23.46"
199
200        The 'tickformat' property is a string and must be specified as:
201          - A string
202          - A number that will be converted to a string
203
204        Returns
205        -------
206        str
207        """
208        return self["tickformat"]
209
210    @tickformat.setter
211    def tickformat(self, val):
212        self["tickformat"] = val
213
214    # ticktext
215    # --------
216    @property
217    def ticktext(self):
218        """
219        Sets the text displayed at the ticks position via `tickvals`.
220
221        The 'ticktext' property is an array that may be specified as a tuple,
222        list, numpy array, or pandas Series
223
224        Returns
225        -------
226        numpy.ndarray
227        """
228        return self["ticktext"]
229
230    @ticktext.setter
231    def ticktext(self, val):
232        self["ticktext"] = val
233
234    # ticktextsrc
235    # -----------
236    @property
237    def ticktextsrc(self):
238        """
239        Sets the source reference on Chart Studio Cloud for  ticktext .
240
241        The 'ticktextsrc' property must be specified as a string or
242        as a plotly.grid_objs.Column object
243
244        Returns
245        -------
246        str
247        """
248        return self["ticktextsrc"]
249
250    @ticktextsrc.setter
251    def ticktextsrc(self, val):
252        self["ticktextsrc"] = val
253
254    # tickvals
255    # --------
256    @property
257    def tickvals(self):
258        """
259        Sets the values at which ticks on this axis appear.
260
261        The 'tickvals' property is an array that may be specified as a tuple,
262        list, numpy array, or pandas Series
263
264        Returns
265        -------
266        numpy.ndarray
267        """
268        return self["tickvals"]
269
270    @tickvals.setter
271    def tickvals(self, val):
272        self["tickvals"] = val
273
274    # tickvalssrc
275    # -----------
276    @property
277    def tickvalssrc(self):
278        """
279        Sets the source reference on Chart Studio Cloud for  tickvals .
280
281        The 'tickvalssrc' property must be specified as a string or
282        as a plotly.grid_objs.Column object
283
284        Returns
285        -------
286        str
287        """
288        return self["tickvalssrc"]
289
290    @tickvalssrc.setter
291    def tickvalssrc(self, val):
292        self["tickvalssrc"] = val
293
294    # values
295    # ------
296    @property
297    def values(self):
298        """
299        Dimension values. `values[n]` represents the value of the `n`th
300        point in the dataset, therefore the `values` vector for all
301        dimensions must be the same (longer vectors will be truncated).
302        Each value must be a finite number.
303
304        The 'values' property is an array that may be specified as a tuple,
305        list, numpy array, or pandas Series
306
307        Returns
308        -------
309        numpy.ndarray
310        """
311        return self["values"]
312
313    @values.setter
314    def values(self, val):
315        self["values"] = val
316
317    # valuessrc
318    # ---------
319    @property
320    def valuessrc(self):
321        """
322        Sets the source reference on Chart Studio Cloud for  values .
323
324        The 'valuessrc' property must be specified as a string or
325        as a plotly.grid_objs.Column object
326
327        Returns
328        -------
329        str
330        """
331        return self["valuessrc"]
332
333    @valuessrc.setter
334    def valuessrc(self, val):
335        self["valuessrc"] = val
336
337    # visible
338    # -------
339    @property
340    def visible(self):
341        """
342        Shows the dimension when set to `true` (the default). Hides the
343        dimension for `false`.
344
345        The 'visible' property must be specified as a bool
346        (either True, or False)
347
348        Returns
349        -------
350        bool
351        """
352        return self["visible"]
353
354    @visible.setter
355    def visible(self, val):
356        self["visible"] = val
357
358    # Self properties description
359    # ---------------------------
360    @property
361    def _prop_descriptions(self):
362        return """\
363        constraintrange
364            The domain range to which the filter on the dimension
365            is constrained. Must be an array of `[fromValue,
366            toValue]` with `fromValue <= toValue`, or if
367            `multiselect` is not disabled, you may give an array of
368            arrays, where each inner array is `[fromValue,
369            toValue]`.
370        label
371            The shown name of the dimension.
372        multiselect
373            Do we allow multiple selection ranges or just a single
374            range?
375        name
376            When used in a template, named items are created in the
377            output figure in addition to any items the figure
378            already has in this array. You can modify these items
379            in the output figure by making your own item with
380            `templateitemname` matching this `name` alongside your
381            modifications (including `visible: false` or `enabled:
382            false` to hide it). Has no effect outside of a
383            template.
384        range
385            The domain range that represents the full, shown axis
386            extent. Defaults to the `values` extent. Must be an
387            array of `[fromValue, toValue]` with finite numbers as
388            elements.
389        templateitemname
390            Used to refer to a named item in this array in the
391            template. Named items from the template will be created
392            even without a matching item in the input figure, but
393            you can modify one by making an item with
394            `templateitemname` matching its `name`, alongside your
395            modifications (including `visible: false` or `enabled:
396            false` to hide it). If there is no template or no
397            matching item, this item will be hidden unless you
398            explicitly show it with `visible: true`.
399        tickformat
400            Sets the tick label formatting rule using d3 formatting
401            mini-languages which are very similar to those in
402            Python. For numbers, see:
403            https://github.com/d3/d3-3.x-api-
404            reference/blob/master/Formatting.md#d3_format And for
405            dates see: https://github.com/d3/d3-time-
406            format#locale_format We add one item to d3's date
407            formatter: "%{n}f" for fractional seconds with n
408            digits. For example, *2016-10-13 09:15:23.456* with
409            tickformat "%H~%M~%S.%2f" would display "09~15~23.46"
410        ticktext
411            Sets the text displayed at the ticks position via
412            `tickvals`.
413        ticktextsrc
414            Sets the source reference on Chart Studio Cloud for
415            ticktext .
416        tickvals
417            Sets the values at which ticks on this axis appear.
418        tickvalssrc
419            Sets the source reference on Chart Studio Cloud for
420            tickvals .
421        values
422            Dimension values. `values[n]` represents the value of
423            the `n`th point in the dataset, therefore the `values`
424            vector for all dimensions must be the same (longer
425            vectors will be truncated). Each value must be a finite
426            number.
427        valuessrc
428            Sets the source reference on Chart Studio Cloud for
429            values .
430        visible
431            Shows the dimension when set to `true` (the default).
432            Hides the dimension for `false`.
433        """
434
435    def __init__(
436        self,
437        arg=None,
438        constraintrange=None,
439        label=None,
440        multiselect=None,
441        name=None,
442        range=None,
443        templateitemname=None,
444        tickformat=None,
445        ticktext=None,
446        ticktextsrc=None,
447        tickvals=None,
448        tickvalssrc=None,
449        values=None,
450        valuessrc=None,
451        visible=None,
452        **kwargs
453    ):
454        """
455        Construct a new Dimension object
456
457        The dimensions (variables) of the parallel coordinates chart.
458        2..60 dimensions are supported.
459
460        Parameters
461        ----------
462        arg
463            dict of properties compatible with this constructor or
464            an instance of
465            :class:`plotly.graph_objs.parcoords.Dimension`
466        constraintrange
467            The domain range to which the filter on the dimension
468            is constrained. Must be an array of `[fromValue,
469            toValue]` with `fromValue <= toValue`, or if
470            `multiselect` is not disabled, you may give an array of
471            arrays, where each inner array is `[fromValue,
472            toValue]`.
473        label
474            The shown name of the dimension.
475        multiselect
476            Do we allow multiple selection ranges or just a single
477            range?
478        name
479            When used in a template, named items are created in the
480            output figure in addition to any items the figure
481            already has in this array. You can modify these items
482            in the output figure by making your own item with
483            `templateitemname` matching this `name` alongside your
484            modifications (including `visible: false` or `enabled:
485            false` to hide it). Has no effect outside of a
486            template.
487        range
488            The domain range that represents the full, shown axis
489            extent. Defaults to the `values` extent. Must be an
490            array of `[fromValue, toValue]` with finite numbers as
491            elements.
492        templateitemname
493            Used to refer to a named item in this array in the
494            template. Named items from the template will be created
495            even without a matching item in the input figure, but
496            you can modify one by making an item with
497            `templateitemname` matching its `name`, alongside your
498            modifications (including `visible: false` or `enabled:
499            false` to hide it). If there is no template or no
500            matching item, this item will be hidden unless you
501            explicitly show it with `visible: true`.
502        tickformat
503            Sets the tick label formatting rule using d3 formatting
504            mini-languages which are very similar to those in
505            Python. For numbers, see:
506            https://github.com/d3/d3-3.x-api-
507            reference/blob/master/Formatting.md#d3_format And for
508            dates see: https://github.com/d3/d3-time-
509            format#locale_format We add one item to d3's date
510            formatter: "%{n}f" for fractional seconds with n
511            digits. For example, *2016-10-13 09:15:23.456* with
512            tickformat "%H~%M~%S.%2f" would display "09~15~23.46"
513        ticktext
514            Sets the text displayed at the ticks position via
515            `tickvals`.
516        ticktextsrc
517            Sets the source reference on Chart Studio Cloud for
518            ticktext .
519        tickvals
520            Sets the values at which ticks on this axis appear.
521        tickvalssrc
522            Sets the source reference on Chart Studio Cloud for
523            tickvals .
524        values
525            Dimension values. `values[n]` represents the value of
526            the `n`th point in the dataset, therefore the `values`
527            vector for all dimensions must be the same (longer
528            vectors will be truncated). Each value must be a finite
529            number.
530        valuessrc
531            Sets the source reference on Chart Studio Cloud for
532            values .
533        visible
534            Shows the dimension when set to `true` (the default).
535            Hides the dimension for `false`.
536
537        Returns
538        -------
539        Dimension
540        """
541        super(Dimension, self).__init__("dimensions")
542
543        if "_parent" in kwargs:
544            self._parent = kwargs["_parent"]
545            return
546
547        # Validate arg
548        # ------------
549        if arg is None:
550            arg = {}
551        elif isinstance(arg, self.__class__):
552            arg = arg.to_plotly_json()
553        elif isinstance(arg, dict):
554            arg = _copy.copy(arg)
555        else:
556            raise ValueError(
557                """\
558The first argument to the plotly.graph_objs.parcoords.Dimension
559constructor must be a dict or
560an instance of :class:`plotly.graph_objs.parcoords.Dimension`"""
561            )
562
563        # Handle skip_invalid
564        # -------------------
565        self._skip_invalid = kwargs.pop("skip_invalid", False)
566        self._validate = kwargs.pop("_validate", True)
567
568        # Populate data dict with properties
569        # ----------------------------------
570        _v = arg.pop("constraintrange", None)
571        _v = constraintrange if constraintrange is not None else _v
572        if _v is not None:
573            self["constraintrange"] = _v
574        _v = arg.pop("label", None)
575        _v = label if label is not None else _v
576        if _v is not None:
577            self["label"] = _v
578        _v = arg.pop("multiselect", None)
579        _v = multiselect if multiselect is not None else _v
580        if _v is not None:
581            self["multiselect"] = _v
582        _v = arg.pop("name", None)
583        _v = name if name is not None else _v
584        if _v is not None:
585            self["name"] = _v
586        _v = arg.pop("range", None)
587        _v = range if range is not None else _v
588        if _v is not None:
589            self["range"] = _v
590        _v = arg.pop("templateitemname", None)
591        _v = templateitemname if templateitemname is not None else _v
592        if _v is not None:
593            self["templateitemname"] = _v
594        _v = arg.pop("tickformat", None)
595        _v = tickformat if tickformat is not None else _v
596        if _v is not None:
597            self["tickformat"] = _v
598        _v = arg.pop("ticktext", None)
599        _v = ticktext if ticktext is not None else _v
600        if _v is not None:
601            self["ticktext"] = _v
602        _v = arg.pop("ticktextsrc", None)
603        _v = ticktextsrc if ticktextsrc is not None else _v
604        if _v is not None:
605            self["ticktextsrc"] = _v
606        _v = arg.pop("tickvals", None)
607        _v = tickvals if tickvals is not None else _v
608        if _v is not None:
609            self["tickvals"] = _v
610        _v = arg.pop("tickvalssrc", None)
611        _v = tickvalssrc if tickvalssrc is not None else _v
612        if _v is not None:
613            self["tickvalssrc"] = _v
614        _v = arg.pop("values", None)
615        _v = values if values is not None else _v
616        if _v is not None:
617            self["values"] = _v
618        _v = arg.pop("valuessrc", None)
619        _v = valuessrc if valuessrc is not None else _v
620        if _v is not None:
621            self["valuessrc"] = _v
622        _v = arg.pop("visible", None)
623        _v = visible if visible is not None else _v
624        if _v is not None:
625            self["visible"] = _v
626
627        # Process unknown kwargs
628        # ----------------------
629        self._process_kwargs(**dict(arg, **kwargs))
630
631        # Reset skip_invalid
632        # ------------------
633        self._skip_invalid = False
634