(
self,
data: Any,
width: Union[int, str, None] = None,
height: Union[int, str, None] = None,
left: Union[int, str] = "0%",
top: Union[int, str] = "0%",
position: str = "relative",
)
| 163 | ] |
| 164 | |
| 165 | def __init__( |
| 166 | self, |
| 167 | data: Any, |
| 168 | width: Union[int, str, None] = None, |
| 169 | height: Union[int, str, None] = None, |
| 170 | left: Union[int, str] = "0%", |
| 171 | top: Union[int, str] = "0%", |
| 172 | position: str = "relative", |
| 173 | ): |
| 174 | super().__init__() |
| 175 | self._name = "Vega" |
| 176 | self.data = data.to_json() if hasattr(data, "to_json") else data |
| 177 | if isinstance(self.data, str): |
| 178 | self.data = json.loads(self.data) |
| 179 | |
| 180 | # Size Parameters. |
| 181 | self.width = _parse_size( |
| 182 | self.data.get("width", "100%") if width is None else width |
| 183 | ) |
| 184 | self.height = _parse_size( |
| 185 | self.data.get("height", "100%") if height is None else height |
| 186 | ) |
| 187 | self.left = _parse_size(left) |
| 188 | self.top = _parse_size(top) |
| 189 | self.position = position |
| 190 | |
| 191 | def render(self, **kwargs): |
| 192 | """Renders the HTML representation of the element.""" |
no outgoing calls
no test coverage detected