tbapi.api.models.plot_level

  1from __future__ import annotations
  2from typing import TYPE_CHECKING
  3from tbapi.common.decorators import tb_class, tb_interface
  4from tbapi.common.converters import to_python_datetime, to_net_datetime
  5from datetime import datetime
  6from Tickblaze.Scripts.Api.Models import PlotLevel as _PlotLevel
  7from typing import Any, overload
  8from abc import ABC, abstractmethod
  9from tbapi.api.interfaces.iplot import IPlot
 10from tbapi.core.enums.line_style import LineStyle
 11from Tickblaze.Core.Enums import LineStyle as _LineStyle
 12if TYPE_CHECKING:
 13    from tbapi.api.models.stroke import Stroke
 14    from tbapi.api.models.color import Color
 15
 16@tb_class(_PlotLevel)
 17class PlotLevel(IPlot):
 18    """Represents a level on a plot with configurable value, color, line style, thickness, and visibility."""
 19
 20    @overload
 21    @staticmethod
 22    def new(value: float, color: Color, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1) -> "PlotLevel":
 23        """Constructor overload with arguments: value, color, lineStyle, thickness"""
 24        ...
 25    @overload
 26    @staticmethod
 27    def new(name: str, value: float, color: Color, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1, isVisible: bool = True) -> "PlotLevel":
 28        """Constructor overload with arguments: name, value, color, lineStyle, thickness, isVisible"""
 29        ...
 30    @overload
 31    @staticmethod
 32    def new(name: str, value: float, stroke: Stroke) -> "PlotLevel":
 33        """Constructor overload with arguments: name, value, stroke"""
 34        ...
 35    @overload
 36    @staticmethod
 37    def new(value: float, color: str, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1) -> "PlotLevel":
 38        """Constructor overload with arguments: value, color, lineStyle, thickness"""
 39        ...
 40    @staticmethod
 41    def new(*args, **kwargs):
 42        """Generic factory method for PlotLevel. Use overloads for IDE type hints."""
 43        return PlotLevel(*args, **kwargs)
 44
 45    @property
 46    def name(self) -> str:
 47        """The name of the plot level."""
 48        val = self._value.Name
 49        return val
 50    @name.setter
 51    def name(self, val: str):
 52        tmp = self._value
 53        tmp.Name = val
 54        self._value = tmp
 55    @property
 56    def value(self) -> float:
 57        """The value of the plot level."""
 58        val = self._value.Value
 59        return val
 60    @value.setter
 61    def value(self, val: float):
 62        tmp = self._value
 63        tmp.Value = val
 64        self._value = tmp
 65    @property
 66    def stroke(self) -> Stroke:
 67        from tbapi.api.models.stroke import Stroke
 68        val = self._value.Stroke
 69        return Stroke(_existing=val)
 70    @stroke.setter
 71    def stroke(self, val: Stroke):
 72        tmp = self._value
 73        tmp.Stroke = val._value
 74        self._value = tmp
 75    @property
 76    def color(self) -> Color:
 77        """The color of the plot level."""
 78        from tbapi.api.models.color import Color
 79        val = self._value.Color
 80        return Color(_existing=val)
 81    @color.setter
 82    def color(self, val: Color):
 83        tmp = self._value
 84        tmp.Color = val._value
 85        self._value = tmp
 86    @property
 87    def line_style(self) -> LineStyle:
 88        """The line style for the plot level."""
 89        val = int(self._value.LineStyle)
 90        return LineStyle(val)
 91    @line_style.setter
 92    def line_style(self, val: LineStyle):
 93        tmp = self._value
 94        tmp.LineStyle = _LineStyle(val.value if hasattr(val, "value") else int(val))
 95        self._value = tmp
 96    @property
 97    def thickness(self) -> int:
 98        """The thickness of the plot level line."""
 99        val = self._value.Thickness
100        return val
101    @thickness.setter
102    def thickness(self, val: int):
103        tmp = self._value
104        tmp.Thickness = val
105        self._value = tmp
106    @property
107    def is_visible(self) -> bool:
108        """Indicates whether the plot level is visible."""
109        val = self._value.IsVisible
110        return val
111    @is_visible.setter
112    def is_visible(self, val: bool):
113        tmp = self._value
114        tmp.IsVisible = val
115        self._value = tmp
116
117    def clone(self) -> PlotLevel:
118        """Creates a copy of the current  instance.            A new instance of  with the same values."""
119        result = self._value.Clone()
120        from tbapi.api.models.plot_level import PlotLevel
121        return PlotLevel(_existing=result)
122  
@tb_class(_PlotLevel)
class PlotLevel(tbapi.api.interfaces.iplot.IPlot):
 24@tb_class(_PlotLevel)
 25class PlotLevel(IPlot):
 26    """Represents a level on a plot with configurable value, color, line style, thickness, and visibility."""
 27
 28    @overload
 29    @staticmethod
 30    def new(value: float, color: Color, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1) -> "PlotLevel":
 31        """Constructor overload with arguments: value, color, lineStyle, thickness"""
 32        ...
 33    @overload
 34    @staticmethod
 35    def new(name: str, value: float, color: Color, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1, isVisible: bool = True) -> "PlotLevel":
 36        """Constructor overload with arguments: name, value, color, lineStyle, thickness, isVisible"""
 37        ...
 38    @overload
 39    @staticmethod
 40    def new(name: str, value: float, stroke: Stroke) -> "PlotLevel":
 41        """Constructor overload with arguments: name, value, stroke"""
 42        ...
 43    @overload
 44    @staticmethod
 45    def new(value: float, color: str, lineStyle: LineStyle = LineStyle.Dash, thickness: int = 1) -> "PlotLevel":
 46        """Constructor overload with arguments: value, color, lineStyle, thickness"""
 47        ...
 48    @staticmethod
 49    def new(*args, **kwargs):
 50        """Generic factory method for PlotLevel. Use overloads for IDE type hints."""
 51        return PlotLevel(*args, **kwargs)
 52
 53    @property
 54    def name(self) -> str:
 55        """The name of the plot level."""
 56        val = self._value.Name
 57        return val
 58    @name.setter
 59    def name(self, val: str):
 60        tmp = self._value
 61        tmp.Name = val
 62        self._value = tmp
 63    @property
 64    def value(self) -> float:
 65        """The value of the plot level."""
 66        val = self._value.Value
 67        return val
 68    @value.setter
 69    def value(self, val: float):
 70        tmp = self._value
 71        tmp.Value = val
 72        self._value = tmp
 73    @property
 74    def stroke(self) -> Stroke:
 75        from tbapi.api.models.stroke import Stroke
 76        val = self._value.Stroke
 77        return Stroke(_existing=val)
 78    @stroke.setter
 79    def stroke(self, val: Stroke):
 80        tmp = self._value
 81        tmp.Stroke = val._value
 82        self._value = tmp
 83    @property
 84    def color(self) -> Color:
 85        """The color of the plot level."""
 86        from tbapi.api.models.color import Color
 87        val = self._value.Color
 88        return Color(_existing=val)
 89    @color.setter
 90    def color(self, val: Color):
 91        tmp = self._value
 92        tmp.Color = val._value
 93        self._value = tmp
 94    @property
 95    def line_style(self) -> LineStyle:
 96        """The line style for the plot level."""
 97        val = int(self._value.LineStyle)
 98        return LineStyle(val)
 99    @line_style.setter
100    def line_style(self, val: LineStyle):
101        tmp = self._value
102        tmp.LineStyle = _LineStyle(val.value if hasattr(val, "value") else int(val))
103        self._value = tmp
104    @property
105    def thickness(self) -> int:
106        """The thickness of the plot level line."""
107        val = self._value.Thickness
108        return val
109    @thickness.setter
110    def thickness(self, val: int):
111        tmp = self._value
112        tmp.Thickness = val
113        self._value = tmp
114    @property
115    def is_visible(self) -> bool:
116        """Indicates whether the plot level is visible."""
117        val = self._value.IsVisible
118        return val
119    @is_visible.setter
120    def is_visible(self, val: bool):
121        tmp = self._value
122        tmp.IsVisible = val
123        self._value = tmp
124
125    def clone(self) -> PlotLevel:
126        """Creates a copy of the current  instance.            A new instance of  with the same values."""
127        result = self._value.Clone()
128        from tbapi.api.models.plot_level import PlotLevel
129        return PlotLevel(_existing=result)

Represents a level on a plot with configurable value, color, line style, thickness, and visibility.

PlotLevel(*args, **kwargs)
162        def __init__(self, *args, **kwargs):
163            pass
@staticmethod
def new(*args, **kwargs):
48    @staticmethod
49    def new(*args, **kwargs):
50        """Generic factory method for PlotLevel. Use overloads for IDE type hints."""
51        return PlotLevel(*args, **kwargs)

Generic factory method for PlotLevel. Use overloads for IDE type hints.

name: str
53    @property
54    def name(self) -> str:
55        """The name of the plot level."""
56        val = self._value.Name
57        return val

The name of the plot level.

value: float
63    @property
64    def value(self) -> float:
65        """The value of the plot level."""
66        val = self._value.Value
67        return val

The value of the plot level.

stroke: tbapi.api.models.stroke.Stroke
73    @property
74    def stroke(self) -> Stroke:
75        from tbapi.api.models.stroke import Stroke
76        val = self._value.Stroke
77        return Stroke(_existing=val)
color: tbapi.api.models.color.Color
83    @property
84    def color(self) -> Color:
85        """The color of the plot level."""
86        from tbapi.api.models.color import Color
87        val = self._value.Color
88        return Color(_existing=val)

The color of the plot level.

line_style: tbapi.core.enums.line_style.LineStyle
94    @property
95    def line_style(self) -> LineStyle:
96        """The line style for the plot level."""
97        val = int(self._value.LineStyle)
98        return LineStyle(val)

The line style for the plot level.

thickness: int
104    @property
105    def thickness(self) -> int:
106        """The thickness of the plot level line."""
107        val = self._value.Thickness
108        return val

The thickness of the plot level line.

is_visible: bool
114    @property
115    def is_visible(self) -> bool:
116        """Indicates whether the plot level is visible."""
117        val = self._value.IsVisible
118        return val

Indicates whether the plot level is visible.

def clone(self) -> PlotLevel:
125    def clone(self) -> PlotLevel:
126        """Creates a copy of the current  instance.            A new instance of  with the same values."""
127        result = self._value.Clone()
128        from tbapi.api.models.plot_level import PlotLevel
129        return PlotLevel(_existing=result)

Creates a copy of the current instance. A new instance of with the same values.