18 from typing
import Dict, List, Optional, Union
19 from typing_extensions
import Self
21 from .metric_type
import MetricType
22 from ....codable
import Codable, KeyDescriptor
25 class Metric(Codable):
32 xRange: Optional[List[float]]
33 yRange: Optional[List[float]]
36 def _keyDescriptors(cls) -> Dict[str, KeyDescriptor]:
37 descriptors = super()._keyDescriptors()
38 descriptors[
"name"] = KeyDescriptor(
"metric")
47 xType: Union[MetricType, int],
49 yType: Union[MetricType, int],
50 xRange: Optional[List[float]] =
None,
51 yRange: Optional[List[float]] =
None
58 label of x axis which will be displayed
59 xType : Union[MetricType, int]
60 type of x axis which will be displayed
62 label of y axis which will be displayed
63 yType : Union[MetricType, int]
64 type of y axis which will be displayed
65 xRange : Optional[List[float]]
66 range in which values will be displayed for x axis
67 yRange : Optional[List[float]]
68 range in which values will be displayed for y axis
71 if isinstance(xType, int):
72 xType = MetricType(xType)
74 if isinstance(yType, int):
75 yType = MetricType(yType)
81 obj.xType = xType.name
83 obj.yType = yType.name
89 def extract(self) -> Optional[float]: