|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from typing import Any |
| 4 | + |
| 5 | +from .. import components, datatypes |
| 6 | + |
| 7 | +from ..error_utils import catch_and_log_exceptions |
| 8 | + |
| 9 | + |
| 10 | +class SeriesPointsExt: |
| 11 | + """Extension for [SeriesPoints][rerun.archetypes.SeriesPoints].""" |
| 12 | + |
| 13 | + def __init__( |
| 14 | + self: Any, |
| 15 | + *, |
| 16 | + colors: datatypes.Rgba32ArrayLike | None = None, |
| 17 | + markers: components.MarkerShapeArrayLike | None = None, |
| 18 | + names: datatypes.Utf8ArrayLike | None = None, |
| 19 | + visible_series: datatypes.BoolArrayLike | None = None, |
| 20 | + marker_sizes: datatypes.Float32ArrayLike | None = None, |
| 21 | + ) -> None: |
| 22 | + """ |
| 23 | + Create a new instance of the SeriesPoints archetype. |
| 24 | +
|
| 25 | + Parameters |
| 26 | + ---------- |
| 27 | + colors: |
| 28 | + Color for the corresponding series. |
| 29 | +
|
| 30 | + May change over time, but can cause discontinuities in the line. |
| 31 | + markers: |
| 32 | + What shape to use to represent the point |
| 33 | +
|
| 34 | + May change over time. |
| 35 | + names: |
| 36 | + Display name of the series. |
| 37 | +
|
| 38 | + Used in the legend. Expected to be unchanging over time. |
| 39 | + visible_series: |
| 40 | + Which lines are visible. |
| 41 | +
|
| 42 | + If not set, all line series on this entity are visible. |
| 43 | + Unlike with the regular visibility property of the entire entity, any series that is hidden |
| 44 | + via this property will still be visible in the legend. |
| 45 | +
|
| 46 | + May change over time. |
| 47 | + marker_sizes: |
| 48 | + Sizes of the markers. |
| 49 | +
|
| 50 | + May change over time. |
| 51 | +
|
| 52 | + """ |
| 53 | + |
| 54 | + # You can define your own __init__ function as a member of SeriesPointsExt in series_points_ext.py |
| 55 | + with catch_and_log_exceptions(context=self.__class__.__name__): |
| 56 | + |
| 57 | + if all(arg is None for arg in [colors, markers, names, visible_series, marker_sizes]): |
| 58 | + markers = components.MarkerShape.Circle |
| 59 | + |
| 60 | + self.__attrs_init__( |
| 61 | + colors=colors, markers=markers, names=names, visible_series=visible_series, marker_sizes=marker_sizes |
| 62 | + ) |
| 63 | + return |
| 64 | + self.__attrs_clear__() |
0 commit comments