Example #1
0
class HeatSeries(DataSeries[tuple]):
    """Adds a heat series to a plot."""
    _update_func = dpgcore.add_heat_series
    _data_keywords = 'values'

    values: MutableSequence[float] = DataSeriesField()

    rows: int = DataSeriesConfig()
    columns: int = DataSeriesConfig()
    scale_min: float = DataSeriesConfig()
    scale_max: float = DataSeriesConfig()

    format: str = DataSeriesConfig()
    bounds_min: Tuple[float, float]
    bounds_max: Tuple[float, float]

    @DataSeriesConfig(key='bounds_min')
    def bounds_min(self, config) -> Tuple[float, float]:
        return tuple(config)

    @DataSeriesConfig(key='bounds_max')
    def bounds_max(self, config) -> Tuple[float, float]:
        return tuple(config)

    def __init__(self, label: str, values: Iterable[float], rows: int,
                 columns: int, scale_min: float, scale_max: float,
                 **config: Any):
        values = ((v, ) for v in values)
        super().__init__(label,
                         values,
                         rows=rows,
                         columns=columns,
                         scale_min=scale_min,
                         scale_max=scale_max,
                         **config)
Example #2
0
class BarSeries(DataSeries[XYData]):
    """Adds a bar series to a plot."""
    _update_func = dpgcore.add_bar_series
    _create_record = XYData
    _data_keywords = 'x y'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()

    weight: float = DataSeriesConfig()
    horizontal: bool = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #3
0
class StemSeries(DataSeries[XYData]):
    """Add a stem series to a plot."""
    _update_func = dpgcore.add_stem_series
    _create_record = XYData
    _data_keywords = 'x y'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()

    marker: PlotMarker = DataSeriesConfigMarker()
    size: float = DataSeriesConfig()
    weight: float = DataSeriesConfig()
    outline: ColorRGBA = DataSeriesConfigColorRGBA()
    fill: ColorRGBA = DataSeriesConfigColorRGBA()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #4
0
class ScatterSeries(DataSeries[XYData]):
    """Adds a scatter series to a plot."""
    __update_func__ = dpgcore.add_scatter_series
    __create_record__ = XYData
    __data_keywords__ = 'x y'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()

    marker: PlotMarker = DataSeriesConfigMarker()
    size: float = DataSeriesConfig()
    weight: float = DataSeriesConfig()
    outline: ColorRGBA = DataSeriesConfigColorRGBA()
    fill: ColorRGBA = DataSeriesConfigColorRGBA()
    xy_data_format: bool = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #5
0
class CandleSeries(DataSeries[CandleSeriesData]):
    """Adds a candle series to a plot."""
    _update_func = dpgcore.add_candle_series
    _create_record = CandleSeriesData
    _data_keywords = 'date opens highs lows closes'

    date: MutableSequence[float] = DataSeriesField()
    opens: MutableSequence[float] = DataSeriesField()
    highs: MutableSequence[float] = DataSeriesField()
    lows: MutableSequence[float] = DataSeriesField()
    closes: MutableSequence[float] = DataSeriesField()

    tooltip: bool = DataSeriesConfig()
    bull_color: ColorRGBA = DataSeriesConfigColorRGBA()
    bear_color: ColorRGBA = DataSeriesConfigColorRGBA()
    weight: float = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #6
0
class VLineSeries(DataSeries[tuple]):
    """Adds an infinite vertical line series to a plot."""
    _update_func = dpgcore.add_vline_series
    _data_keywords = 'x'

    x: MutableSequence[float] = DataSeriesField()

    color: ColorRGBA = DataSeriesConfigColorRGBA()
    weight: float = DataSeriesConfig()

    def __init__(self, label: str, x: Iterable[float], **config: Any):
        super().__init__(label, ((v, ) for v in x), **config)
Example #7
0
class StairSeries(DataSeries[XYData]):
    """Add a stair series to a plot."""
    _update_func = dpgcore.add_stair_series
    _create_record = XYData
    _data_keywords = 'x y'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()

    color: ColorRGBA = DataSeriesConfigColorRGBA()
    weight: float = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #8
0
class SingleShadeSeries(DataSeries[XYData]):
    """Adds a single-sided shade series to a plot."""
    _update_func = dpgcore.add_scatter_series
    _create_record = XYData
    _data_keywords = 'x y1'

    x: MutableSequence[float] = DataSeriesField()
    y1: MutableSequence[float] = DataSeriesField()

    color: ColorRGBA = DataSeriesConfigColorRGBA()
    fill: ColorRGBA = DataSeriesConfigColorRGBA()
    weight: float = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #9
0
class ErrorSeries(DataSeries[ErrorSeriesData]):
    """Adds an error series to a plot."""
    _update_func = dpgcore.add_error_series
    _create_record = ErrorSeriesData
    _data_keywords = 'x y negative positive'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()
    negative: MutableSequence[float] = DataSeriesField()
    positive: MutableSequence[float] = DataSeriesField()

    horizontal: bool = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], **config: Any):
        super().__init__(label, data, **config)
Example #10
0
class AreaSeries(DataSeries[XYData]):
    """Adds an area series to a plot."""
    __update_func__ = dpgcore.add_area_series
    __create_record__ = XYData
    __data_keywords__ = 'x y'

    x: MutableSequence[float] = DataSeriesField()
    y: MutableSequence[float] = DataSeriesField()

    color: ColorRGBA = DataSeriesConfigColorRGBA()
    fill: ColorRGBA = DataSeriesConfigColorRGBA()

    weight: float = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], color: ColorRGBA,
                 fill: ColorRGBA, **config: Any):
        super().__init__(label, data, color=color, fill=fill, **config)
Example #11
0
class PieSeries(DataSeries[PieSeriesData]):
    """Adds a pie chart to a plot."""
    _update_func = dpgcore.add_pie_series
    _create_record = PieSeriesData
    _data_keywords = 'values labels'

    values: MutableSequence[float] = DataSeriesField()
    labels: MutableSequence[str] = DataSeriesField()

    x: float = DataSeriesConfig()
    y: float = DataSeriesConfig()
    radius: float = DataSeriesConfig()

    normalize: bool = DataSeriesConfig()
    angle: bool = DataSeriesConfig()
    format: str = DataSeriesConfig()

    def __init__(self, label: str, data: Iterable[Any], x: float, y: float,
                 radius: float, **config: Any):
        super().__init__(label, data, x=x, y=y, radius=radius, **config)