|
@@ -1,5 +1,6 @@
|
|
from typing import Callable, Dict, Optional
|
|
from typing import Callable, Dict, Optional
|
|
|
|
|
|
|
|
+from ..awaitable_response import AwaitableResponse
|
|
from ..element import Element
|
|
from ..element import Element
|
|
from ..events import EChartPointClickEventArguments, GenericEventArguments, handle_event
|
|
from ..events import EChartPointClickEventArguments, GenericEventArguments, handle_event
|
|
|
|
|
|
@@ -55,3 +56,21 @@ class EChart(Element, component='echart.js', libraries=['lib/echarts/echarts.min
|
|
def update(self) -> None:
|
|
def update(self) -> None:
|
|
super().update()
|
|
super().update()
|
|
self.run_method('update_chart')
|
|
self.run_method('update_chart')
|
|
|
|
+
|
|
|
|
+ def run_chart_method(self, name: str, *args, timeout: float = 1,
|
|
|
|
+ check_interval: float = 0.01) -> AwaitableResponse:
|
|
|
|
+ """Run a method of the JSONEditor instance.
|
|
|
|
+
|
|
|
|
+ See the `ECharts documentation <https://echarts.apache.org/en/api.html#echartsInstance>`_ for a list of methods.
|
|
|
|
+
|
|
|
|
+ If the function is awaited, the result of the method call is returned.
|
|
|
|
+ Otherwise, the method is executed without waiting for a response.
|
|
|
|
+
|
|
|
|
+ :param name: name of the method (a prefix ":" indicates that the arguments are JavaScript expressions)
|
|
|
|
+ :param args: arguments to pass to the method (Python objects or JavaScript expressions)
|
|
|
|
+ :param timeout: timeout in seconds (default: 1 second)
|
|
|
|
+ :param check_interval: interval in seconds to check for a response (default: 0.01 seconds)
|
|
|
|
+
|
|
|
|
+ :return: AwaitableResponse that can be awaited to get the result of the method call
|
|
|
|
+ """
|
|
|
|
+ return self.run_method('run_chart_method', name, *args, timeout=timeout, check_interval=check_interval)
|