From 18447f95c476c1706ad9ba81d80b62ecdd630c50 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 09:30:09 +0100 Subject: [PATCH 01/18] Add express options --- echarts4py/express.py | 33 +++++++++++++++++++++++++++++++++ tests/test_express.py | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 echarts4py/express.py create mode 100644 tests/test_express.py diff --git a/echarts4py/express.py b/echarts4py/express.py new file mode 100644 index 0000000..ce825f6 --- /dev/null +++ b/echarts4py/express.py @@ -0,0 +1,33 @@ +from .option import ChartOption + + +class ExpressOption(object): + series: list = list() + kwargs: dict = dict() + + def to_option(self) -> ChartOption: + kwargs = self.kwargs | {"series": self.series} + return ChartOption(**kwargs) + + def to_dict(self) -> dict: + return self.to_option().to_dict() + + +class Bar(ExpressOption): + CHART_TYPE = "bar" + + def __init__(self, x: str, y: str, **kwargs) -> None: + self.series = [{"name": y, "type": self.CHART_TYPE, "encode": {"x": x, "y": y}}] + self.kwargs = kwargs + + +class Line(ExpressOption): + pass + + +class Pie(ExpressOption): + pass + + +class Scatter(ExpressOption): + pass diff --git a/tests/test_express.py b/tests/test_express.py new file mode 100644 index 0000000..710c026 --- /dev/null +++ b/tests/test_express.py @@ -0,0 +1,9 @@ +from echarts4py.express import Bar + + +def test_bar(): + chart_option = Bar(x="a", y="b", legend={}) + + print(chart_option.to_option()) + + print(chart_option.to_dict()) From f136541c483cbd13d2510b1ef53bb4be1064f002 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 11:07:21 +0100 Subject: [PATCH 02/18] Add bars example --- .../getting_started/basic_usage_express.py | 47 +++++++++++++++++++ echarts4py/chart.py | 3 +- echarts4py/express.py | 20 +++++++- tests/test_express.py | 8 +++- 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 docs/examples/getting_started/basic_usage_express.py diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py new file mode 100644 index 0000000..b51bf85 --- /dev/null +++ b/docs/examples/getting_started/basic_usage_express.py @@ -0,0 +1,47 @@ +from echarts4py.chart import Chart, InitOptions +from echarts4py.express import Bar, Line +from echarts4py.option import ChartOption +from echarts4py.renderer import ChartRenderer +from pandas import DataFrame + +# Must always be imported, otherwise App is not found +from shiny.express import ui + +# General options +options = InitOptions(width=600, height=400, renderer="canvas") + +# Line chart +line_data = DataFrame( + [[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]], + columns=["a", "b", "c", "d"], +) +lines = ( + Line(x="a", y="b", legend={}, tooltip={"trigger": "axis"}) + .add_series("c") + .add_series("d") +) + + +@ChartRenderer +def render_lines(): + return Chart(options, data=line_data).set_option(lines) + + +# Bar chart +bar_data = DataFrame( + list( + zip( + ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + [23, 24, 18, 25, 27, 28, 25], + [27, 14, 8, 29, 29, 18, 45], + ) + ), + columns=["month", "2023", "2024"], +) + +bars = Bar(x="month", y="2023", legend={}).add_series("2024") + + +@ChartRenderer +def render_bars(): + return Chart(options, data=bar_data).set_option(bars) diff --git a/echarts4py/chart.py b/echarts4py/chart.py index 17454e5..f0b3073 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -5,6 +5,7 @@ from pandas import DataFrame +from .express import ExpressOption from .option import ChartOption @@ -29,7 +30,7 @@ def __init__( self.data = data self.option = {} - def set_option(self, option: dict | ChartOption) -> Chart: + def set_option(self, option: dict | ChartOption | ExpressOption) -> Chart: self.option = option if isinstance(option, dict) else option.to_dict() return self diff --git a/echarts4py/express.py b/echarts4py/express.py index ce825f6..01279e0 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -1,10 +1,26 @@ +from __future__ import annotations + from .option import ChartOption class ExpressOption(object): + CHART_TYPE: str = "line" + series: list = list() kwargs: dict = dict() + def __init__(self, x: str, y: str, **kwargs) -> None: + self.x = x + self.series = [self._create_series(x, y)] + self.kwargs = kwargs + + def _create_series(self, x: str, y: str) -> dict: + return {"name": y, "type": self.CHART_TYPE, "encode": {"x": x, "y": y}} + + def add_series(self, y: str) -> ExpressOption: + self.series.append(self._create_series(self.x, y)) + return self + def to_option(self) -> ChartOption: kwargs = self.kwargs | {"series": self.series} return ChartOption(**kwargs) @@ -17,8 +33,8 @@ class Bar(ExpressOption): CHART_TYPE = "bar" def __init__(self, x: str, y: str, **kwargs) -> None: - self.series = [{"name": y, "type": self.CHART_TYPE, "encode": {"x": x, "y": y}}] - self.kwargs = kwargs + super().__init__(x, y, **kwargs) + self.kwargs = kwargs | {"x_axis": {"type": "category"}} class Line(ExpressOption): diff --git a/tests/test_express.py b/tests/test_express.py index 710c026..aa9ad5e 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,4 +1,4 @@ -from echarts4py.express import Bar +from echarts4py.express import Bar, Line def test_bar(): @@ -7,3 +7,9 @@ def test_bar(): print(chart_option.to_option()) print(chart_option.to_dict()) + + +def test_line(): + chart_option = Line(x="a", y="b") + + print(chart_option.to_dict()) From dd34355939de568a14fd75b915ea3623c04b33bb Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 11:22:51 +0100 Subject: [PATCH 03/18] Add scatter express example --- .../getting_started/basic_usage_express.py | 15 ++++++++++++++- echarts4py/express.py | 13 +++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index b51bf85..2b0ac70 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,5 +1,5 @@ from echarts4py.chart import Chart, InitOptions -from echarts4py.express import Bar, Line +from echarts4py.express import Bar, Line, Scatter from echarts4py.option import ChartOption from echarts4py.renderer import ChartRenderer from pandas import DataFrame @@ -45,3 +45,16 @@ def render_lines(): @ChartRenderer def render_bars(): return Chart(options, data=bar_data).set_option(bars) + + +# Scatter chart +scatter_data = DataFrame( + [[10, 5, 4], [0, 8, 3], [6, 10, 12], [2, 12, 6], [8, 9, 7]], columns=["x", "y", "z"] +) + +scatter = Scatter("x", "y", legend={}).add_series("z") + + +@ChartRenderer +def render_scatter(): + return Chart(options, data=scatter_data).set_option(scatter) diff --git a/echarts4py/express.py b/echarts4py/express.py index 01279e0..ab2c249 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -3,7 +3,10 @@ from .option import ChartOption +# TODO: Make it private class ExpressOption(object): + """Base Express Option""" + CHART_TYPE: str = "line" series: list = list() @@ -30,6 +33,8 @@ def to_dict(self) -> dict: class Bar(ExpressOption): + """Bar option""" + CHART_TYPE = "bar" def __init__(self, x: str, y: str, **kwargs) -> None: @@ -38,7 +43,9 @@ def __init__(self, x: str, y: str, **kwargs) -> None: class Line(ExpressOption): - pass + """Line Option""" + + CHART_TYPE = "line" class Pie(ExpressOption): @@ -46,4 +53,6 @@ class Pie(ExpressOption): class Scatter(ExpressOption): - pass + """Scatter Option""" + + CHART_TYPE = "scatter" From 37371d5e79c3769365990f9b2414d2de11a313db Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 11:26:21 +0100 Subject: [PATCH 04/18] Allow None for theme --- echarts4py/chart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echarts4py/chart.py b/echarts4py/chart.py index f0b3073..5d511dc 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -22,7 +22,7 @@ class Chart(object): def __init__( self, init_options: InitOptions = InitOptions(), - theme: str = "dark", + theme: str | None = "dark", data: DataFrame = None, ) -> None: self.init_options = init_options From c141a8a4d60cd0d43d771df17786acddcf49276b Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 12:55:37 +0100 Subject: [PATCH 05/18] Add pie chart express --- .../getting_started/basic_usage_express.py | 13 ++++++++++- echarts4py/express.py | 22 ++++++++++++++----- pytest.ini | 2 ++ tests/test_express.py | 12 +++++++++- 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 pytest.ini diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 2b0ac70..ef18104 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,5 +1,5 @@ from echarts4py.chart import Chart, InitOptions -from echarts4py.express import Bar, Line, Scatter +from echarts4py.express import Bar, Line, Pie, Scatter from echarts4py.option import ChartOption from echarts4py.renderer import ChartRenderer from pandas import DataFrame @@ -58,3 +58,14 @@ def render_bars(): @ChartRenderer def render_scatter(): return Chart(options, data=scatter_data).set_option(scatter) + + +# Pie chart +pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) + +pie = Pie(pie_data, name="Category", value="Value") + + +@ChartRenderer +def render_pie(): + return Chart(options).set_option(pie) diff --git a/echarts4py/express.py b/echarts4py/express.py index ab2c249..0e48bb0 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -12,7 +12,7 @@ class ExpressOption(object): series: list = list() kwargs: dict = dict() - def __init__(self, x: str, y: str, **kwargs) -> None: + def __init__(self, x: str = None, y: str = None, **kwargs) -> None: self.x = x self.series = [self._create_series(x, y)] self.kwargs = kwargs @@ -48,11 +48,23 @@ class Line(ExpressOption): CHART_TYPE = "line" -class Pie(ExpressOption): - pass - - class Scatter(ExpressOption): """Scatter Option""" CHART_TYPE = "scatter" + + +class Pie(ExpressOption): + CHART_TYPE = "pie" + + def __init__(self, data, name: str, value: str, **kwargs): + super().__init__(**kwargs | {"x_axis": None, "y_axis": None}) + self.series = [ + { + "type": self.CHART_TYPE, + "data": [ + {"name": row[0], "value": row[1]} + for row in data[[name, value]].to_numpy() + ], + } + ] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..7d448c5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +filterwarnings = ignore::DeprecationWarning \ No newline at end of file diff --git a/tests/test_express.py b/tests/test_express.py index aa9ad5e..a93a40e 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,4 +1,5 @@ -from echarts4py.express import Bar, Line +from echarts4py.express import Bar, Line, Pie +from pandas import DataFrame def test_bar(): @@ -13,3 +14,12 @@ def test_line(): chart_option = Line(x="a", y="b") print(chart_option.to_dict()) + + +def test_pie(): + data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) + + chart_option = Pie(data=data, name="Category", value="Value") + + print(chart_option.series) + print(chart_option.to_dict()) From 3f71d8e1e2318d529b014673d6bc1db2073d922d Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 13:58:55 +0100 Subject: [PATCH 06/18] Refactor express pie --- .../getting_started/basic_usage_express.py | 8 +++++++- echarts4py/_core.py | 9 +++++++++ echarts4py/chart.py | 5 ++++- echarts4py/express.py | 16 ++++++++++++---- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index ef18104..0a7d044 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -63,7 +63,13 @@ def render_scatter(): # Pie chart pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) -pie = Pie(pie_data, name="Category", value="Value") +pie = Pie( + name="Category", + value="Value", + data=pie_data, + legend={}, + tooltip={"trigger": "item"}, +) @ChartRenderer diff --git a/echarts4py/_core.py b/echarts4py/_core.py index 5b44472..eabf47b 100644 --- a/echarts4py/_core.py +++ b/echarts4py/_core.py @@ -14,3 +14,12 @@ def to_dict(self): snake_to_camel_case(k): v for (k, v) in x if v is not None }, ) + + +class BaseOption(object): + CHART_TYPE: str = None + + option = dict() + + def to_dict(self) -> dict: + return self.option diff --git a/echarts4py/chart.py b/echarts4py/chart.py index 5d511dc..606a66a 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -5,6 +5,7 @@ from pandas import DataFrame +from ._core import BaseOption from .express import ExpressOption from .option import ChartOption @@ -30,7 +31,9 @@ def __init__( self.data = data self.option = {} - def set_option(self, option: dict | ChartOption | ExpressOption) -> Chart: + def set_option( + self, option: dict | ChartOption | ExpressOption | BaseOption + ) -> Chart: self.option = option if isinstance(option, dict) else option.to_dict() return self diff --git a/echarts4py/express.py b/echarts4py/express.py index 0e48bb0..0293829 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -1,10 +1,11 @@ from __future__ import annotations +from ._core import BaseOption from .option import ChartOption # TODO: Make it private -class ExpressOption(object): +class ExpressOption(BaseOption): """Base Express Option""" CHART_TYPE: str = "line" @@ -54,11 +55,12 @@ class Scatter(ExpressOption): CHART_TYPE = "scatter" -class Pie(ExpressOption): +class Pie(BaseOption): CHART_TYPE = "pie" - def __init__(self, data, name: str, value: str, **kwargs): - super().__init__(**kwargs | {"x_axis": None, "y_axis": None}) + def __init__( + self, name: str | list, value: str | list, data=None, **kwargs + ) -> None: self.series = [ { "type": self.CHART_TYPE, @@ -68,3 +70,9 @@ def __init__(self, data, name: str, value: str, **kwargs): ], } ] + self.option = ( + kwargs | {"x_axis": None, "y_axis": None} | {"series": self.series} + ) + + def to_dict(self) -> dict: + return ChartOption(**self.option).to_dict() From 4ad3e9711a19988526c2be97bf17ca7fe825eafa Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Thu, 8 Feb 2024 14:59:56 +0100 Subject: [PATCH 07/18] Refactor Line --- .../getting_started/basic_usage_express.py | 10 +++++++- echarts4py/express.py | 25 +++++++++++++++++++ tests/test_express.py | 11 +++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 0a7d044..8cd6c08 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,5 +1,5 @@ from echarts4py.chart import Chart, InitOptions -from echarts4py.express import Bar, Line, Pie, Scatter +from echarts4py.express import Bar, Line, Line_, Pie, Scatter from echarts4py.option import ChartOption from echarts4py.renderer import ChartRenderer from pandas import DataFrame @@ -75,3 +75,11 @@ def render_scatter(): @ChartRenderer def render_pie(): return Chart(options).set_option(pie) + + +# --- +@ChartRenderer +def render_lines_(): + return Chart(options).set_option( + Line_(data=line_data, x="a", y="b", legend=dict()).add("c").add("d") + ) diff --git a/echarts4py/express.py b/echarts4py/express.py index 0293829..0e6ce40 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -76,3 +76,28 @@ def __init__( def to_dict(self) -> dict: return ChartOption(**self.option).to_dict() + + +# --- +class Line_(BaseOption): + """Line Option""" + + CHART_TYPE = "line" + + def __init__(self, x: str, y: str, data=None, **kwargs) -> None: + self.data = data + series = [{"name": y, "data": data[y].to_list(), "type": self.CHART_TYPE}] + self.option = kwargs | { + "x_axis": {"data": data[x].to_list()}, + "y_axis": {"axisLine": {"show": True}}, + "series": series, + } + + def add(self, y: str) -> Line_: + self.option["series"].append( + {"name": y, "data": self.data[y].to_list(), "type": self.CHART_TYPE} + ) + return self + + def to_dict(self) -> dict: + return ChartOption(**self.option).to_dict() diff --git a/tests/test_express.py b/tests/test_express.py index a93a40e..0d8696f 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,4 +1,4 @@ -from echarts4py.express import Bar, Line, Pie +from echarts4py.express import Bar, Line, Line_, Pie from pandas import DataFrame @@ -23,3 +23,12 @@ def test_pie(): print(chart_option.series) print(chart_option.to_dict()) + + +# --- +def test_line2(): + data = DataFrame([["1", 10], [2, 4]], columns=["x", "y"]) + + chart_option = Line_(x="x", y="y", data=data) + + print("line2", chart_option.to_dict()) From e6c462a1a22dfc560f1a75fec1a7d9a96d4b19a0 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 00:11:24 +0100 Subject: [PATCH 08/18] Refactor base options --- .../getting_started/basic_usage_express.py | 42 +++++++++---- echarts4py/_core.py | 63 +++++++++++++++++++ echarts4py/chart.py | 15 +---- echarts4py/experimental.py | 35 +++++++++++ echarts4py/express.py | 53 +++++----------- srcjs/index.js | 4 +- tests/test_express.py | 10 ++- 7 files changed, 158 insertions(+), 64 deletions(-) create mode 100644 echarts4py/experimental.py diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 8cd6c08..0c94452 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,5 +1,7 @@ +from echarts4py._core import Bar, Line, Scatter from echarts4py.chart import Chart, InitOptions -from echarts4py.express import Bar, Line, Line_, Pie, Scatter +from echarts4py.experimental import Line_ +from echarts4py.express import Pie from echarts4py.option import ChartOption from echarts4py.renderer import ChartRenderer from pandas import DataFrame @@ -12,12 +14,21 @@ # Line chart line_data = DataFrame( - [[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]], + [ + [0, 1, 2, 3], + [0.7, 2, 3, 4], + [1, 0.4, 5, 6], + [1.4, 2, 3, 4], + [2, -2, 4, 9], + [3, 1, 6, 7], + ], columns=["a", "b", "c", "d"], ) lines = ( - Line(x="a", y="b", legend={}, tooltip={"trigger": "axis"}) - .add_series("c") + Line( + x="a", y="b", legend={}, tooltip={"trigger": "axis"}, xAxis={"type": "category"} + ) + .add_series("c", series_options={"type": "bar"}) .add_series("d") ) @@ -34,12 +45,17 @@ def render_lines(): ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], [23, 24, 18, 25, 27, 28, 25], [27, 14, 8, 29, 29, 18, 45], + [27, 11, 9, 27, 29, 18, 45], ) ), - columns=["month", "2023", "2024"], + columns=["month", "2023", "2024", "2035"], ) -bars = Bar(x="month", y="2023", legend={}).add_series("2024") +bars = ( + Bar(x="month", y="2023", legend={}) + .add_series("2024") + .add_series("2025", series_options={"type": "line"}) +) @ChartRenderer @@ -52,7 +68,7 @@ def render_bars(): [[10, 5, 4], [0, 8, 3], [6, 10, 12], [2, 12, 6], [8, 9, 7]], columns=["x", "y", "z"] ) -scatter = Scatter("x", "y", legend={}).add_series("z") +scatter = Scatter("x", "y", legend={}).add_series("z", series_options={"type": "bar"}) @ChartRenderer @@ -61,14 +77,14 @@ def render_scatter(): # Pie chart -pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) +# pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["name", "value"]) +pie_data = [dict(name=x, value=y) for x, y in zip(["A", "B", "C", "D"], [10, 40, 5, 9])] pie = Pie( - name="Category", - value="Value", data=pie_data, - legend={}, - tooltip={"trigger": "item"}, + series_options=dict(roseType="area"), + legend=dict(), + tooltip=dict(trigger="item"), ) @@ -81,5 +97,5 @@ def render_pie(): @ChartRenderer def render_lines_(): return Chart(options).set_option( - Line_(data=line_data, x="a", y="b", legend=dict()).add("c").add("d") + Line_(data=line_data, x="a", y="b", legend=dict()) # .add("c").add("d") ) diff --git a/echarts4py/_core.py b/echarts4py/_core.py index eabf47b..b69a49a 100644 --- a/echarts4py/_core.py +++ b/echarts4py/_core.py @@ -1,10 +1,28 @@ +from __future__ import annotations + from dataclasses import asdict, dataclass +from pandas import DataFrame + +# from .option import ChartOption + def snake_to_camel_case(snake_str: str) -> str: return snake_str[0].lower() + snake_str.title()[1:].replace("_", "") +def df_to_dataset(df: DataFrame = None) -> dict: + return ( + {"dataset": {"source": [df.columns.to_list()] + df.to_numpy().tolist()}} + if isinstance(df, DataFrame) + else {} + ) + + +def df_to_pie_data(df: DataFrame, name: str, value: str) -> list: + return [{"name": row[0], "value": row[1]} for row in df[[name, value]].to_numpy()] + + @dataclass class BaseDataClass(object): def to_dict(self): @@ -23,3 +41,48 @@ class BaseOption(object): def to_dict(self) -> dict: return self.option + + +class BaseOptionXY(BaseOption): + def _create_series(self, x: str, y: str, series_options: dict = None) -> dict: + return { + "name": y, + "type": self.CHART_TYPE, + "encode": {"x": x, "y": y}, + } | (series_options or dict()) + + def __init__( + self, + x: str = None, + y: str = None, + series_options: dict = None, + data: DataFrame = None, + **kwargs, + ) -> None: + self.x = x + x_axis = dict(type="category") if self.CHART_TYPE == "bar" else dict() + series = [self._create_series(x, y, series_options)] + defaults = dict(xAxis=x_axis, yAxis=dict()) + self.option = defaults | kwargs | {"series": series} + + def add_series(self, y: str, series_options: dict = None) -> BaseOptionXY: + self.option["series"].append(self._create_series(self.x, y, series_options)) + return self + + +class Line(BaseOptionXY): + """Line Option""" + + CHART_TYPE = "line" + + +class Bar(BaseOptionXY): + """Bar Option""" + + CHART_TYPE = "bar" + + +class Scatter(BaseOptionXY): + """Scatter Option""" + + CHART_TYPE = "scatter" diff --git a/echarts4py/chart.py b/echarts4py/chart.py index 606a66a..a52893f 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -5,7 +5,7 @@ from pandas import DataFrame -from ._core import BaseOption +from ._core import BaseOption, df_to_dataset from .express import ExpressOption from .option import ChartOption @@ -29,7 +29,7 @@ def __init__( self.init_options = init_options self.theme = theme self.data = data - self.option = {} + self.option = dict() def set_option( self, option: dict | ChartOption | ExpressOption | BaseOption @@ -38,16 +38,7 @@ def set_option( return self def to_dict(self) -> dict: - dataset = ( - { - "dataset": { - "source": [self.data.columns.to_list()] - + self.data.to_numpy().tolist() - } - } - if isinstance(self.data, DataFrame) - else {} - ) + dataset = df_to_dataset(self.data) return { "initOptions": asdict(self.init_options), "option": dataset | self.option, diff --git a/echarts4py/experimental.py b/echarts4py/experimental.py new file mode 100644 index 0000000..62770a5 --- /dev/null +++ b/echarts4py/experimental.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from echarts4py._core import BaseOption +from echarts4py.option import ChartOption + +# "boundaryGap": False, +# "splitLine": {"show": True}, +# "axisTick": {"interval": 0.5}, +# "minorTick": {}, + + +class Line_(BaseOption): + """Line Option""" + + CHART_TYPE = "line" + + def __init__(self, x: str, y: str, data=None, **kwargs) -> None: + self.data = data + series = [{"name": y, "data": data[y].to_list(), "type": self.CHART_TYPE}] + self.option = kwargs | { + "x_axis": { + "data": data[x].to_list(), + "type": "category", + }, + "series": series, + } + + def add(self, y: str) -> Line_: + self.option["series"].append( + {"name": y, "data": self.data[y].to_list(), "type": self.CHART_TYPE} + ) + return self + + def to_dict(self) -> dict: + return ChartOption(**self.option).to_dict() diff --git a/echarts4py/express.py b/echarts4py/express.py index 0e6ce40..8553e85 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -1,6 +1,8 @@ from __future__ import annotations -from ._core import BaseOption +from pandas import DataFrame + +from ._core import BaseOption, df_to_dataset, df_to_pie_data from .option import ChartOption @@ -34,7 +36,7 @@ def to_dict(self) -> dict: class Bar(ExpressOption): - """Bar option""" + """Bar Option""" CHART_TYPE = "bar" @@ -56,48 +58,25 @@ class Scatter(ExpressOption): class Pie(BaseOption): + """Pie Option""" + CHART_TYPE = "pie" def __init__( - self, name: str | list, value: str | list, data=None, **kwargs + self, + data: DataFrame | list, + name: str = "name", + value: str = "value", + series_options: dict = dict(), + **kwargs, ) -> None: - self.series = [ - { - "type": self.CHART_TYPE, - "data": [ - {"name": row[0], "value": row[1]} - for row in data[[name, value]].to_numpy() - ], - } - ] + if isinstance(data, DataFrame): + data = df_to_pie_data(data, name, value) + + self.series = [series_options | {"type": self.CHART_TYPE, "data": data}] self.option = ( kwargs | {"x_axis": None, "y_axis": None} | {"series": self.series} ) def to_dict(self) -> dict: return ChartOption(**self.option).to_dict() - - -# --- -class Line_(BaseOption): - """Line Option""" - - CHART_TYPE = "line" - - def __init__(self, x: str, y: str, data=None, **kwargs) -> None: - self.data = data - series = [{"name": y, "data": data[y].to_list(), "type": self.CHART_TYPE}] - self.option = kwargs | { - "x_axis": {"data": data[x].to_list()}, - "y_axis": {"axisLine": {"show": True}}, - "series": series, - } - - def add(self, y: str) -> Line_: - self.option["series"].append( - {"name": y, "data": self.data[y].to_list(), "type": self.CHART_TYPE} - ) - return self - - def to_dict(self) -> dict: - return ChartOption(**self.option).to_dict() diff --git a/srcjs/index.js b/srcjs/index.js index 07ba481..3d21658 100644 --- a/srcjs/index.js +++ b/srcjs/index.js @@ -5,10 +5,12 @@ class EChartsOutputBinding extends Shiny.OutputBinding { return scope.find(".shiny-echarts-output"); } + // TODO: Remove data, it it alread included in 'option' renderValue(el, { data, initOptions, option, theme }) { - console.log(data, initOptions, option, theme); + console.log(initOptions, option, theme); const chart = echarts.init(el, theme, initOptions); chart.setOption(option); + console.log("current options", chart.getOption()); } } diff --git a/tests/test_express.py b/tests/test_express.py index 0d8696f..a538414 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,4 +1,6 @@ -from echarts4py.express import Bar, Line, Line_, Pie +from echarts4py._core import Line as LineNew +from echarts4py.experimental import Line_ +from echarts4py.express import Bar, Line, Pie from pandas import DataFrame @@ -16,6 +18,12 @@ def test_line(): print(chart_option.to_dict()) +def test_line_new(): + chart_option = LineNew(x="a", y="b") + + print(chart_option.to_dict()) + + def test_pie(): data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) From 9028e48adf151b1e13a58fbaf6589d9a28a67497 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 00:15:54 +0100 Subject: [PATCH 09/18] Allow to pass data to express options --- docs/examples/getting_started/basic_usage_express.py | 6 ++++-- echarts4py/_core.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 0c94452..f2795f7 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -68,12 +68,14 @@ def render_bars(): [[10, 5, 4], [0, 8, 3], [6, 10, 12], [2, 12, 6], [8, 9, 7]], columns=["x", "y", "z"] ) -scatter = Scatter("x", "y", legend={}).add_series("z", series_options={"type": "bar"}) +scatter = Scatter("x", "y", legend={}, data=scatter_data).add_series( + "z", series_options={"type": "bar"} +) @ChartRenderer def render_scatter(): - return Chart(options, data=scatter_data).set_option(scatter) + return Chart(options).set_option(scatter) # Pie chart diff --git a/echarts4py/_core.py b/echarts4py/_core.py index b69a49a..dcff2e2 100644 --- a/echarts4py/_core.py +++ b/echarts4py/_core.py @@ -63,6 +63,9 @@ def __init__( x_axis = dict(type="category") if self.CHART_TYPE == "bar" else dict() series = [self._create_series(x, y, series_options)] defaults = dict(xAxis=x_axis, yAxis=dict()) + if isinstance(data, DataFrame): + defaults.update(df_to_dataset(data)) + self.option = defaults | kwargs | {"series": series} def add_series(self, y: str, series_options: dict = None) -> BaseOptionXY: From c9f7907722cfadfec65afd5f779e9d8101bb099c Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 00:44:32 +0100 Subject: [PATCH 10/18] Make data optional in pie chart --- docs/examples/getting_started/basic_usage_express.py | 9 +++++---- echarts4py/_core.py | 7 ++----- echarts4py/chart.py | 7 ++++++- echarts4py/express.py | 7 ++++++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index f2795f7..f29a2f7 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -79,20 +79,21 @@ def render_scatter(): # Pie chart -# pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["name", "value"]) -pie_data = [dict(name=x, value=y) for x, y in zip(["A", "B", "C", "D"], [10, 40, 5, 9])] +pie_data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["name", "value"]) +# pie_data = [dict(name=x, value=y) for x, y in zip(["A", "B", "C", "D"], [10, 40, 5, 9])] pie = Pie( - data=pie_data, + # data=pie_data series_options=dict(roseType="area"), legend=dict(), tooltip=dict(trigger="item"), + title={"text": "Awesome", "x": "right"}, ) @ChartRenderer def render_pie(): - return Chart(options).set_option(pie) + return Chart(options, data=pie_data).set_option(pie) # --- diff --git a/echarts4py/_core.py b/echarts4py/_core.py index dcff2e2..5413ba2 100644 --- a/echarts4py/_core.py +++ b/echarts4py/_core.py @@ -11,12 +11,9 @@ def snake_to_camel_case(snake_str: str) -> str: return snake_str[0].lower() + snake_str.title()[1:].replace("_", "") +# TODO: Do not check for DataFrame instance here def df_to_dataset(df: DataFrame = None) -> dict: - return ( - {"dataset": {"source": [df.columns.to_list()] + df.to_numpy().tolist()}} - if isinstance(df, DataFrame) - else {} - ) + return {"dataset": {"source": [df.columns.to_list()] + df.to_numpy().tolist()}} def df_to_pie_data(df: DataFrame, name: str, value: str) -> list: diff --git a/echarts4py/chart.py b/echarts4py/chart.py index a52893f..9a29638 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -31,6 +31,9 @@ def __init__( self.data = data self.option = dict() + def set_pie_data(self, data: DataFrame) -> Chart: + pass + def set_option( self, option: dict | ChartOption | ExpressOption | BaseOption ) -> Chart: @@ -38,7 +41,9 @@ def set_option( return self def to_dict(self) -> dict: - dataset = df_to_dataset(self.data) + dataset = ( + df_to_dataset(self.data) if isinstance(self.data, DataFrame) else dict() + ) return { "initOptions": asdict(self.init_options), "option": dataset | self.option, diff --git a/echarts4py/express.py b/echarts4py/express.py index 8553e85..344595d 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -7,6 +7,7 @@ # TODO: Make it private +# TODO: OBSOLETE class ExpressOption(BaseOption): """Base Express Option""" @@ -35,6 +36,7 @@ def to_dict(self) -> dict: return self.to_option().to_dict() +# TODO: OBSOLETE class Bar(ExpressOption): """Bar Option""" @@ -45,18 +47,21 @@ def __init__(self, x: str, y: str, **kwargs) -> None: self.kwargs = kwargs | {"x_axis": {"type": "category"}} +# TODO: OBSOLETE class Line(ExpressOption): """Line Option""" CHART_TYPE = "line" +# TODO: OBSOLETE class Scatter(ExpressOption): """Scatter Option""" CHART_TYPE = "scatter" +# TODO: Move to '_core' class Pie(BaseOption): """Pie Option""" @@ -64,7 +69,7 @@ class Pie(BaseOption): def __init__( self, - data: DataFrame | list, + data: DataFrame | list = None, name: str = "name", value: str = "value", series_options: dict = dict(), From 0423e0c16912cbabdc90def75aa9d50f0189de10 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:05:57 +0100 Subject: [PATCH 11/18] Refactor --- .../getting_started/basic_usage_express.py | 3 +- echarts4py/experimental.py | 2 +- echarts4py/express.py | 29 +--------- echarts4py/option.py | 27 --------- echarts4py/options.py | 56 +++++++++++++++++++ tests/test_chart_option.py | 2 +- tests/test_express.py | 45 ++++++++------- 7 files changed, 85 insertions(+), 79 deletions(-) delete mode 100644 echarts4py/option.py create mode 100644 echarts4py/options.py diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index f29a2f7..432612d 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,11 +1,10 @@ from echarts4py._core import Bar, Line, Scatter from echarts4py.chart import Chart, InitOptions from echarts4py.experimental import Line_ -from echarts4py.express import Pie from echarts4py.option import ChartOption +from echarts4py.options import Pie from echarts4py.renderer import ChartRenderer from pandas import DataFrame - # Must always be imported, otherwise App is not found from shiny.express import ui diff --git a/echarts4py/experimental.py b/echarts4py/experimental.py index 62770a5..9084c0d 100644 --- a/echarts4py/experimental.py +++ b/echarts4py/experimental.py @@ -1,7 +1,7 @@ from __future__ import annotations from echarts4py._core import BaseOption -from echarts4py.option import ChartOption +from echarts4py.options import ChartOption # "boundaryGap": False, # "splitLine": {"show": True}, diff --git a/echarts4py/express.py b/echarts4py/express.py index 344595d..5412623 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -1,9 +1,7 @@ from __future__ import annotations -from pandas import DataFrame - -from ._core import BaseOption, df_to_dataset, df_to_pie_data -from .option import ChartOption +from ._core import BaseOption +from .options import ChartOption # TODO: Make it private @@ -62,26 +60,3 @@ class Scatter(ExpressOption): # TODO: Move to '_core' -class Pie(BaseOption): - """Pie Option""" - - CHART_TYPE = "pie" - - def __init__( - self, - data: DataFrame | list = None, - name: str = "name", - value: str = "value", - series_options: dict = dict(), - **kwargs, - ) -> None: - if isinstance(data, DataFrame): - data = df_to_pie_data(data, name, value) - - self.series = [series_options | {"type": self.CHART_TYPE, "data": data}] - self.option = ( - kwargs | {"x_axis": None, "y_axis": None} | {"series": self.series} - ) - - def to_dict(self) -> dict: - return ChartOption(**self.option).to_dict() diff --git a/echarts4py/option.py b/echarts4py/option.py deleted file mode 100644 index 4c55473..0000000 --- a/echarts4py/option.py +++ /dev/null @@ -1,27 +0,0 @@ -from dataclasses import dataclass, field - -from ._core import BaseDataClass - - -@dataclass -class ChartOption(BaseDataClass): - """Chart option - - Note: - See also [Option](https://echarts.apache.org/en/option.html). - """ - - title: dict = None - legend: dict = None - grid: dict = None - x_axis: dict = field(default_factory=dict) - y_axis: dict = field(default_factory=dict) - polar: dict = None - radius_axis: dict = None - angle_axis: dict = None - radar: dict = None - data_zoom: list = None - visual_map: list = None - tooltip: dict = None - # ... - series: list = field(default_factory=list) diff --git a/echarts4py/options.py b/echarts4py/options.py new file mode 100644 index 0000000..dee98d1 --- /dev/null +++ b/echarts4py/options.py @@ -0,0 +1,56 @@ +from __future__ import annotations + +from dataclasses import dataclass, field + +from pandas import DataFrame + +from ._core import BaseDataClass, BaseOption, df_to_pie_data + + +@dataclass +class ChartOption(BaseDataClass): + """Chart option + + Note: + See also [Option](https://echarts.apache.org/en/option.html). + """ + + title: dict = None + legend: dict = None + grid: dict = None + x_axis: dict = field(default_factory=dict) + y_axis: dict = field(default_factory=dict) + polar: dict = None + radius_axis: dict = None + angle_axis: dict = None + radar: dict = None + data_zoom: list = None + visual_map: list = None + tooltip: dict = None + # ... + series: list = field(default_factory=list) + + +class Pie(BaseOption): + """Pie Option""" + + CHART_TYPE = "pie" + + def __init__( + self, + series_options: dict = dict(), + data: DataFrame | list = None, + name: str = "name", + value: str = "value", + **kwargs, + ) -> None: + if isinstance(data, DataFrame): + data = df_to_pie_data(data, name, value) + + self.series = [series_options | {"type": self.CHART_TYPE, "data": data}] + self.option = ( + kwargs | {"x_axis": None, "y_axis": None} | {"series": self.series} + ) + + def to_dict(self) -> dict: + return ChartOption(**self.option).to_dict() diff --git a/tests/test_chart_option.py b/tests/test_chart_option.py index 5d51afa..8a328f5 100644 --- a/tests/test_chart_option.py +++ b/tests/test_chart_option.py @@ -1,4 +1,4 @@ -from echarts4py.option import ChartOption +from echarts4py.options import ChartOption def test_chart_options(): diff --git a/tests/test_express.py b/tests/test_express.py index a538414..0bbb14d 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,42 +1,45 @@ -from echarts4py._core import Line as LineNew -from echarts4py.experimental import Line_ -from echarts4py.express import Bar, Line, Pie +from echarts4py._core import Bar, Line, Scatter +from echarts4py.options import Pie from pandas import DataFrame def test_bar(): + # Act chart_option = Bar(x="a", y="b", legend={}) - print(chart_option.to_option()) - - print(chart_option.to_dict()) + # Assert + print("bar option", chart_option.to_dict()) + # print(sorted(list(chart_option.to_dict().keys()))) + assert sorted(list(chart_option.to_dict().keys())) == sorted( + ["xAxis", "yAxis", "legend", "series"] + ) def test_line(): + # Act chart_option = Line(x="a", y="b") - print(chart_option.to_dict()) + # Assert + print("line option", chart_option.to_dict()) + assert list(chart_option.to_dict().keys()) == ["xAxis", "yAxis", "series"] -def test_line_new(): - chart_option = LineNew(x="a", y="b") +def test_scatter(): + # Act + chart_option = Scatter(x="a", y="b") - print(chart_option.to_dict()) + # Assert + print("scatter option", chart_option.to_dict()) + assert list(chart_option.to_dict().keys()) == ["xAxis", "yAxis", "series"] def test_pie(): + # Prepare data = DataFrame([["A", 10], ["B", 20], ["C", 40]], columns=["Category", "Value"]) + # Act chart_option = Pie(data=data, name="Category", value="Value") - print(chart_option.series) - print(chart_option.to_dict()) - - -# --- -def test_line2(): - data = DataFrame([["1", 10], [2, 4]], columns=["x", "y"]) - - chart_option = Line_(x="x", y="y", data=data) - - print("line2", chart_option.to_dict()) + # Assert + # print(chart_option.series) + print("pie option", chart_option.to_dict()) From 5d0fa8ea873c443edbbf7816213a002fb8a17121 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:11:13 +0100 Subject: [PATCH 12/18] Add test for chart --- echarts4py/chart.py | 7 ++----- echarts4py/express.py | 28 ---------------------------- tests/test_chart.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 33 deletions(-) create mode 100644 tests/test_chart.py diff --git a/echarts4py/chart.py b/echarts4py/chart.py index 9a29638..103185b 100644 --- a/echarts4py/chart.py +++ b/echarts4py/chart.py @@ -6,8 +6,7 @@ from pandas import DataFrame from ._core import BaseOption, df_to_dataset -from .express import ExpressOption -from .option import ChartOption +from .options import ChartOption @dataclass @@ -34,9 +33,7 @@ def __init__( def set_pie_data(self, data: DataFrame) -> Chart: pass - def set_option( - self, option: dict | ChartOption | ExpressOption | BaseOption - ) -> Chart: + def set_option(self, option: dict | ChartOption | BaseOption) -> Chart: self.option = option if isinstance(option, dict) else option.to_dict() return self diff --git a/echarts4py/express.py b/echarts4py/express.py index 5412623..9df2a44 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -32,31 +32,3 @@ def to_option(self) -> ChartOption: def to_dict(self) -> dict: return self.to_option().to_dict() - - -# TODO: OBSOLETE -class Bar(ExpressOption): - """Bar Option""" - - CHART_TYPE = "bar" - - def __init__(self, x: str, y: str, **kwargs) -> None: - super().__init__(x, y, **kwargs) - self.kwargs = kwargs | {"x_axis": {"type": "category"}} - - -# TODO: OBSOLETE -class Line(ExpressOption): - """Line Option""" - - CHART_TYPE = "line" - - -# TODO: OBSOLETE -class Scatter(ExpressOption): - """Scatter Option""" - - CHART_TYPE = "scatter" - - -# TODO: Move to '_core' diff --git a/tests/test_chart.py b/tests/test_chart.py new file mode 100644 index 0000000..fac6a7f --- /dev/null +++ b/tests/test_chart.py @@ -0,0 +1,10 @@ +from echarts4py.chart import Chart, InitOptions +from echarts4py.options import Pie + + +def test_chart(): + options = InitOptions(height=600, width=400) + chart = Chart(init_options=options).set_option(Pie()) + + # Assert + print("chart", chart.to_dict()) From cc36e9b734c967893181961a65cf7af99bfaa905 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:15:46 +0100 Subject: [PATCH 13/18] Move options --- .../getting_started/basic_usage_express.py | 6 ++---- echarts4py/_core.py | 20 ------------------- echarts4py/experimental.py | 2 +- echarts4py/options.py | 20 ++++++++++++++++++- tests/test_express.py | 3 +-- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 432612d..6e641b5 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,10 +1,8 @@ -from echarts4py._core import Bar, Line, Scatter from echarts4py.chart import Chart, InitOptions -from echarts4py.experimental import Line_ -from echarts4py.option import ChartOption -from echarts4py.options import Pie +from echarts4py.options import Bar, ChartOption, Line, Pie, Scatter from echarts4py.renderer import ChartRenderer from pandas import DataFrame + # Must always be imported, otherwise App is not found from shiny.express import ui diff --git a/echarts4py/_core.py b/echarts4py/_core.py index 5413ba2..cc62b23 100644 --- a/echarts4py/_core.py +++ b/echarts4py/_core.py @@ -4,8 +4,6 @@ from pandas import DataFrame -# from .option import ChartOption - def snake_to_camel_case(snake_str: str) -> str: return snake_str[0].lower() + snake_str.title()[1:].replace("_", "") @@ -68,21 +66,3 @@ def __init__( def add_series(self, y: str, series_options: dict = None) -> BaseOptionXY: self.option["series"].append(self._create_series(self.x, y, series_options)) return self - - -class Line(BaseOptionXY): - """Line Option""" - - CHART_TYPE = "line" - - -class Bar(BaseOptionXY): - """Bar Option""" - - CHART_TYPE = "bar" - - -class Scatter(BaseOptionXY): - """Scatter Option""" - - CHART_TYPE = "scatter" diff --git a/echarts4py/experimental.py b/echarts4py/experimental.py index 9084c0d..a58151d 100644 --- a/echarts4py/experimental.py +++ b/echarts4py/experimental.py @@ -9,7 +9,7 @@ # "minorTick": {}, -class Line_(BaseOption): +class Line(BaseOption): """Line Option""" CHART_TYPE = "line" diff --git a/echarts4py/options.py b/echarts4py/options.py index dee98d1..5d86fba 100644 --- a/echarts4py/options.py +++ b/echarts4py/options.py @@ -4,7 +4,7 @@ from pandas import DataFrame -from ._core import BaseDataClass, BaseOption, df_to_pie_data +from ._core import BaseDataClass, BaseOption, BaseOptionXY, df_to_pie_data @dataclass @@ -54,3 +54,21 @@ def __init__( def to_dict(self) -> dict: return ChartOption(**self.option).to_dict() + + +class Line(BaseOptionXY): + """Line Option""" + + CHART_TYPE = "line" + + +class Bar(BaseOptionXY): + """Bar Option""" + + CHART_TYPE = "bar" + + +class Scatter(BaseOptionXY): + """Scatter Option""" + + CHART_TYPE = "scatter" diff --git a/tests/test_express.py b/tests/test_express.py index 0bbb14d..a9313ce 100644 --- a/tests/test_express.py +++ b/tests/test_express.py @@ -1,5 +1,4 @@ -from echarts4py._core import Bar, Line, Scatter -from echarts4py.options import Pie +from echarts4py.options import Bar, Line, Pie, Scatter from pandas import DataFrame From 3503dc630c48ace66dc29d237d5b9fe470f2c924 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:20:10 +0100 Subject: [PATCH 14/18] Refactor express --- .../getting_started/basic_usage_express.py | 8 ----- echarts4py/express.py | 33 +++++-------------- tests/{test_express.py => test_options.py} | 0 3 files changed, 8 insertions(+), 33 deletions(-) rename tests/{test_express.py => test_options.py} (100%) diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 6e641b5..0b0cfb7 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -91,11 +91,3 @@ def render_scatter(): @ChartRenderer def render_pie(): return Chart(options, data=pie_data).set_option(pie) - - -# --- -@ChartRenderer -def render_lines_(): - return Chart(options).set_option( - Line_(data=line_data, x="a", y="b", legend=dict()) # .add("c").add("d") - ) diff --git a/echarts4py/express.py b/echarts4py/express.py index 9df2a44..dd768f4 100644 --- a/echarts4py/express.py +++ b/echarts4py/express.py @@ -1,34 +1,17 @@ from __future__ import annotations -from ._core import BaseOption -from .options import ChartOption +class PieChart(object): + pass -# TODO: Make it private -# TODO: OBSOLETE -class ExpressOption(BaseOption): - """Base Express Option""" - CHART_TYPE: str = "line" +class BarChart(object): + pass - series: list = list() - kwargs: dict = dict() - def __init__(self, x: str = None, y: str = None, **kwargs) -> None: - self.x = x - self.series = [self._create_series(x, y)] - self.kwargs = kwargs +class LineChart(object): + pass - def _create_series(self, x: str, y: str) -> dict: - return {"name": y, "type": self.CHART_TYPE, "encode": {"x": x, "y": y}} - def add_series(self, y: str) -> ExpressOption: - self.series.append(self._create_series(self.x, y)) - return self - - def to_option(self) -> ChartOption: - kwargs = self.kwargs | {"series": self.series} - return ChartOption(**kwargs) - - def to_dict(self) -> dict: - return self.to_option().to_dict() +class ScatterChart(object): + pass diff --git a/tests/test_express.py b/tests/test_options.py similarity index 100% rename from tests/test_express.py rename to tests/test_options.py From e92fd7428fdd4e9990e1e6d8a50cb1fd595652e8 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:21:51 +0100 Subject: [PATCH 15/18] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fcb2ca..9b60b93 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ pip install git+https://github.com/eodaGmbH/py-shiny-echarts ```python from echarts4py.chart import Chart, InitOptions -from echarts4py.option import ChartOption +from echarts4py.options import ChartOption from echarts4py.renderer import ChartRenderer from pandas import DataFrame From 499f4171d6cefa68af68802cb7b982c4d27286e0 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 08:30:48 +0100 Subject: [PATCH 16/18] Update README --- README.md | 18 +++++++----------- docs/examples/getting_started/basic_usage.py | 18 +++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9b60b93..3a75b46 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ pip install git+https://github.com/eodaGmbH/py-shiny-echarts ```python from echarts4py.chart import Chart, InitOptions -from echarts4py.options import ChartOption +from echarts4py.options import Line from echarts4py.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found from shiny.express import ui -options = InitOptions(width=600, height=400, renderer="canvas") +init_options = InitOptions(width=600, height=400, renderer="canvas") data = DataFrame( [[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]], @@ -32,20 +32,16 @@ data = DataFrame( ) -lines = ChartOption( - tooltip={"trigger": "axis"}, - legend={}, - series=[ - {"name": "L1", "type": "line", "encode": {"x": 0, "y": 1}}, - {"name": "L2", "type": "line", "encode": {"x": 0, "y": 2}}, - {"name": "L3", "type": "line", "encode": {"x": 0, "y": 3}}, - ], +lines = ( + Line(x="a", y="b", tooltip=dict(trigger="axis"), legend=dict()) + .add_series("c") + .add_series("d") ) @ChartRenderer def render_dataset(): - return Chart(options, data=data).set_option(lines) + return Chart(init_options, data=data).set_option(lines) ``` ```bash diff --git a/docs/examples/getting_started/basic_usage.py b/docs/examples/getting_started/basic_usage.py index 2bae781..6d79412 100644 --- a/docs/examples/getting_started/basic_usage.py +++ b/docs/examples/getting_started/basic_usage.py @@ -1,12 +1,12 @@ from echarts4py.chart import Chart, InitOptions -from echarts4py.option import ChartOption +from echarts4py.options import Line from echarts4py.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found from shiny.express import ui -options = InitOptions(width=600, height=400, renderer="canvas") +init_options = InitOptions(width=600, height=400, renderer="canvas") data = DataFrame( [[0, 1, 2, 3], [1, 4, 5, 6], [2, -2, 4, 9]], @@ -14,17 +14,13 @@ ) -lines = ChartOption( - tooltip={"trigger": "axis"}, - legend={}, - series=[ - {"name": "L1", "type": "line", "encode": {"x": "a", "y": "b"}}, - {"name": "L2", "type": "line", "encode": {"x": "a", "y": "d"}}, - {"name": "L3", "type": "line", "encode": {"x": 0, "y": "c"}}, - ], +lines = ( + Line(x="a", y="b", tooltip=dict(trigger="axis"), legend=dict()) + .add_series("c") + .add_series("d") ) @ChartRenderer def render_dataset(): - return Chart(options, data=data).set_option(lines) + return Chart(init_options, data=data).set_option(lines) From e3f2199594ca1cb94a01c3a04b233e4c0486b5b9 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Fri, 9 Feb 2024 09:24:59 +0100 Subject: [PATCH 17/18] Rename package to 'shinyecharts' --- README.md | 7 +++---- docs/examples/getting_started/app.py | 4 ++-- docs/examples/getting_started/basic_usage.py | 6 +++--- docs/examples/getting_started/basic_usage_express.py | 6 +++--- {echarts4py => shinyecharts}/__init__.py | 0 {echarts4py => shinyecharts}/_core.py | 0 {echarts4py => shinyecharts}/chart.py | 0 {echarts4py => shinyecharts}/experimental.py | 4 ++-- {echarts4py => shinyecharts}/express.py | 0 {echarts4py => shinyecharts}/options.py | 0 {echarts4py => shinyecharts}/renderer.py | 0 {echarts4py => shinyecharts}/srcjs/echarts-bindings.js | 2 +- {echarts4py => shinyecharts}/ui.py | 2 +- tests/test_chart.py | 4 ++-- tests/test_chart_option.py | 2 +- tests/test_options.py | 2 +- 16 files changed, 19 insertions(+), 20 deletions(-) rename {echarts4py => shinyecharts}/__init__.py (100%) rename {echarts4py => shinyecharts}/_core.py (100%) rename {echarts4py => shinyecharts}/chart.py (100%) rename {echarts4py => shinyecharts}/experimental.py (90%) rename {echarts4py => shinyecharts}/express.py (100%) rename {echarts4py => shinyecharts}/options.py (100%) rename {echarts4py => shinyecharts}/renderer.py (100%) rename {echarts4py => shinyecharts}/srcjs/echarts-bindings.js (99%) rename {echarts4py => shinyecharts}/ui.py (90%) diff --git a/README.md b/README.md index 3a75b46..47c3c8f 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ pip install git+https://github.com/eodaGmbH/py-shiny-echarts ## Basic usage ```python -from echarts4py.chart import Chart, InitOptions -from echarts4py.options import Line -from echarts4py.renderer import ChartRenderer +from shinyecharts.chart import Chart, InitOptions +from shinyecharts.options import Line +from shinyecharts.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found @@ -31,7 +31,6 @@ data = DataFrame( columns=["a", "b", "c", "d"], ) - lines = ( Line(x="a", y="b", tooltip=dict(trigger="axis"), legend=dict()) .add_series("c") diff --git a/docs/examples/getting_started/app.py b/docs/examples/getting_started/app.py index e8f72d0..ce871f7 100644 --- a/docs/examples/getting_started/app.py +++ b/docs/examples/getting_started/app.py @@ -1,7 +1,7 @@ -from echarts4py.chart import Chart, InitOptions -from echarts4py.renderer import ChartRenderer from pandas import DataFrame from shiny.express import ui +from shinyecharts.chart import Chart, InitOptions +from shinyecharts.renderer import ChartRenderer options = InitOptions(width=600, height=400) diff --git a/docs/examples/getting_started/basic_usage.py b/docs/examples/getting_started/basic_usage.py index 6d79412..cc46d15 100644 --- a/docs/examples/getting_started/basic_usage.py +++ b/docs/examples/getting_started/basic_usage.py @@ -1,10 +1,10 @@ -from echarts4py.chart import Chart, InitOptions -from echarts4py.options import Line -from echarts4py.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found from shiny.express import ui +from shinyecharts.chart import Chart, InitOptions +from shinyecharts.options import Line +from shinyecharts.renderer import ChartRenderer init_options = InitOptions(width=600, height=400, renderer="canvas") diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 0b0cfb7..3d2055e 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -1,10 +1,10 @@ -from echarts4py.chart import Chart, InitOptions -from echarts4py.options import Bar, ChartOption, Line, Pie, Scatter -from echarts4py.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found from shiny.express import ui +from shinyecharts.chart import Chart, InitOptions +from shinyecharts.options import Bar, ChartOption, Line, Pie, Scatter +from shinyecharts.renderer import ChartRenderer # General options options = InitOptions(width=600, height=400, renderer="canvas") diff --git a/echarts4py/__init__.py b/shinyecharts/__init__.py similarity index 100% rename from echarts4py/__init__.py rename to shinyecharts/__init__.py diff --git a/echarts4py/_core.py b/shinyecharts/_core.py similarity index 100% rename from echarts4py/_core.py rename to shinyecharts/_core.py diff --git a/echarts4py/chart.py b/shinyecharts/chart.py similarity index 100% rename from echarts4py/chart.py rename to shinyecharts/chart.py diff --git a/echarts4py/experimental.py b/shinyecharts/experimental.py similarity index 90% rename from echarts4py/experimental.py rename to shinyecharts/experimental.py index a58151d..4e06379 100644 --- a/echarts4py/experimental.py +++ b/shinyecharts/experimental.py @@ -1,7 +1,7 @@ from __future__ import annotations -from echarts4py._core import BaseOption -from echarts4py.options import ChartOption +from shinyecharts._core import BaseOption +from shinyecharts.options import ChartOption # "boundaryGap": False, # "splitLine": {"show": True}, diff --git a/echarts4py/express.py b/shinyecharts/express.py similarity index 100% rename from echarts4py/express.py rename to shinyecharts/express.py diff --git a/echarts4py/options.py b/shinyecharts/options.py similarity index 100% rename from echarts4py/options.py rename to shinyecharts/options.py diff --git a/echarts4py/renderer.py b/shinyecharts/renderer.py similarity index 100% rename from echarts4py/renderer.py rename to shinyecharts/renderer.py diff --git a/echarts4py/srcjs/echarts-bindings.js b/shinyecharts/srcjs/echarts-bindings.js similarity index 99% rename from echarts4py/srcjs/echarts-bindings.js rename to shinyecharts/srcjs/echarts-bindings.js index 03db23a..f486eae 100644 --- a/echarts4py/srcjs/echarts-bindings.js +++ b/shinyecharts/srcjs/echarts-bindings.js @@ -36,7 +36,7 @@ `:"
",g=p.join(m);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t,u)?this._updatePosition(s,h,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,g,u,Math.random()+"",o[0],o[1],h,null,c)})},e.prototype._showSeriesItemTooltip=function(t,i,a){var n=this._ecModel,o=et(i),s=o.seriesIndex,l=n.getSeriesByIndex(s),u=o.dataModel||l,f=o.dataIndex,p=o.dataType,c=u.getData(p),h=this._renderMode,v=t.positionDefault,d=op([c.getItemModel(f),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,v?{position:v}:null),m=d.get("trigger");if(!(m!=null&&m!=="item")){var g=u.getDataParams(f,p),y=new _h;g.marker=y.makeTooltipMarker("item",Ni(g.color),h);var x=xy(u.formatTooltip(f,!1,p)),_=d.get("order"),b=d.get("valueFormatter"),S=x.frag,T=S?Ay(b?N({valueFormatter:b},S):S,y,h,_,n.get("useUTC"),d.get("textStyle")):x.text,C="item_"+u.name+"_"+f;this._showOrMove(d,function(){this._showTooltipContent(d,T,g,C,t.offsetX,t.offsetY,t.position,t.target,y)}),a({type:"showTip",dataIndexInside:f,dataIndex:c.getRawIndex(f),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,i,a){var n=et(i),o=n.tooltipConfig,s=o.option||{};if(B(s)){var l=s;s={content:l,formatter:l}}var u=[s],f=this._ecModel.getComponent(n.componentMainType,n.componentIndex);f&&u.push(f),u.push({formatter:s.content});var p=t.positionDefault,c=op(u,this._tooltipModel,p?{position:p}:null),h=c.get("content"),v=Math.random()+"",d=new _h;this._showOrMove(c,function(){var m=J(c.get("formatterParams")||{});this._showTooltipContent(c,h,m,v,t.offsetX,t.offsetY,t.position,i,d)}),a({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,i,a,n,o,s,l,u,f){if(this._ticket="",!(!t.get("showContent")||!t.get("show"))){var p=this._tooltipContent;p.setEnterable(t.get("enterable"));var c=t.get("formatter");l=l||t.get("position");var h=i,v=this._getNearestPoint([o,s],a,t.get("trigger"),t.get("borderColor")),d=v.color;if(c)if(B(c)){var m=t.ecModel.get("useUTC"),g=z(a)?a[0]:a,y=g&&g.axisType&&g.axisType.indexOf("time")>=0;h=c,y&&(h=Go(g.axisValue,h,m)),h=th(h,a,!0)}else if(Z(c)){var x=W(function(_,b){_===this._ticket&&(p.setContent(b,f,t,d,l),this._updatePosition(t,l,o,s,p,a,u))},this);this._ticket=n,h=c(a,n,x)}else h=c;p.setContent(h,f,t,d,l),p.show(t,d),this._updatePosition(t,l,o,s,p,a,u)}},e.prototype._getNearestPoint=function(t,i,a,n){if(a==="axis"||z(i))return{color:n||(this._renderMode==="html"?"#fff":"none")};if(!z(i))return{color:n||i.color||i.borderColor}},e.prototype._updatePosition=function(t,i,a,n,o,s,l){var u=this._api.getWidth(),f=this._api.getHeight();i=i||t.get("position");var p=o.getSize(),c=t.get("align"),h=t.get("verticalAlign"),v=l&&l.getBoundingRect().clone();if(l&&v.applyTransform(l.transform),Z(i)&&(i=i([a,n],s,o.el,v,{viewSize:[u,f],contentSize:p.slice()})),z(i))a=H(i[0],u),n=H(i[1],f);else if(K(i)){var d=i;d.width=p[0],d.height=p[1];var m=Ft(d,{width:u,height:f});a=m.x,n=m.y,c=null,h=null}else if(B(i)&&l){var g=z9(i,v,p,t.get("borderWidth"));a=g[0],n=g[1]}else{var g=O9(a,n,o,u,f,c?null:20,h?null:20);a=g[0],n=g[1]}if(c&&(a-=WN(c)?p[0]/2:c==="right"?p[0]:0),h&&(n-=WN(h)?p[1]/2:h==="bottom"?p[1]:0),Rd(t)){var g=N9(a,n,o,u,f);a=g[0],n=g[1]}o.moveTo(a,n)},e.prototype._updateContentNotChangedOnAxis=function(t,i){var a=this._lastDataByCoordSys,n=this._cbParamsList,o=!!a&&a.length===t.length;return o&&w(a,function(s,l){var u=s.dataByAxis||[],f=t[l]||{},p=f.dataByAxis||[];o=o&&u.length===p.length,o&&w(u,function(c,h){var v=p[h]||{},d=c.seriesDataIndices||[],m=v.seriesDataIndices||[];o=o&&c.value===v.value&&c.axisType===v.axisType&&c.axisId===v.axisId&&d.length===m.length,o&&w(d,function(g,y){var x=m[y];o=o&&g.seriesIndex===x.seriesIndex&&g.dataIndex===x.dataIndex}),n&&w(c.seriesDataIndices,function(g){var y=g.seriesIndex,x=i[y],_=n[y];x&&_&&_.data!==x.data&&(o=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=i,!!o},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,i){bt.node||!i.getDom()||(Ha(this,"_updatePosition"),this._tooltipContent.dispose(),rp("itemTooltip",i))},e.type="tooltip",e}(Rt);function op(r,e,t){var i=e.ecModel,a;t?(a=new It(t,i,i),a=new It(e.option,a,i)):a=e;for(var n=r.length-1;n>=0;n--){var o=r[n];o&&(o instanceof It&&(o=o.get("tooltip",!0)),B(o)&&(o={formatter:o}),o&&(a=new It(o,a,i)))}return a}function HN(r,e){return r.dispatchAction||W(e.dispatchAction,e)}function O9(r,e,t,i,a,n,o){var s=t.getSize(),l=s[0],u=s[1];return n!=null&&(r+l+n+2>i?r-=l+n:r+=n),o!=null&&(e+u+o>a?e-=u+o:e+=o),[r,e]}function N9(r,e,t,i,a){var n=t.getSize(),o=n[0],s=n[1];return r=Math.min(r+o,i)-o,e=Math.min(e+s,a)-s,r=Math.max(r,0),e=Math.max(e,0),[r,e]}function z9(r,e,t,i){var a=t[0],n=t[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,u=e.width,f=e.height;switch(r){case"inside":s=e.x+u/2-a/2,l=e.y+f/2-n/2;break;case"top":s=e.x+u/2-a/2,l=e.y-n-o;break;case"bottom":s=e.x+u/2-a/2,l=e.y+f+o;break;case"left":s=e.x-a-o,l=e.y+f/2-n/2;break;case"right":s=e.x+u+o,l=e.y+f/2-n/2}return[s,l]}function WN(r){return r==="center"||r==="middle"}function k9(r,e,t){var i=wu(r).queryOptionMap,a=i.keys()[0];if(!(!a||a==="series")){var n=fn(e,a,i.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=n.models[0];if(o){var s=t.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var f=et(u).tooltipConfig;if(f&&f.name===r.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}var YN=R9;function y1(r){_t(Ki),r.registerComponentModel(RN),r.registerComponentView(YN),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Zt),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Zt)}var U9=["rect","polygon","keep","clear"];function x1(r,e){var t=Pt(r?r.brush:[]);if(t.length){var i=[];w(t,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(i=i.concat(u))});var a=r&&r.toolbox;z(a)&&(a=a[0]),a||(a={feature:{}},r.toolbox=[a]);var n=a.feature||(a.feature={}),o=n.brush||(n.brush={}),s=o.type||(o.type=[]);s.push.apply(s,i),V9(s),e&&!s.length&&s.push.apply(s,U9)}}function V9(r){var e={};w(r,function(t){e[t]=1}),r.length=0,w(e,function(t,i){r.push(i)})}var ZN=w;function XN(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function sp(r,e,t){var i={};return ZN(e,function(n){var o=i[n]=a();ZN(r[n],function(s,l){if(ce.isValidType(l)){var u={type:l,visual:s};t&&t(u,n),o[l]=new ce(u),l==="opacity"&&(u=J(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new ce(u))}})}),i;function a(){var n=function(){};n.prototype.__hidden=n.prototype;var o=new n;return o}}function Od(r,e,t){var i;w(t,function(a){e.hasOwnProperty(a)&&XN(e[a])&&(i=!0)}),i&&w(t,function(a){e.hasOwnProperty(a)&&XN(e[a])?r[a]=J(e[a]):delete r[a]})}function qN(r,e,t,i,a,n){var o={};w(r,function(p){var c=ce.prepareVisualTypes(e[p]);o[p]=c});var s;function l(p){return uf(t,s,p)}function u(p,c){Ry(t,s,p,c)}n==null?t.each(f):t.each([n],f);function f(p,c){s=n==null?p:c;var h=t.getRawDataItem(s);if(!(h&&h.visualMap===!1))for(var v=i.call(a,p),d=e[v],m=o[v],g=0,y=m.length;ge[0][1]&&(e[0][1]=n[0]),n[1]e[1][1]&&(e[1][1]=n[1])}return e&&ez(e)}};function ez(r){return new rt(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var W9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.ecModel=t,this.api=i,this.model,(this._brushController=new Pl(i.getZr())).on("brush",W(this._onBrush,this)).mount()},e.prototype.render=function(t,i,a,n){this.model=t,this._updateController(t,i,a,n)},e.prototype.updateTransform=function(t,i,a,n){b1(i),this._updateController(t,i,a,n)},e.prototype.updateVisual=function(t,i,a,n){this.updateTransform(t,i,a,n)},e.prototype.updateView=function(t,i,a,n){this._updateController(t,i,a,n)},e.prototype._updateController=function(t,i,a,n){(!n||n.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(a)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var i=this.model.id,a=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:i,areas:J(a),$from:i}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:i,areas:J(a),$from:i})},e.type="brush",e}(Rt),rz=W9;var Y9="#ddd",Z9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.areas=[],t.brushOption={},t}return e.prototype.optionUpdated=function(t,i){var a=this.option;!i&&Od(a,t,["inBrush","outOfBrush"]);var n=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:Y9},n.hasOwnProperty("liftZ")||(n.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=k(t,function(i){return iz(this.option,i)},this))},e.prototype.setBrushOption=function(t){this.brushOption=iz(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},e}(yt);function iz(r,e){return st({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new It(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var az=Z9;var X9=["rect","polygon","lineX","lineY","keep","clear"],q9=function(r){L(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,i,a){var n,o,s;i.eachComponent({mainType:"brush"},function(l){n=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=n,this._brushMode=o,w(t.get("type",!0),function(l){t.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===n)?"emphasis":"normal")})},e.prototype.updateView=function(t,i,a){this.render(t,i,a)},e.prototype.getIcons=function(){var t=this.model,i=t.get("icon",!0),a={};return w(t.get("type",!0),function(n){i[n]&&(a[n]=i[n])}),a},e.prototype.onclick=function(t,i,a){var n=this._brushType,o=this._brushMode;a==="clear"?(i.dispatchAction({type:"axisAreaSelect",intervals:[]}),i.dispatchAction({type:"brush",command:"clear",areas:[]})):i.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?n:n===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},e.getDefaultOption=function(t){var i={show:!0,type:X9.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:t.getLocaleModel().get(["toolbox","brush","title"])};return i},e}(Ne),nz=q9;function T1(r){r.registerComponentView(rz),r.registerComponentModel(az),r.registerPreprocessor(x1),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,w1),r.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(e,t){t.eachComponent({mainType:"brush",query:e},function(i){i.setAreas(e.areas)})}),r.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},Zt),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},Zt),Xn("brush",nz)}var K9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(yt),j9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,i,a){if(this.group.removeAll(),!!t.get("show")){var n=this.group,o=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=lt(t.get("textBaseline"),t.get("textVerticalAlign")),f=new gt({style:Vt(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),p=f.getBoundingRect(),c=t.get("subtext"),h=new gt({style:Vt(s,{text:c,fill:s.getTextColor(),y:p.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),v=t.get("link"),d=t.get("sublink"),m=t.get("triggerEvent",!0);f.silent=!v&&!m,h.silent=!d&&!m,v&&f.on("click",function(){Ho(v,"_"+t.get("target"))}),d&&h.on("click",function(){Ho(d,"_"+t.get("subtarget"))}),et(f).eventData=et(h).eventData=m?{componentType:"title",componentIndex:t.componentIndex}:null,n.add(f),c&&n.add(h);var g=n.getBoundingRect(),y=t.getBoxLayoutParams();y.width=g.width,y.height=g.height;var x=Ft(y,{width:a.getWidth(),height:a.getHeight()},t.get("padding"));l||(l=t.get("left")||t.get("right"),l==="middle"&&(l="center"),l==="right"?x.x+=x.width:l==="center"&&(x.x+=x.width/2)),u||(u=t.get("top")||t.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?x.y+=x.height:u==="middle"&&(x.y+=x.height/2),u=u||"top"),n.x=x.x,n.y=x.y,n.markRedraw();var _={align:l,verticalAlign:u};f.setStyle(_),h.setStyle(_),g=n.getBoundingRect();var b=x.margin,S=t.getItemStyle(["color","opacity"]);S.fill=t.get("backgroundColor");var T=new ht({shape:{x:g.x-b[3],y:g.y-b[0],width:g.width+b[1]+b[3],height:g.height+b[0]+b[2],r:t.get("borderRadius")},style:S,subPixelOptimize:!0,silent:!0});n.add(T)}},e.type="title",e}(Rt);function C1(r){r.registerComponentModel(K9),r.registerComponentView(j9)}var J9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode="box",t}return e.prototype.init=function(t,i,a){this.mergeDefaultAndTheme(t,a),this._initData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){t==null&&(t=this.option.currentIndex);var i=this._data.count();this.option.loop?t=(t%i+i)%i:(t>=i&&(t=i-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t=this.option,i=t.data||[],a=t.axisType,n=this._names=[],o;a==="category"?(o=[],w(i,function(u,f){var p=ee(Mi(u),""),c;K(u)?(c=J(u),c.value=f):c=f,o.push(c),n.push(p)})):o=i;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new se([{name:"value",type:s}],this);l.initData(o,n)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},e}(yt),A1=J9;var oz=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline.slider",e.defaultOption=rr(A1.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),e}(A1);Ht(oz,il.prototype);var sz=oz;var Q9=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline",e}(Rt),lz=Q9;var $9=function(r){L(e,r);function e(t,i,a,n){var o=r.call(this,t,i,a)||this;return o.type=n||"value",o}return e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},e}(Be),uz=$9;var D1=Math.PI,fz=nt(),tX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,i){this.api=i},e.prototype.render=function(t,i,a){if(this.model=t,this.api=a,this.ecModel=i,this.group.removeAll(),t.get("show",!0)){var n=this._layout(t,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(n,t);t.formatTooltip=function(u){var f=l.scale.getLabel({value:u});return jt("nameValue",{noName:!0,value:f})},w(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](n,o,l,t)},this),this._renderAxisLabel(n,s,l,t),this._position(n,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,i){var a=t.get(["label","position"]),n=t.get("orient"),o=rX(t,i),s;a==null||a==="auto"?s=n==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},f={horizontal:0,vertical:D1/2},p=n==="vertical"?o.height:o.width,c=t.getModel("controlStyle"),h=c.get("show",!0),v=h?c.get("itemSize"):0,d=h?c.get("itemGap"):0,m=v+d,g=t.get(["label","rotate"])||0;g=g*D1/180;var y,x,_,b=c.get("position",!0),S=h&&c.get("showPlayBtn",!0),T=h&&c.get("showPrevBtn",!0),C=h&&c.get("showNextBtn",!0),A=0,D=p;b==="left"||b==="bottom"?(S&&(y=[0,0],A+=m),T&&(x=[A,0],A+=m),C&&(_=[D-v,0],D-=m)):(S&&(y=[D-v,0],D-=m),T&&(x=[0,0],A+=m),C&&(_=[D-v,0],D-=m));var M=[A,D];return t.get("inverse")&&M.reverse(),{viewRect:o,mainLength:p,orient:n,rotation:f[n],labelRotation:g,labelPosOpt:s,labelAlign:t.get(["label","align"])||l[n],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||u[n],playPosition:y,prevBtnPosition:x,nextBtnPosition:_,axisExtent:M,controlSize:v,controlGap:d}},e.prototype._position=function(t,i){var a=this._mainGroup,n=this._labelGroup,o=t.viewRect;if(t.orient==="vertical"){var s=be(),l=o.x,u=o.y+o.height;He(s,s,[-l,-u]),br(s,s,-D1/2),He(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var f=y(o),p=y(a.getBoundingRect()),c=y(n.getBoundingRect()),h=[a.x,a.y],v=[n.x,n.y];v[0]=h[0]=f[0][0];var d=t.labelPosOpt;if(d==null||B(d)){var m=d==="+"?0:1;x(h,p,f,1,m),x(v,c,f,1,1-m)}else{var m=d>=0?0:1;x(h,p,f,1,m),v[1]=h[1]+d}a.setPosition(h),n.setPosition(v),a.rotation=n.rotation=t.rotation,g(a),g(n);function g(_){_.originX=f[0][0]-_.x,_.originY=f[1][0]-_.y}function y(_){return[[_.x,_.x+_.width],[_.y,_.y+_.height]]}function x(_,b,S,T,C){_[T]+=S[T][C]-b[T][C]}},e.prototype._createAxis=function(t,i){var a=i.getData(),n=i.get("axisType"),o=eX(i,n);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new uz("value",o,t.axisExtent,n);return l.model=i,l},e.prototype._createGroup=function(t){var i=this[t]=new j;return this.group.add(i),i},e.prototype._renderAxisLine=function(t,i,a,n){var o=a.getExtent();if(n.get(["lineStyle","show"])){var s=new ie({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:N({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});i.add(s);var l=this._progressLine=new ie({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:X({lineCap:"round",lineWidth:s.style.lineWidth},n.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});i.add(l)}},e.prototype._renderAxisTick=function(t,i,a,n){var o=this,s=n.getData(),l=a.scale.getTicks();this._tickSymbols=[],w(l,function(u){var f=a.dataToCoord(u.value),p=s.getItemModel(u.value),c=p.getModel("itemStyle"),h=p.getModel(["emphasis","itemStyle"]),v=p.getModel(["progress","itemStyle"]),d={x:f,y:0,onclick:W(o._changeTimeline,o,u.value)},m=pz(p,c,i,d);m.ensureState("emphasis").style=h.getItemStyle(),m.ensureState("progress").style=v.getItemStyle(),oa(m);var g=et(m);p.get("tooltip")?(g.dataIndex=u.value,g.dataModel=n):g.dataIndex=g.dataModel=null,o._tickSymbols.push(m)})},e.prototype._renderAxisLabel=function(t,i,a,n){var o=this,s=a.getLabelModel();if(s.get("show")){var l=n.getData(),u=a.getViewLabels();this._tickLabels=[],w(u,function(f){var p=f.tickValue,c=l.getItemModel(p),h=c.getModel("label"),v=c.getModel(["emphasis","label"]),d=c.getModel(["progress","label"]),m=a.dataToCoord(f.tickValue),g=new gt({x:m,y:0,rotation:t.labelRotation-t.rotation,onclick:W(o._changeTimeline,o,p),silent:!1,style:Vt(h,{text:f.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});g.ensureState("emphasis").style=Vt(v),g.ensureState("progress").style=Vt(d),i.add(g),oa(g),fz(g).dataIndex=p,o._tickLabels.push(g)})}},e.prototype._renderControl=function(t,i,a,n){var o=t.controlSize,s=t.rotation,l=n.getModel("controlStyle").getItemStyle(),u=n.getModel(["emphasis","controlStyle"]).getItemStyle(),f=n.getPlayState(),p=n.get("inverse",!0);c(t.nextBtnPosition,"next",W(this._changeTimeline,this,p?"-":"+")),c(t.prevBtnPosition,"prev",W(this._changeTimeline,this,p?"+":"-")),c(t.playPosition,f?"stop":"play",W(this._handlePlayClick,this,!f),!0);function c(h,v,d,m){if(h){var g=We(lt(n.get(["controlStyle",v+"BtnSize"]),o),o),y=[0,-g/2,g,g],x=iX(n,v+"Icon",y,{x:h[0],y:h[1],originX:o/2,originY:0,rotation:m?-s:0,rectHover:!0,style:l,onclick:d});x.ensureState("emphasis").style=u,i.add(x),oa(x)}}},e.prototype._renderCurrentPointer=function(t,i,a,n){var o=n.getData(),s=n.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,f={onCreate:function(p){p.draggable=!0,p.drift=W(u._handlePointerDrag,u),p.ondragend=W(u._handlePointerDragend,u),cz(p,u._progressLine,s,a,n,!0)},onUpdate:function(p){cz(p,u._progressLine,s,a,n)}};this._currentPointer=pz(l,l,this._mainGroup,{},this._currentPointer,f)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,i,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,i){var a=this._toAxisCoord(t)[0],n=this._axis,o=Ae(n.getExtent().slice());a>o[1]&&(a=o[1]),a=0&&(o[n]=+o[n].toFixed(c)),[o,p]}var I1={min:tt(Ud,"min"),max:tt(Ud,"max"),average:tt(Ud,"average"),median:tt(Ud,"median")};function Kn(r,e){if(e){var t=r.getData(),i=r.coordinateSystem,a=i&&i.dimensions;if(!oX(e)&&!z(e.coord)&&z(a)){var n=P1(e,t,i,r);if(e=J(e),e.type&&I1[e.type]&&n.baseAxis&&n.valueAxis){var o=at(a,n.baseAxis.dim),s=at(a,n.valueAxis.dim),l=I1[e.type](t,n.baseDataDim,n.valueDataDim,o,s);e.coord=l[0],e.value=l[1]}else e.coord=[e.xAxis!=null?e.xAxis:e.radiusAxis,e.yAxis!=null?e.yAxis:e.angleAxis]}if(e.coord==null||!z(a))e.coord=[];else for(var u=e.coord,f=0;f<2;f++)I1[u[f]]&&(u[f]=Bd(t,t.mapDimension(a[f]),u[f]));return e}}function P1(r,e,t,i){var a={};return r.valueIndex!=null||r.valueDim!=null?(a.valueDataDim=r.valueIndex!=null?e.getDimension(r.valueIndex):r.valueDim,a.valueAxis=t.getAxis(sX(i,a.valueDataDim)),a.baseAxis=t.getOtherAxis(a.valueAxis),a.baseDataDim=e.mapDimension(a.baseAxis.dim)):(a.baseAxis=i.getBaseAxis(),a.valueAxis=t.getOtherAxis(a.baseAxis),a.baseDataDim=e.mapDimension(a.baseAxis.dim),a.valueDataDim=e.mapDimension(a.valueAxis.dim)),a}function sX(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function jn(r,e){return r&&r.containData&&e.coord&&!E1(e)?r.containData(e.coord):!0}function yz(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!E1(e)&&!E1(t)?r.containZone(e.coord,t.coord):!0}function Vd(r,e){return r?function(t,i,a,n){var o=n<2?t.coord&&t.coord[n]:t.value;return vi(o,e[n])}:function(t,i,a,n){return vi(t.value,e[n])}}function Bd(r,e,t){if(t==="average"){var i=0,a=0;return r.each(e,function(n,o){isNaN(n)||(i+=n,a++)}),i/a}else return t==="median"?r.getMedian(e):r.getDataExtent(e)[t==="max"?1:0]}var O1=nt(),lX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this.markerGroupMap=Y()},e.prototype.render=function(t,i,a){var n=this,o=this.markerGroupMap;o.each(function(s){O1(s).keep=!1}),i.eachSeries(function(s){var l=mr.getMarkerModelFromSeries(s,n.type);l&&n.renderSeries(s,l,i,a)}),o.each(function(s){!O1(s).keep&&n.group.remove(s.group)})},e.prototype.markKeep=function(t){O1(t).keep=!0},e.prototype.toggleBlurSeries=function(t,i){var a=this;w(t,function(n){var o=mr.getMarkerModelFromSeries(n,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(i?Cc(l):Pu(l))})}})},e.type="marker",e}(Rt),Wl=lX;function xz(r,e,t){var i=e.coordinateSystem;r.each(function(a){var n=r.getItemModel(a),o,s=H(n.get("x"),t.getWidth()),l=H(n.get("y"),t.getHeight());if(!isNaN(s)&&!isNaN(l))o=[s,l];else if(e.getMarkerPosition)o=e.getMarkerPosition(r.getValues(r.dimensions,a));else if(i){var u=r.get(i.dimensions[0],a),f=r.get(i.dimensions[1],a);o=i.dataToPoint([u,f])}isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),r.setItemLayout(a,o)})}var uX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,a){i.eachSeries(function(n){var o=mr.getMarkerModelFromSeries(n,"markPoint");o&&(xz(o.getData(),n,a),this.markerGroupMap.get(n.id).updateLayout())},this)},e.prototype.renderSeries=function(t,i,a,n){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,new ma),p=fX(o,t,i);i.setData(p),xz(i.getData(),t,n),p.each(function(c){var h=p.getItemModel(c),v=h.getShallow("symbol"),d=h.getShallow("symbolSize"),m=h.getShallow("symbolRotate"),g=h.getShallow("symbolOffset"),y=h.getShallow("symbolKeepAspect");if(Z(v)||Z(d)||Z(m)||Z(g)){var x=i.getRawValue(c),_=i.getDataParams(c);Z(v)&&(v=v(x,_)),Z(d)&&(d=d(x,_)),Z(m)&&(m=m(x,_)),Z(g)&&(g=g(x,_))}var b=h.getModel("itemStyle").getItemStyle(),S=fa(l,"color");b.fill||(b.fill=S),p.setItemVisual(c,{symbol:v,symbolSize:d,symbolRotate:m,symbolOffset:g,symbolKeepAspect:y,style:b})}),f.updateData(p),this.group.add(f.group),p.eachItemGraphicEl(function(c){c.traverse(function(h){et(h).dataModel=i})}),this.markKeep(f),f.group.silent=i.get("silent")||t.get("silent")},e.type="markPoint",e}(Wl);function fX(r,e,t){var i;r?i=k(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return N(N({},l),{name:s,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var a=new se(i,t),n=k(t.get("data"),tt(Kn,e));r&&(n=Ct(n,tt(jn,r)));var o=Vd(!!r,i);return a.initData(n,null,o),a}var _z=uX;function N1(r){r.registerComponentModel(gz),r.registerComponentView(_z),r.registerPreprocessor(function(e){ms(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var pX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,a){return new e(t,i,a)},e.type="markLine",e.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},e}(mr),Sz=pX;var Fd=nt(),cX=function(r,e,t,i){var a=r.getData(),n;if(z(i))n=i;else{var o=i.type;if(o==="min"||o==="max"||o==="average"||o==="median"||i.xAxis!=null||i.yAxis!=null){var s=void 0,l=void 0;if(i.yAxis!=null||i.xAxis!=null)s=e.getAxis(i.yAxis!=null?"y":"x"),l=Jt(i.yAxis,i.xAxis);else{var u=P1(i,a,e,r);s=u.valueAxis;var f=Yh(a,u.valueDataDim);l=Bd(a,f,o)}var p=s.dim==="x"?0:1,c=1-p,h=J(i),v={coord:[]};h.type=null,h.coord=[],h.coord[c]=-1/0,v.coord[c]=1/0;var d=t.get("precision");d>=0&&vt(l)&&(l=+l.toFixed(Math.min(d,20))),h.coord[p]=v.coord[p]=l,n=[h,v,{type:o,valueIndex:i.valueIndex,value:l}]}else n=[]}var m=[Kn(r,n[0]),Kn(r,n[1]),N({},n[2])];return m[2].type=m[2].type||null,st(m[2],m[0]),st(m[2],m[1]),m};function Gd(r){return!isNaN(r)&&!isFinite(r)}function bz(r,e,t,i){var a=1-r,n=i.dimensions[r];return Gd(e[a])&&Gd(t[a])&&e[r]===t[r]&&i.getAxis(n).containData(e[r])}function hX(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,i=e[1].coord;if(t&&i&&(bz(1,t,i,r)||bz(0,t,i,r)))return!0}return jn(r,e[0])&&jn(r,e[1])}function z1(r,e,t,i,a){var n=i.coordinateSystem,o=r.getItemModel(e),s,l=H(o.get("x"),a.getWidth()),u=H(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition)s=i.getMarkerPosition(r.getValues(r.dimensions,e));else{var f=n.dimensions,p=r.get(f[0],e),c=r.get(f[1],e);s=n.dataToPoint([p,c])}if(yi(n,"cartesian2d")){var h=n.getAxis("x"),v=n.getAxis("y"),f=n.dimensions;Gd(r.get(f[0],e))?s[0]=h.toGlobalCoord(h.getExtent()[t?0:1]):Gd(r.get(f[1],e))&&(s[1]=v.toGlobalCoord(v.getExtent()[t?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(e,s)}var vX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,a){i.eachSeries(function(n){var o=mr.getMarkerModelFromSeries(n,"markLine");if(o){var s=o.getData(),l=Fd(o).from,u=Fd(o).to;l.each(function(f){z1(l,f,!0,n,a),z1(u,f,!1,n,a)}),s.each(function(f){s.setItemLayout(f,[l.getItemLayout(f),u.getItemLayout(f)])}),this.markerGroupMap.get(n.id).updateLayout()}},this)},e.prototype.renderSeries=function(t,i,a,n){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,new Dl);this.group.add(f.group);var p=dX(o,t,i),c=p.from,h=p.to,v=p.line;Fd(i).from=c,Fd(i).to=h,i.setData(v);var d=i.get("symbol"),m=i.get("symbolSize"),g=i.get("symbolRotate"),y=i.get("symbolOffset");z(d)||(d=[d,d]),z(m)||(m=[m,m]),z(g)||(g=[g,g]),z(y)||(y=[y,y]),p.from.each(function(_){x(c,_,!0),x(h,_,!1)}),v.each(function(_){var b=v.getItemModel(_).getModel("lineStyle").getLineStyle();v.setItemLayout(_,[c.getItemLayout(_),h.getItemLayout(_)]),b.stroke==null&&(b.stroke=c.getItemVisual(_,"style").fill),v.setItemVisual(_,{fromSymbolKeepAspect:c.getItemVisual(_,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(_,"symbolOffset"),fromSymbolRotate:c.getItemVisual(_,"symbolRotate"),fromSymbolSize:c.getItemVisual(_,"symbolSize"),fromSymbol:c.getItemVisual(_,"symbol"),toSymbolKeepAspect:h.getItemVisual(_,"symbolKeepAspect"),toSymbolOffset:h.getItemVisual(_,"symbolOffset"),toSymbolRotate:h.getItemVisual(_,"symbolRotate"),toSymbolSize:h.getItemVisual(_,"symbolSize"),toSymbol:h.getItemVisual(_,"symbol"),style:b})}),f.updateData(v),p.line.eachItemGraphicEl(function(_){et(_).dataModel=i,_.traverse(function(b){et(b).dataModel=i})});function x(_,b,S){var T=_.getItemModel(b);z1(_,b,S,t,n);var C=T.getModel("itemStyle").getItemStyle();C.fill==null&&(C.fill=fa(l,"color")),_.setItemVisual(b,{symbolKeepAspect:T.get("symbolKeepAspect"),symbolOffset:lt(T.get("symbolOffset",!0),y[S?0:1]),symbolRotate:lt(T.get("symbolRotate",!0),g[S?0:1]),symbolSize:lt(T.get("symbolSize"),m[S?0:1]),symbol:lt(T.get("symbol",!0),d[S?0:1]),style:C})}this.markKeep(f),f.group.silent=i.get("silent")||t.get("silent")},e.type="markLine",e}(Wl);function dX(r,e,t){var i;r?i=k(r&&r.dimensions,function(u){var f=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return N(N({},f),{name:u,ordinalMeta:null})}):i=[{name:"value",type:"float"}];var a=new se(i,t),n=new se(i,t),o=new se([],t),s=k(t.get("data"),tt(cX,e,r,t));r&&(s=Ct(s,tt(hX,r)));var l=Vd(!!r,i);return a.initData(k(s,function(u){return u[0]}),null,l),n.initData(k(s,function(u){return u[1]}),null,l),o.initData(k(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:n,line:o}}var wz=vX;function k1(r){r.registerComponentModel(Sz),r.registerComponentView(wz),r.registerPreprocessor(function(e){ms(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var mX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,i,a){return new e(t,i,a)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e}(mr),Tz=mX;var Hd=nt(),gX=function(r,e,t,i){var a=i[0],n=i[1];if(!(!a||!n)){var o=Kn(r,a),s=Kn(r,n),l=o.coord,u=s.coord;l[0]=Jt(l[0],-1/0),l[1]=Jt(l[1],-1/0),u[0]=Jt(u[0],1/0),u[1]=Jt(u[1],1/0);var f=ys([{},o,s]);return f.coord=[o.coord,s.coord],f.x0=o.x,f.y0=o.y,f.x1=s.x,f.y1=s.y,f}};function Wd(r){return!isNaN(r)&&!isFinite(r)}function Cz(r,e,t,i){var a=1-r;return Wd(e[a])&&Wd(t[a])}function yX(r,e){var t=e.coord[0],i=e.coord[1],a={coord:t,x:e.x0,y:e.y0},n={coord:i,x:e.x1,y:e.y1};return yi(r,"cartesian2d")?t&&i&&(Cz(1,t,i,r)||Cz(0,t,i,r))?!0:yz(r,a,n):jn(r,a)||jn(r,n)}function Az(r,e,t,i,a){var n=i.coordinateSystem,o=r.getItemModel(e),s,l=H(o.get(t[0]),a.getWidth()),u=H(o.get(t[1]),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(i.getMarkerPosition){var f=r.getValues(["x0","y0"],e),p=r.getValues(["x1","y1"],e),c=n.clampData(f),h=n.clampData(p),v=[];t[0]==="x0"?v[0]=c[0]>h[0]?p[0]:f[0]:v[0]=c[0]>h[0]?f[0]:p[0],t[1]==="y0"?v[1]=c[1]>h[1]?p[1]:f[1]:v[1]=c[1]>h[1]?f[1]:p[1],s=i.getMarkerPosition(v,t,!0)}else{var d=r.get(t[0],e),m=r.get(t[1],e),g=[d,m];n.clampData&&n.clampData(g,g),s=n.dataToPoint(g,!0)}if(yi(n,"cartesian2d")){var y=n.getAxis("x"),x=n.getAxis("y"),d=r.get(t[0],e),m=r.get(t[1],e);Wd(d)?s[0]=y.toGlobalCoord(y.getExtent()[t[0]==="x0"?0:1]):Wd(m)&&(s[1]=x.toGlobalCoord(x.getExtent()[t[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var Dz=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],xX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,i,a){i.eachSeries(function(n){var o=mr.getMarkerModelFromSeries(n,"markArea");if(o){var s=o.getData();s.each(function(l){var u=k(Dz,function(p){return Az(s,l,p,n,a)});s.setItemLayout(l,u);var f=s.getItemGraphicEl(l);f.setShape("points",u)})}},this)},e.prototype.renderSeries=function(t,i,a,n){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,f=u.get(s)||u.set(s,{group:new j});this.group.add(f.group),this.markKeep(f);var p=_X(o,t,i);i.setData(p),p.each(function(c){var h=k(Dz,function(C){return Az(p,c,C,t,n)}),v=o.getAxis("x").scale,d=o.getAxis("y").scale,m=v.getExtent(),g=d.getExtent(),y=[v.parse(p.get("x0",c)),v.parse(p.get("x1",c))],x=[d.parse(p.get("y0",c)),d.parse(p.get("y1",c))];Ae(y),Ae(x);var _=!(m[0]>y[1]||m[1]x[1]||g[1]=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(yt),up=bX;var Yl=tt,V1=w,Yd=j,wX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!1,t}return e.prototype.init=function(){this.group.add(this._contentGroup=new Yd),this.group.add(this._selectorGroup=new Yd),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,i,a){var n=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!t.get("show",!0)){var o=t.get("align"),s=t.get("orient");(!o||o==="auto")&&(o=t.get("left")==="right"&&s==="vertical"?"right":"left");var l=t.get("selector",!0),u=t.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,t,i,a,l,s,u);var f=t.getBoxLayoutParams(),p={width:a.getWidth(),height:a.getHeight()},c=t.get("padding"),h=Ft(f,p,c),v=this.layoutInner(t,o,h,n,l,u),d=Ft(X({width:v.width,height:v.height},f),p,c);this.group.x=d.x-v.x,this.group.y=d.y-v.y,this.group.markRedraw(),this.group.add(this._backgroundEl=Id(v,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,i,a,n,o,s,l){var u=this.getContentGroup(),f=Y(),p=i.get("selectedMode"),c=[];a.eachRawSeries(function(h){!h.get("legendHoverLink")&&c.push(h.id)}),V1(i.getData(),function(h,v){var d=h.get("name");if(!this.newlineDisabled&&(d===""||d===` `)){var m=new Yd;m.newline=!0,u.add(m);return}var g=a.getSeriesByName(d)[0];if(!f.get(d))if(g){var y=g.getData(),x=y.getVisual("legendLineStyle")||{},_=y.getVisual("legendIcon"),b=y.getVisual("style"),S=this._createItem(g,d,v,h,i,t,x,b,_,p,n);S.on("click",Yl(Lz,d,null,n,c)).on("mouseover",Yl(B1,g.name,null,n,c)).on("mouseout",Yl(F1,g.name,null,n,c)),f.set(d,!0)}else a.eachRawSeries(function(T){if(!f.get(d)&&T.legendVisualProvider){var C=T.legendVisualProvider;if(!C.containName(d))return;var A=C.indexOfName(d),D=C.getItemVisual(A,"style"),M=C.getItemVisual(A,"legendIcon"),I=ze(D.fill);I&&I[3]===0&&(I[3]=.2,D=N(N({},D),{fill:ni(I,"rgba")}));var E=this._createItem(T,d,v,h,i,t,{},D,M,p,n);E.on("click",Yl(Lz,null,d,n,c)).on("mouseover",Yl(B1,null,d,n,c)).on("mouseout",Yl(F1,null,d,n,c)),f.set(d,!0)}},this)},this),o&&this._createSelector(o,i,n,s,l)},e.prototype._createSelector=function(t,i,a,n,o){var s=this.getSelectorGroup();V1(t,function(u){var f=u.type,p=new gt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:f==="all"?"legendAllSelect":"legendInverseSelect"})}});s.add(p);var c=i.getModel("selectorLabel"),h=i.getModel(["emphasis","selectorLabel"]);qt(p,{normal:c,emphasis:h},{defaultText:u.title}),oa(p)})},e.prototype._createItem=function(t,i,a,n,o,s,l,u,f,p,c){var h=t.visualDrawType,v=o.get("itemWidth"),d=o.get("itemHeight"),m=o.isSelected(i),g=n.get("symbolRotate"),y=n.get("symbolKeepAspect"),x=n.get("icon");f=x||f||"roundRect";var _=TX(f,n,l,u,h,m,c),b=new Yd,S=n.getModel("textStyle");if(Z(t.getLegendIcon)&&(!x||x==="inherit"))b.add(t.getLegendIcon({itemWidth:v,itemHeight:d,icon:f,iconRotate:g,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:y}));else{var T=x==="inherit"&&t.getData().getVisual("symbol")?g==="inherit"?t.getData().getVisual("symbolRotate"):g:0;b.add(CX({itemWidth:v,itemHeight:d,icon:f,iconRotate:T,itemStyle:_.itemStyle,lineStyle:_.lineStyle,symbolKeepAspect:y}))}var C=s==="left"?v+5:-5,A=s,D=o.get("formatter"),M=i;B(D)&&D?M=D.replace("{name}",i??""):Z(D)&&(M=D(i));var I=m?S.getTextColor():n.get("inactiveColor");b.add(new gt({style:Vt(S,{text:M,x:C,y:d/2,fill:I,align:A,verticalAlign:"middle"},{inheritColor:I})}));var E=new ht({shape:b.getBoundingRect(),invisible:!0}),P=n.getModel("tooltip");return P.get("show")&&Ri({el:E,componentModel:o,itemName:i,itemTooltipOption:P.option}),b.add(E),b.eachChild(function(R){R.silent=!0}),E.silent=!p,this.getContentGroup().add(b),oa(b),b.__legendDataIndex=a,b},e.prototype.layoutInner=function(t,i,a,n,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();zi(t.get("orient"),l,t.get("itemGap"),a.width,a.height);var f=l.getBoundingRect(),p=[-f.x,-f.y];if(u.markRedraw(),l.markRedraw(),o){zi("horizontal",u,t.get("selectorItemGap",!0));var c=u.getBoundingRect(),h=[-c.x,-c.y],v=t.get("selectorButtonGap",!0),d=t.getOrient().index,m=d===0?"width":"height",g=d===0?"height":"width",y=d===0?"y":"x";s==="end"?h[d]+=f[m]+v:p[d]+=c[m]+v,h[1-d]+=f[g]/2-c[g]/2,u.x=h[0],u.y=h[1],l.x=p[0],l.y=p[1];var x={x:0,y:0};return x[m]=f[m]+v+c[m],x[g]=Math.max(f[g],c[g]),x[y]=Math.min(0,c[y]+h[1-d]),x}else return l.x=p[0],l.y=p[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(Rt);function TX(r,e,t,i,a,n,o){function s(m,g){m.lineWidth==="auto"&&(m.lineWidth=g.lineWidth>0?2:0),V1(m,function(y,x){m[x]==="inherit"&&(m[x]=g[x])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),f=r.lastIndexOf("empty",0)===0?"fill":"stroke",p=l.getShallow("decal");u.decal=!p||p==="inherit"?i.decal:Bi(p,o),u.fill==="inherit"&&(u.fill=i[a]),u.stroke==="inherit"&&(u.stroke=i[f]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?i:t).opacity),s(u,i);var c=e.getModel("lineStyle"),h=c.getLineStyle();if(s(h,t),u.fill==="auto"&&(u.fill=i.fill),u.stroke==="auto"&&(u.stroke=i.fill),h.stroke==="auto"&&(h.stroke=i.fill),!n){var v=e.get("inactiveBorderWidth"),d=u[f];u.lineWidth=v==="auto"?i.lineWidth>0&&d?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),h.stroke=c.get("inactiveColor"),h.lineWidth=c.get("inactiveWidth")}return{itemStyle:u,lineStyle:h}}function CX(r){var e=r.icon||"roundRect",t=Gt(e,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return t.setStyle(r.itemStyle),t.rotation=(r.iconRotate||0)*Math.PI/180,t.setOrigin([r.itemWidth/2,r.itemHeight/2]),e.indexOf("empty")>-1&&(t.style.stroke=t.style.fill,t.style.fill="#fff",t.style.lineWidth=2),t}function Lz(r,e,t,i){F1(r,e,t,i),t.dispatchAction({type:"legendToggleSelect",name:r??e}),B1(r,e,t,i)}function Iz(r){for(var e=r.getZr().storage.getDisplayList(),t,i=0,a=e.length;ia[o],m=[-h.x,-h.y];i||(m[n]=f[u]);var g=[0,0],y=[-v.x,-v.y],x=lt(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(d){var _=t.get("pageButtonPosition",!0);_==="end"?y[n]+=a[o]-v[o]:g[n]+=v[o]+x}y[1-n]+=h[s]/2-v[s]/2,f.setPosition(m),p.setPosition(g),c.setPosition(y);var b={x:0,y:0};if(b[o]=d?a[o]:h[o],b[s]=Math.max(h[s],v[s]),b[l]=Math.min(0,v[l]+y[1-n]),p.__rectSize=a[o],d){var S={x:0,y:0};S[o]=Math.max(a[o]-v[o]-x,0),S[s]=b[s],p.setClipPath(new ht({shape:S})),p.__rectSize=S[o]}else c.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var T=this._getPageInfo(t);return T.pageIndex!=null&&xt(f,{x:T.contentPosition[0],y:T.contentPosition[1]},d?t:null),this._updatePageInfoView(t,T),b},e.prototype._pageGo=function(t,i,a){var n=this._getPageInfo(i)[t];n!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:i.id})},e.prototype._updatePageInfoView=function(t,i){var a=this._controllerGroup;w(["pagePrev","pageNext"],function(f){var p=f+"DataIndex",c=i[p]!=null,h=a.childOfName(f);h&&(h.setStyle("fill",c?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),h.cursor=c?"pointer":"default")});var n=a.childOfName("pageText"),o=t.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;n&&o&&n.setStyle("text",B(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var i=t.get("scrollDataIndex",!0),a=this.getContentGroup(),n=this._containerGroup.__rectSize,o=t.getOrient().index,s=H1[o],l=W1[o],u=this._findTargetItemIndex(i),f=a.children(),p=f[u],c=f.length,h=c?1:0,v={contentPosition:[a.x,a.y],pageCount:h,pageIndex:h-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!p)return v;var d=_(p);v.contentPosition[o]=-d.s;for(var m=u+1,g=d,y=d,x=null;m<=c;++m)x=_(f[m]),(!x&&y.e>g.s+n||x&&!b(x,g.s))&&(y.i>g.i?g=y:g=x,g&&(v.pageNextDataIndex==null&&(v.pageNextDataIndex=g.i),++v.pageCount)),y=x;for(var m=u-1,g=d,y=d,x=null;m>=-1;--m)x=_(f[m]),(!x||!b(y,x.s))&&g.i=T&&S.s<=T+n}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var i,a=this.getContentGroup(),n;return a.eachChild(function(o,s){var l=o.__legendDataIndex;n==null&&l!=null&&(n=s),l===t&&(i=s)}),i??n},e.type="legend.scroll",e}(Zd),Nz=DX;function Y1(r){r.registerAction("legendScroll","legendscroll",function(e,t){var i=e.scrollDataIndex;i!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(i)})})}function zz(r){_t(Xd),r.registerComponentModel(Rz),r.registerComponentView(Nz),Y1(r)}function Z1(r){_t(Xd),_t(zz)}var MX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=rr(Zn.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(Zn),kz=MX;var X1=nt();function Uz(r,e,t){X1(r).coordSysRecordMap.each(function(i){var a=i.dataZoomInfoMap.get(e.uid);a&&(a.getRange=t)})}function Vz(r,e){for(var t=X1(r).coordSysRecordMap,i=t.keys(),a=0;ai[t+e]&&(e=s),a=a&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}function Fz(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=X1(t),a=i.coordSysRecordMap||(i.coordSysRecordMap=Y());a.each(function(n){n.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(n){var o=Md(n);w(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,LX(t,s.model)),f=u.dataZoomInfoMap||(u.dataZoomInfoMap=Y());f.set(n.uid,{dzReferCoordSysInfo:s,model:n,getRange:null})})}),a.each(function(n){var o=n.controller,s,l=n.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){Bz(a,n);return}var f=PX(l);o.enable(f.controlType,f.opt),o.setPointerChecker(n.containsPoint),di(n,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var OX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,i,a){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),Uz(a,t,{pan:W(q1.pan,this),zoom:W(q1.zoom,this),scrollMove:W(q1.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Vz(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(Fl),q1={zoom:function(r,e,t,i){var a=this.range,n=a.slice(),o=r.axisModels[0];if(o){var s=K1[e](null,[i.originX,i.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(n[1]-n[0])+n[0],u=Math.max(1/i.scale,0);n[0]=(n[0]-l)*u+l,n[1]=(n[1]-l)*u+l;var f=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Ur(0,n,[0,100],0,f.minSpan,f.maxSpan),this.range=n,a[0]!==n[0]||a[1]!==n[1])return n}},pan:Gz(function(r,e,t,i,a,n){var o=K1[i]([n.oldX,n.oldY],[n.newX,n.newY],e,a,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:Gz(function(r,e,t,i,a,n){var o=K1[i]([0,0],[n.scrollDelta,n.scrollDelta],e,a,t);return o.signal*(r[1]-r[0])*n.scrollDelta})};function Gz(r){return function(e,t,i,a){var n=this.range,o=n.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,i,a);if(Ur(l,o,[0,100],"all"),this.range=o,n[0]!==o[0]||n[1]!==o[1])return o}}}var K1={grid:function(r,e,t,i,a){var n=t.axis,o={},s=a.model.coordinateSystem.getRect();return r=r||[0,0],n.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=n.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=n.inverse?-1:1),o},polar:function(r,e,t,i,a){var n=t.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=n.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=n.inverse?-1:1),o},singleAxis:function(r,e,t,i,a){var n=t.axis,o=a.model.coordinateSystem.getRect(),s={};return r=r||[0,0],n.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=n.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=n.inverse?-1:1),s}},Hz=OX;function pp(r){vs(r),r.registerComponentModel(kz),r.registerComponentView(Hz),Fz(r)}var NX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=rr(Zn.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(Zn),Wz=NX;var cp=ht,Yz=7,zX=1,j1=30,kX=7,hp="horizontal",Zz="vertical",UX=5,VX=["line","bar","candlestick","scatter"],BX={easing:"cubicOut",duration:100,delay:0},FX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,i){this.api=i,this._onBrush=W(this._onBrush,this),this._onBrushEnd=W(this._onBrushEnd,this)},e.prototype.render=function(t,i,a,n){if(r.prototype.render.apply(this,arguments),di(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!n||n.type!=="dataZoom"||n.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Ha(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new j;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(i),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,i=this.api,a=t.get("brushSelect"),n=a?kX:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===hp?{right:s.width-o.x-o.width,top:s.height-j1-Yz-n,width:o.width,height:j1}:{right:Yz,top:o.y,width:j1,height:o.height},u=ci(t.option);w(["right","top","width","height"],function(p){u[p]==="ph"&&(u[p]=l[p])});var f=Ft(u,s);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===Zz&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,i=this._location,a=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),o=n&&n.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===hp&&!o?{scaleY:l?1:-1,scaleX:1}:a===hp&&o?{scaleY:l?1:-1,scaleX:-1}:a===Zz&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=i.x-u.x,t.y=i.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,i=this._size,a=this._displayables.sliderGroup,n=t.get("brushSelect");a.add(new cp({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new cp({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:W(this._onClickPanel,this)}),s=this.api.getZr();n?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var i=this._size,a=this._shadowSize||[],n=t.series,o=n.getRawData(),s=n.getShadowDim&&n.getShadowDim(),l=s&&o.getDimensionInfo(s)?n.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==a[0]||i[1]!==a[1]){var p=o.getDataExtent(l),c=(p[1]-p[0])*.3;p=[p[0]-c,p[1]+c];var h=[0,i[1]],v=[0,i[0]],d=[[i[0],0],[0,0]],m=[],g=v[1]/(o.count()-1),y=0,x=Math.round(o.count()/i[0]),_;o.each([l],function(A,D){if(x>0&&D%x){y+=g;return}var M=A==null||isNaN(A)||A==="",I=M?0:kt(A,p,h,!0);M&&!_&&D?(d.push([d[d.length-1][0],0]),m.push([m[m.length-1][0],0])):!M&&_&&(d.push([y,0]),m.push([y,0])),d.push([y,I]),m.push([y,I]),y+=g,_=M}),u=this._shadowPolygonPts=d,f=this._shadowPolylinePts=m}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var b=this.dataZoomModel;function S(A){var D=b.getModel(A?"selectedDataBackground":"dataBackground"),M=new j,I=new oe({shape:{points:u},segmentIgnoreThreshold:1,style:D.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),E=new ae({shape:{points:f},segmentIgnoreThreshold:1,style:D.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return M.add(I),M.add(E),M}for(var T=0;T<3;T++){var C=S(T===1);this._displayables.sliderGroup.add(C),this._displayables.dataShadowSegs.push(C)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,i=t.get("showDataShadow");if(i!==!1){var a,n=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();w(l,function(u){if(!a&&!(i!==!0&&at(VX,u.get("type"))<0)){var f=n.getComponent(Ti(o),s).axis,p=GX(o),c,h=u.coordinateSystem;p!=null&&h.getOtherAxis&&(c=h.getOtherAxis(f).inverse),p=u.getData().mapDimension(p),a={thisAxis:f,series:u,thisDim:o,otherDim:p,otherAxisInverse:c}}},this)},this),a}},e.prototype._renderHandle=function(){var t=this.group,i=this._displayables,a=i.handles=[null,null],n=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,p=l.get("brushSelect"),c=i.filler=new cp({silent:p,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(c),o.add(new cp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:zX,fill:"rgba(0,0,0,0)"}})),w([0,1],function(x){var _=l.get("handleIcon");!ff[_]&&_.indexOf("path://")<0&&_.indexOf("image://")<0&&(_="path://"+_);var b=Gt(_,-1,0,2,2,null,!0);b.attr({cursor:Xz(this._orient),draggable:!0,drift:W(this._onDragMove,this,x),ondragend:W(this._onDragEnd,this),onmouseover:W(this._showDataInfo,this,!0),onmouseout:W(this._showDataInfo,this,!1),z2:5});var S=b.getBoundingRect(),T=l.get("handleSize");this._handleHeight=H(T,this._size[1]),this._handleWidth=S.width/S.height*this._handleHeight,b.setStyle(l.getModel("handleStyle").getItemStyle()),b.style.strokeNoScale=!0,b.rectHover=!0,b.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),oa(b);var C=l.get("handleColor");C!=null&&(b.style.fill=C),o.add(a[x]=b);var A=l.getModel("textStyle");t.add(n[x]=new gt({silent:!0,invisible:!0,style:Vt(A,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:A.getTextColor(),font:A.getFont()}),z2:10}))},this);var h=c;if(p){var v=H(l.get("moveHandleSize"),s[1]),d=i.moveHandle=new ht({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:v}}),m=v*.8,g=i.moveHandleIcon=Gt(l.get("moveHandleIcon"),-m/2,-m/2,m,m,"#fff",!0);g.silent=!0,g.y=s[1]+v/2-.5,d.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var y=Math.min(s[1]/2,Math.max(v,10));h=i.moveZone=new ht({invisible:!0,shape:{y:s[1]-y,height:v+y}}),h.on("mouseover",function(){u.enterEmphasis(d)}).on("mouseout",function(){u.leaveEmphasis(d)}),o.add(d),o.add(g),o.add(h)}h.attr({draggable:!0,cursor:Xz(this._orient),drift:W(this._onDragMove,this,"all"),ondragstart:W(this._showDataInfo,this,!0),ondragend:W(this._onDragEnd,this),onmouseover:W(this._showDataInfo,this,!0),onmouseout:W(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[kt(t[0],[0,100],i,!0),kt(t[1],[0,100],i,!0)]},e.prototype._updateInterval=function(t,i){var a=this.dataZoomModel,n=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Ur(i,n,o,a.get("zoomLock")?"all":t,s.minSpan!=null?kt(s.minSpan,l,o,!0):null,s.maxSpan!=null?kt(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=Ae([kt(n[0],o,l,!0),kt(n[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},e.prototype._updateView=function(t){var i=this._displayables,a=this._handleEnds,n=Ae(a.slice()),o=this._size;w([0,1],function(h){var v=i.handles[h],d=this._handleHeight;v.attr({scaleX:d/2,scaleY:d/2,x:a[h]+(h?-1:1),y:o[1]/2-d/2})},this),i.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]});var s={x:n[0],width:n[1]-n[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,n[0],n[1],o[0]],f=0;fi[0]||a[1]<0||a[1]>i[1])){var n=this._handleEnds,o=(n[0]+n[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var i=t.offsetX,a=t.offsetY;this._brushStart=new St(i,a),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var a=i.shape,n=+new Date;if(!(n-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=Ae([kt(a.x,o,s,!0),kt(a.x+a.width,o,s,!0)]),this._handleEnds=[a.x,a.x+a.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(_r(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,i){var a=this._displayables,n=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new cp({silent:!0,style:n.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,i),f=l.transformCoordToLocal(s.x,s.y),p=this._size;u[0]=Math.max(Math.min(p[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:p[1]})},e.prototype._dispatchZoomAction=function(t){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?BX:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=Md(this.dataZoomModel).infoList;if(!t&&i.length){var a=i[0].model.coordinateSystem;t=a.getRect&&a.getRect()}if(!t){var n=this.api.getWidth(),o=this.api.getHeight();t={x:n*.2,y:o*.2,width:n*.6,height:o*.6}}return t},e.type="dataZoom.slider",e}(Fl);function GX(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function Xz(r){return r==="vertical"?"ns-resize":"ew-resize"}var qz=FX;function vp(r){r.registerComponentModel(Wz),r.registerComponentView(qz),vs(r)}function J1(r){_t(pp),_t(vp)}var HX={get:function(r,e,t){var i=J((WX[r]||{})[e]);return t&&z(i)?i[i.length-1]:i}},WX={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},qd=HX;var Kz=ce.mapVisual,YX=ce.eachVisual,ZX=z,jz=w,XX=Ae,qX=kt,KX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,i,a){this.mergeDefaultAndTheme(t,a)},e.prototype.optionUpdated=function(t,i){var a=this.option;!i&&Od(a,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var i=this.stateList;t=W(t,this),this.controllerVisuals=sp(this.option.controller,i,t),this.targetVisuals=sp(this.option.target,i,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,i=[];return t==null||t==="all"?this.ecModel.eachSeries(function(a,n){i.push(n)}):i=Pt(t),i},e.prototype.eachTargetSeries=function(t,i){w(this.getTargetSeriesIndices(),function(a){var n=this.ecModel.getSeriesByIndex(a);n&&t.call(i,n)},this)},e.prototype.isTargetSeries=function(t){var i=!1;return this.eachTargetSeries(function(a){a===t&&(i=!0)}),i},e.prototype.formatValueText=function(t,i,a){var n=this.option,o=n.precision,s=this.dataBound,l=n.formatter,u;a=a||["<",">"],z(t)&&(t=t.slice(),u=!0);var f=i?t:u?[p(t[0]),p(t[1])]:p(t);if(B(l))return l.replace("{value}",u?f[0]:f).replace("{value2}",u?f[1]:f);if(Z(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?a[0]+" "+f[1]:t[1]===s[1]?a[1]+" "+f[0]:f[0]+" - "+f[1];return f;function p(c){return c===s[0]?"min":c===s[1]?"max":(+c).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,i=XX([t.min,t.max]);this._dataExtent=i},e.prototype.getDataDimensionIndex=function(t){var i=this.option.dimension;if(i!=null)return t.getDimensionIndex(i);for(var a=t.dimensions,n=a.length-1;n>=0;n--){var o=a[n],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,i=this.option,a={inRange:i.inRange,outOfRange:i.outOfRange},n=i.target||(i.target={}),o=i.controller||(i.controller={});st(n,a),st(o,a);var s=this.isCategory();l.call(this,n),l.call(this,o),u.call(this,n,"inRange","outOfRange"),f.call(this,o);function l(p){ZX(i.color)&&!p.inRange&&(p.inRange={color:i.color.slice().reverse()}),p.inRange=p.inRange||{color:t.get("gradientColor")}}function u(p,c,h){var v=p[c],d=p[h];v&&!d&&(d=p[h]={},jz(v,function(m,g){if(ce.isValidType(g)){var y=qd.get(g,"inactive",s);y!=null&&(d[g]=y,g==="color"&&!d.hasOwnProperty("opacity")&&!d.hasOwnProperty("colorAlpha")&&(d.opacity=[0,0]))}}))}function f(p){var c=(p.inRange||{}).symbol||(p.outOfRange||{}).symbol,h=(p.inRange||{}).symbolSize||(p.outOfRange||{}).symbolSize,v=this.get("inactiveColor"),d=this.getItemSymbol(),m=d||"roundRect";jz(this.stateList,function(g){var y=this.itemSize,x=p[g];x||(x=p[g]={color:s?v:[v]}),x.symbol==null&&(x.symbol=c&&J(c)||(s?m:[m])),x.symbolSize==null&&(x.symbolSize=h&&J(h)||(s?y[0]:[y[0],y[0]])),x.symbol=Kz(x.symbol,function(S){return S==="none"?m:S});var _=x.symbolSize;if(_!=null){var b=-1/0;YX(_,function(S){S>b&&(b=S)}),x.symbolSize=Kz(_,function(S){return qX(S,[0,b],[0,y[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(yt),Zl=KX;var Jz=[20,140],jX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=Jz[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=Jz[1])},e.prototype._resetRange=function(){var t=this.getExtent(),i=this.option.range;!i||i.auto?(t.auto=1,this.option.range=t):z(i)&&(i[0]>i[1]&&i.reverse(),i[0]=Math.max(i[0],t[0]),i[1]=Math.min(i[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),w(this.stateList,function(t){var i=this.option.controller[t].symbolSize;i&&i[0]!==i[1]&&(i[0]=i[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),i=Ae((this.get("range")||[]).slice());return i[0]>t[1]&&(i[0]=t[1]),i[1]>t[1]&&(i[1]=t[1]),i[0]=a[1]||t<=i[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[];return this.eachTargetSeries(function(a){var n=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&n.push(l)},this),i.push({seriesId:a.id,dataIndex:n})},this),i},e.prototype.getVisualMeta=function(t){var i=Qz(this,"outOfRange",this.getExtent()),a=Qz(this,"inRange",this.option.range.slice()),n=[];function o(h,v){n.push({value:h,color:t(h,v)})}for(var s=0,l=0,u=a.length,f=i.length;lt[1])break;n.push({color:this.getControllerVisual(l,"color",i),offset:s/a})}return n.push({color:this.getControllerVisual(t[1],"color",i),offset:1}),n},e.prototype._createBarPoints=function(t,i){var a=this.visualMapModel.itemSize;return[[a[0]-i[0],t[0]],[a[0],t[0]],[a[0],t[1]],[a[0]-i[1],t[1]]]},e.prototype._createBarGroup=function(t){var i=this._orient,a=this.visualMapModel.get("inverse");return new j(i==="horizontal"&&!a?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:i==="horizontal"&&a?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:i==="vertical"&&!a?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,i){if(this._useHandle){var a=this._shapes,n=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=n.itemSize,u=n.getExtent();QX([0,1],function(f){var p=o[f];p.setStyle("fill",i.handlesColor[f]),p.y=t[f];var c=ba(t[f],[0,l[1]],u,!0),h=this.getControllerVisual(c,"symbolSize");p.scaleX=p.scaleY=h/l[0],p.x=l[0]-h/2;var v=Ye(a.handleLabelPoints[f],Pi(p,this.group));s[f].setStyle({x:v[0],y:v[1],text:n.formatValueText(this._dataInterval[f]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,i,a,n){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],f=this._shapes,p=f.indicator;if(p){p.attr("invisible",!1);var c={convertOpacityToAlpha:!0},h=this.getControllerVisual(t,"color",c),v=this.getControllerVisual(t,"symbolSize"),d=ba(t,s,u,!0),m=l[0]-v/2,g={x:p.x,y:p.y};p.y=d,p.x=m;var y=Ye(f.indicatorLabelPoint,Pi(p,this.group)),x=f.indicatorLabel;x.attr("invisible",!1);var _=this._applyTransform("left",f.mainGroup),b=this._orient,S=b==="horizontal";x.setStyle({text:(a||"")+o.formatValueText(i),verticalAlign:S?_:"middle",align:S?"center":_});var T={x:m,y:d,style:{fill:h}},C={style:{x:y[0],y:y[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var A={duration:100,easing:"cubicInOut",additive:!0};p.x=g.x,p.y=g.y,p.animateTo(T,A),x.animateTo(C,A)}else p.attr(T),x.attr(C);this._firstShowIndicator=!1;var D=this._shapes.handleLabels;if(D)for(var M=0;Mo[1]&&(p[1]=1/0),i&&(p[0]===-1/0?this._showIndicator(f,p[1],"< ",l):p[1]===1/0?this._showIndicator(f,p[0],"> ",l):this._showIndicator(f,f,"\u2248 ",l));var c=this._hoverLinkDataIndices,h=[];(i||ak(a))&&(h=this._hoverLinkDataIndices=a.findTargetDataIndices(p));var v=Yw(c,h);this._dispatchHighDown("downplay",Xl(v[0],a)),this._dispatchHighDown("highlight",Xl(v[1],a))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(Ui(t.target,function(l){var u=et(l);if(u.dataIndex!=null)return i=u,!0},!0),!!i){var a=this.ecModel.getSeriesByIndex(i.seriesIndex),n=this.visualMapModel;if(n.isTargetSeries(a)){var o=a.getData(i.dataType),s=o.getStore().get(n.getDataDimensionIndex(o),i.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var i=this._shapes.handleLabels;if(i)for(var a=0;a=0&&(n.dimension=o,i.push(n))}}),r.getData().setVisual("visualMeta",i)}}];function iq(r,e,t,i){for(var a=e.targetVisuals[i],n=ce.prepareVisualTypes(a),o={color:fa(r.getData(),"color")},s=0,l=n.length;s0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(sk,lk),w(uk,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor($1))}function mp(r){r.registerComponentModel($z),r.registerComponentView(ok),dp(r)}var aq=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],nq[this._mode].call(this,this._pieceList),this._resetSelected(t,i);var n=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=J(n)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=k(this._pieceList,function(l){return l=J(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,i={},a=ce.listVisualTypes(),n=this.isCategory();w(t.pieces,function(s){w(a,function(l){s.hasOwnProperty(l)&&(i[l]=1)})}),w(i,function(s,l){var u=!1;w(this.stateList,function(f){u=u||o(t,f,l)||o(t.target,f,l)},this),!u&&w(this.stateList,function(f){(t[f]||(t[f]={}))[l]=qd.get(l,f==="inRange"?"active":"inactive",n)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,i){var a=this.option,n=this._pieceList,o=(i?a:t).selected||{};if(a.selected=o,w(n,function(l,u){var f=this.getSelectedMapKey(l);o.hasOwnProperty(f)||(o[f]=!0)},this),a.selectedMode==="single"){var s=!1;w(n,function(l,u){var f=this.getSelectedMapKey(l);o[f]&&(s?o[f]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=J(t)},e.prototype.getValueState=function(t){var i=ce.findPieceIndex(t,this._pieceList);return i!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[i])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[],a=this._pieceList;return this.eachTargetSeries(function(n){var o=[],s=n.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var f=ce.findPieceIndex(l,a);f===t&&o.push(u)},this),i.push({seriesId:n.id,dataIndex:o})},this),i},e.prototype.getRepresentValue=function(t){var i;if(this.isCategory())i=t.value;else if(t.value!=null)i=t.value;else{var a=t.interval||[];i=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return i},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var i=[],a=["",""],n=this;function o(f,p){var c=n.getRepresentValue({interval:f});p||(p=n.getValueState(c));var h=t(c,p);f[0]===-1/0?a[0]=h:f[1]===1/0?a[1]=h:i.push({value:f[0],color:h},{value:f[1],color:h})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return w(s,function(f){var p=f.interval;p&&(p[0]>u&&o([u,p[0]],"outOfRange"),o(p.slice()),u=p[1])},this),{stops:i,outerColors:a}},e.type="visualMap.piecewise",e.defaultOption=rr(Zl.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(Zl),nq={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),i=this.getExtent(),a=e.splitNumber;a=Math.max(parseInt(a,10),1),e.splitNumber=a;for(var n=(i[1]-i[0])/a;+n.toFixed(t)!==n&&t<5;)t++;e.precision=t,n=+n.toFixed(t),e.minOpen&&r.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o","\u2265"][i[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,a)},this)}};function ck(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var hk=aq;var oq=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var i=this.visualMapModel,a=i.get("textGap"),n=i.textStyleModel,o=n.getFont(),s=n.getTextColor(),l=this._getItemAlign(),u=i.itemSize,f=this._getViewData(),p=f.endsText,c=Jt(i.get("showLabel",!0),!p);p&&this._renderEndsText(t,p[0],u,c,l),w(f.viewPieceList,function(h){var v=h.piece,d=new j;d.onclick=W(this._onItemClick,this,v),this._enableHoverLink(d,h.indexInModelPieceList);var m=i.getRepresentValue(v);if(this._createItemSymbol(d,m,[0,0,u[0],u[1]]),c){var g=this.visualMapModel.getValueState(m);d.add(new gt({style:{x:l==="right"?-a:u[0]+a,y:u[1]/2,text:v.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:g==="outOfRange"?.5:1}}))}t.add(d)},this),p&&this._renderEndsText(t,p[1],u,c,l),zi(i.get("orient"),t,i.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,i){var a=this;t.on("mouseover",function(){return n("highlight")}).on("mouseout",function(){return n("downplay")});var n=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Xl(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return jd(t,this.api,t.itemSize);var a=i.align;return(!a||a==="auto")&&(a="left"),a},e.prototype._renderEndsText=function(t,i,a,n,o){if(i){var s=new j,l=this.visualMapModel.textStyleModel;s.add(new gt({style:Vt(l,{x:n?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:n?o:"center",text:i})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,i=k(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=t.get("text"),n=t.get("orient"),o=t.get("inverse");return(n==="horizontal"?o:!o)?i.reverse():a&&(a=a.slice().reverse()),{viewPieceList:i,endsText:a}},e.prototype._createItemSymbol=function(t,i,a){t.add(Gt(this.getControllerVisual(i,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(i,"color")))},e.prototype._onItemClick=function(t){var i=this.visualMapModel,a=i.option,n=a.selectedMode;if(n){var o=J(a.selected),s=i.getSelectedMapKey(t);n==="single"||n===!0?(o[s]=!0,w(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(Kd),vk=oq;function gp(r){r.registerComponentModel(hk),r.registerComponentView(vk),dp(r)}function tb(r){_t(mp),_t(gp)}var sq={label:{enabled:!0},decal:{show:!1}},dk=nt(),lq={};function eb(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=J(sq);st(i.label,r.getLocaleModel().get("aria"),!1),st(t.option,i,!1),a(),n();function a(){var u=t.getModel("decal"),f=u.get("show");if(f){var p=Y();r.eachSeries(function(c){if(!c.isColorBySeries()){var h=p.get(c.type);h||(h={},p.set(c.type,h)),dk(c).scope=h}}),r.eachRawSeries(function(c){if(r.isSeriesFiltered(c))return;if(Z(c.enableAriaDecal)){c.enableAriaDecal();return}var h=c.getData();if(c.isColorBySeries()){var y=ju(c.ecModel,c.name,lq,r.getSeriesCount()),x=h.getVisual("decal");h.setVisual("decal",_(x,y))}else{var v=c.getRawData(),d={},m=dk(c).scope;h.each(function(b){var S=h.getRawIndex(b);d[S]=b});var g=v.count();v.each(function(b){var S=d[b],T=v.getName(b)||b+"",C=ju(c.ecModel,T,m,g),A=h.getItemVisual(S,"decal");h.setItemVisual(S,"decal",_(A,C))})}function _(b,S){var T=b?N(N({},S),b):S;return T.dirty=!0,T}})}}function n(){var u=r.getLocaleModel().get("aria"),f=t.getModel("label");if(f.option=X(f.option,u),!!f.get("enabled")){var p=e.getZr().dom;if(f.get("description")){p.setAttribute("aria-label",f.get("description"));return}var c=r.getSeriesCount(),h=f.get(["data","maxCount"])||10,v=f.get(["series","maxCount"])||10,d=Math.min(c,v),m;if(!(c<1)){var g=s();if(g){var y=f.get(["general","withTitle"]);m=o(y,{title:g})}else m=f.get(["general","withoutTitle"]);var x=[],_=c>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);m+=o(_,{seriesCount:c}),r.eachSeries(function(C,A){if(A1?f.get(["series","multiple",I]):f.get(["series","single",I]),D=o(D,{seriesId:C.seriesIndex,seriesName:C.get("name"),seriesType:l(C.subType)});var E=C.getData();if(E.count()>h){var P=f.get(["data","partialData"]);D+=o(P,{displayCnt:h})}else D+=f.get(["data","allData"]);for(var R=f.get(["data","separator","middle"]),O=f.get(["data","separator","end"]),V=[],U=0;U":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},uq=function(){function r(e){var t=this._condVal=B(e)?new RegExp(e):Sb(e)?e:null;if(t==null){var i="";Ut(i)}}return r.prototype.evaluate=function(e){var t=typeof e;return B(t)?this._condVal.test(e):vt(t)?this._condVal.test(e+""):!1},r}(),fq=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),pq=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t2&&i.push(a),a=[E,P]}function f(E,P,R,O){Kl(E,R)&&Kl(P,O)||a.push(E,P,R,O,R,O)}function p(E,P,R,O,V,U){var F=Math.abs(P-E),q=Math.tan(F/4)*4/3,Q=PC:M2&&i.push(a),i}function sb(r,e,t,i,a,n,o,s,l,u){if(Kl(r,t)&&Kl(e,i)&&Kl(a,o)&&Kl(n,s)){l.push(o,s);return}var f=2/u,p=f*f,c=o-r,h=s-e,v=Math.sqrt(c*c+h*h);c/=v,h/=v;var d=t-r,m=i-e,g=a-o,y=n-s,x=d*d+m*m,_=g*g+y*y;if(x=0&&C=0){l.push(o,s);return}var A=[],D=[];ii(r,t,a,o,.5,A),ii(e,i,n,s,.5,D),sb(A[0],D[0],A[1],D[1],A[2],D[2],A[3],D[3],l,u),sb(A[4],D[4],A[5],D[5],A[6],D[6],A[7],D[7],l,u)}function bk(r,e){var t=Jd(r),i=[];e=e||1;for(var a=0;a0)for(var u=0;uMath.abs(u),p=Ak([l,u],f?0:1,e),c=(f?s:u)/p.length,h=0;ha,o=Ak([i,a],n?0:1,e),s=n?"width":"height",l=n?"height":"width",u=n?"x":"y",f=n?"y":"x",p=r[s]/o.length,c=0;c1?null:new St(d*l+r,d*u+e)}function bq(r,e,t){var i=new St;St.sub(i,t,e),i.normalize();var a=new St;St.sub(a,r,e);var n=a.dot(i);return n}function jl(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function wq(r,e,t){for(var i=r.length,a=[],n=0;no?(u.x=f.x=s+n/2,u.y=l,f.y=l+o):(u.y=f.y=l+o/2,u.x=s,f.x=s+n),wq(e,u,f)}function Qd(r,e,t,i){if(t===1)i.push(e);else{var a=Math.floor(t/2),n=r(e);Qd(r,n[0],a,i),Qd(r,n[1],t-a,i)}return i}function Tq(r,e){for(var t=[],i=0;i0)for(var b=i/t,S=-i/2;S<=i/2;S+=b){for(var T=Math.sin(S),C=Math.cos(S),A=0,x=0;x0;u/=2){var f=0,p=0;(r&u)>0&&(f=1),(e&u)>0&&(p=1),s+=u*u*(3*f^p),p===0&&(f===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function tm(r){var e=1/0,t=1/0,i=-1/0,a=-1/0,n=k(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),f=l.x+l.width/2+(u?u[4]:0),p=l.y+l.height/2+(u?u[5]:0);return e=Math.min(f,e),t=Math.min(p,t),i=Math.max(f,i),a=Math.max(p,a),[f,p]}),o=k(n,function(s,l){return{cp:s,z:Pq(s[0],s[1],e,t,i,a),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function Rk(r){return Dk(r.path,r.count)}function lb(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Ok(r,e,t){var i=[];function a(b){for(var S=0;S=0;a--)if(!t[a].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var n=l.length,u=Math.ceil(n/2);t[a].many=l.slice(u,n),t[s].many=l.slice(0,u),s++}return t}var Rq={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,f;zk(r)&&(u=r,f=e),zk(e)&&(u=e,f=r);function p(g,y,x,_,b){var S=g.many,T=g.one;if(S.length===1&&!b){var C=y?S[0]:T,A=y?T:S[0];if(xp(C))p({many:[C],one:A},!0,x,_,!0);else{var D=s?X({delay:s(x,_)},l):l;em(C,A,D),n(C,A,C,A,D)}}else for(var M=X({dividePath:Rq[t],individualDelay:s&&function(V,U,F,q){return s(V+x,_)}},l),I=y?Ok(S,T,M):Nk(T,S,M),E=I.fromIndividuals,P=I.toIndividuals,R=E.length,O=0;Oe.length,h=u?kk(f,u):kk(c?e:r,[c?r:e]),v=0,d=0;dGk))for(var a=i.getIndices(),n=Nq(i),o=0;o0&&_.group.traverse(function(S){S instanceof it&&!S.animators.length&&S.animateFrom({style:{opacity:0}},b)})})}function Vk(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function Bk(r){return z(r)?r.sort().join(","):r}function Qn(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Uq(r,e){var t=Y(),i=Y(),a=Y();w(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],u=r.oldData[s],f=Vk(o),p=Bk(f);i.set(p,{dataGroupId:l,data:u}),z(f)&&w(f,function(c){a.set(c,{key:p,dataGroupId:l,data:u})})});function n(o){t.get(o)&&kw("Duplicated seriesKey in universalTransition "+o)}return w(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=Vk(o),f=Bk(u),p=i.get(f);if(p)t.set(f,{oldSeries:[{dataGroupId:p.dataGroupId,divide:Qn(p.data),data:p.data}],newSeries:[{dataGroupId:s,divide:Qn(l),data:l}]});else if(z(u)){var c=[];w(u,function(d){var m=i.get(d);m.data&&c.push({dataGroupId:m.dataGroupId,divide:Qn(m.data),data:m.data})}),c.length&&t.set(f,{oldSeries:c,newSeries:[{dataGroupId:s,data:l,divide:Qn(l)}]})}else{var h=a.get(u);if(h){var v=t.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:Qn(h.data)}],newSeries:[]},t.set(h.key,v)),v.newSeries.push({dataGroupId:s,data:l,divide:Qn(l)})}}}}),t}function Fk(r,e){for(var t=0;t=0&&a.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:Qn(e.oldData[s]),dim:o.dimension})}),w(Pt(r.to),function(o){var s=Fk(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();n.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:Qn(l),dim:o.dimension})}}),a.length>0&&n.length>0&&Hk(a,n,i)}function pb(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){w(Pt(i.seriesTransition),function(a){w(Pt(a.to),function(n){for(var o=i.updatedSeries,s=0;sa[o],m=[-h.x,-h.y];i||(m[n]=f[u]);var g=[0,0],y=[-v.x,-v.y],x=lt(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(d){var _=t.get("pageButtonPosition",!0);_==="end"?y[n]+=a[o]-v[o]:g[n]+=v[o]+x}y[1-n]+=h[s]/2-v[s]/2,f.setPosition(m),p.setPosition(g),c.setPosition(y);var b={x:0,y:0};if(b[o]=d?a[o]:h[o],b[s]=Math.max(h[s],v[s]),b[l]=Math.min(0,v[l]+y[1-n]),p.__rectSize=a[o],d){var S={x:0,y:0};S[o]=Math.max(a[o]-v[o]-x,0),S[s]=b[s],p.setClipPath(new ht({shape:S})),p.__rectSize=S[o]}else c.eachChild(function(C){C.attr({invisible:!0,silent:!0})});var T=this._getPageInfo(t);return T.pageIndex!=null&&xt(f,{x:T.contentPosition[0],y:T.contentPosition[1]},d?t:null),this._updatePageInfoView(t,T),b},e.prototype._pageGo=function(t,i,a){var n=this._getPageInfo(i)[t];n!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:i.id})},e.prototype._updatePageInfoView=function(t,i){var a=this._controllerGroup;w(["pagePrev","pageNext"],function(f){var p=f+"DataIndex",c=i[p]!=null,h=a.childOfName(f);h&&(h.setStyle("fill",c?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),h.cursor=c?"pointer":"default")});var n=a.childOfName("pageText"),o=t.get("pageFormatter"),s=i.pageIndex,l=s!=null?s+1:0,u=i.pageCount;n&&o&&n.setStyle("text",B(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var i=t.get("scrollDataIndex",!0),a=this.getContentGroup(),n=this._containerGroup.__rectSize,o=t.getOrient().index,s=H1[o],l=W1[o],u=this._findTargetItemIndex(i),f=a.children(),p=f[u],c=f.length,h=c?1:0,v={contentPosition:[a.x,a.y],pageCount:h,pageIndex:h-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!p)return v;var d=_(p);v.contentPosition[o]=-d.s;for(var m=u+1,g=d,y=d,x=null;m<=c;++m)x=_(f[m]),(!x&&y.e>g.s+n||x&&!b(x,g.s))&&(y.i>g.i?g=y:g=x,g&&(v.pageNextDataIndex==null&&(v.pageNextDataIndex=g.i),++v.pageCount)),y=x;for(var m=u-1,g=d,y=d,x=null;m>=-1;--m)x=_(f[m]),(!x||!b(y,x.s))&&g.i=T&&S.s<=T+n}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var i,a=this.getContentGroup(),n;return a.eachChild(function(o,s){var l=o.__legendDataIndex;n==null&&l!=null&&(n=s),l===t&&(i=s)}),i??n},e.type="legend.scroll",e}(Zd),Nz=DX;function Y1(r){r.registerAction("legendScroll","legendscroll",function(e,t){var i=e.scrollDataIndex;i!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(i)})})}function zz(r){_t(Xd),r.registerComponentModel(Rz),r.registerComponentView(Nz),Y1(r)}function Z1(r){_t(Xd),_t(zz)}var MX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=rr(Zn.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e}(Zn),kz=MX;var X1=nt();function Uz(r,e,t){X1(r).coordSysRecordMap.each(function(i){var a=i.dataZoomInfoMap.get(e.uid);a&&(a.getRange=t)})}function Vz(r,e){for(var t=X1(r).coordSysRecordMap,i=t.keys(),a=0;ai[t+e]&&(e=s),a=a&&o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}function Fz(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var i=X1(t),a=i.coordSysRecordMap||(i.coordSysRecordMap=Y());a.each(function(n){n.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(n){var o=Md(n);w(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,LX(t,s.model)),f=u.dataZoomInfoMap||(u.dataZoomInfoMap=Y());f.set(n.uid,{dzReferCoordSysInfo:s,model:n,getRange:null})})}),a.each(function(n){var o=n.controller,s,l=n.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){Bz(a,n);return}var f=PX(l);o.enable(f.controlType,f.opt),o.setPointerChecker(n.containsPoint),di(n,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var OX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,i,a){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),Uz(a,t,{pan:W(q1.pan,this),zoom:W(q1.zoom,this),scrollMove:W(q1.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Vz(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e}(Fl),q1={zoom:function(r,e,t,i){var a=this.range,n=a.slice(),o=r.axisModels[0];if(o){var s=K1[e](null,[i.originX,i.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(n[1]-n[0])+n[0],u=Math.max(1/i.scale,0);n[0]=(n[0]-l)*u+l,n[1]=(n[1]-l)*u+l;var f=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Ur(0,n,[0,100],0,f.minSpan,f.maxSpan),this.range=n,a[0]!==n[0]||a[1]!==n[1])return n}},pan:Gz(function(r,e,t,i,a,n){var o=K1[i]([n.oldX,n.oldY],[n.newX,n.newY],e,a,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:Gz(function(r,e,t,i,a,n){var o=K1[i]([0,0],[n.scrollDelta,n.scrollDelta],e,a,t);return o.signal*(r[1]-r[0])*n.scrollDelta})};function Gz(r){return function(e,t,i,a){var n=this.range,o=n.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,i,a);if(Ur(l,o,[0,100],"all"),this.range=o,n[0]!==o[0]||n[1]!==o[1])return o}}}var K1={grid:function(r,e,t,i,a){var n=t.axis,o={},s=a.model.coordinateSystem.getRect();return r=r||[0,0],n.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=n.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=n.inverse?-1:1),o},polar:function(r,e,t,i,a){var n=t.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=n.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=n.inverse?-1:1),o},singleAxis:function(r,e,t,i,a){var n=t.axis,o=a.model.coordinateSystem.getRect(),s={};return r=r||[0,0],n.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=n.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=n.inverse?-1:1),s}},Hz=OX;function pp(r){vs(r),r.registerComponentModel(kz),r.registerComponentView(Hz),Fz(r)}var NX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=rr(Zn.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(Zn),Wz=NX;var cp=ht,Yz=7,zX=1,j1=30,kX=7,hp="horizontal",Zz="vertical",UX=5,VX=["line","bar","candlestick","scatter"],BX={easing:"cubicOut",duration:100,delay:0},FX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,i){this.api=i,this._onBrush=W(this._onBrush,this),this._onBrushEnd=W(this._onBrushEnd,this)},e.prototype.render=function(t,i,a,n){if(r.prototype.render.apply(this,arguments),di(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!n||n.type!=="dataZoom"||n.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Ha(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var i=this._displayables.sliderGroup=new j;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(i),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,i=this.api,a=t.get("brushSelect"),n=a?kX:0,o=this._findCoordRect(),s={width:i.getWidth(),height:i.getHeight()},l=this._orient===hp?{right:s.width-o.x-o.width,top:s.height-j1-Yz-n,width:o.width,height:j1}:{right:Yz,top:o.y,width:j1,height:o.height},u=ci(t.option);w(["right","top","width","height"],function(p){u[p]==="ph"&&(u[p]=l[p])});var f=Ft(u,s);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===Zz&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,i=this._location,a=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),o=n&&n.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===hp&&!o?{scaleY:l?1:-1,scaleX:1}:a===hp&&o?{scaleY:l?1:-1,scaleX:-1}:a===Zz&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=i.x-u.x,t.y=i.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,i=this._size,a=this._displayables.sliderGroup,n=t.get("brushSelect");a.add(new cp({silent:!0,shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new cp({shape:{x:0,y:0,width:i[0],height:i[1]},style:{fill:"transparent"},z2:0,onclick:W(this._onClickPanel,this)}),s=this.api.getZr();n?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var i=this._size,a=this._shadowSize||[],n=t.series,o=n.getRawData(),s=n.getShadowDim&&n.getShadowDim(),l=s&&o.getDimensionInfo(s)?n.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,f=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||i[0]!==a[0]||i[1]!==a[1]){var p=o.getDataExtent(l),c=(p[1]-p[0])*.3;p=[p[0]-c,p[1]+c];var h=[0,i[1]],v=[0,i[0]],d=[[i[0],0],[0,0]],m=[],g=v[1]/(o.count()-1),y=0,x=Math.round(o.count()/i[0]),_;o.each([l],function(A,D){if(x>0&&D%x){y+=g;return}var M=A==null||isNaN(A)||A==="",I=M?0:kt(A,p,h,!0);M&&!_&&D?(d.push([d[d.length-1][0],0]),m.push([m[m.length-1][0],0])):!M&&_&&(d.push([y,0]),m.push([y,0])),d.push([y,I]),m.push([y,I]),y+=g,_=M}),u=this._shadowPolygonPts=d,f=this._shadowPolylinePts=m}this._shadowData=o,this._shadowDim=l,this._shadowSize=[i[0],i[1]];var b=this.dataZoomModel;function S(A){var D=b.getModel(A?"selectedDataBackground":"dataBackground"),M=new j,I=new oe({shape:{points:u},segmentIgnoreThreshold:1,style:D.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),E=new ae({shape:{points:f},segmentIgnoreThreshold:1,style:D.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return M.add(I),M.add(E),M}for(var T=0;T<3;T++){var C=S(T===1);this._displayables.sliderGroup.add(C),this._displayables.dataShadowSegs.push(C)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,i=t.get("showDataShadow");if(i!==!1){var a,n=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();w(l,function(u){if(!a&&!(i!==!0&&at(VX,u.get("type"))<0)){var f=n.getComponent(Ti(o),s).axis,p=GX(o),c,h=u.coordinateSystem;p!=null&&h.getOtherAxis&&(c=h.getOtherAxis(f).inverse),p=u.getData().mapDimension(p),a={thisAxis:f,series:u,thisDim:o,otherDim:p,otherAxisInverse:c}}},this)},this),a}},e.prototype._renderHandle=function(){var t=this.group,i=this._displayables,a=i.handles=[null,null],n=i.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,f=l.get("borderRadius")||0,p=l.get("brushSelect"),c=i.filler=new cp({silent:p,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(c),o.add(new cp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:f},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:zX,fill:"rgba(0,0,0,0)"}})),w([0,1],function(x){var _=l.get("handleIcon");!ff[_]&&_.indexOf("path://")<0&&_.indexOf("image://")<0&&(_="path://"+_);var b=Gt(_,-1,0,2,2,null,!0);b.attr({cursor:Xz(this._orient),draggable:!0,drift:W(this._onDragMove,this,x),ondragend:W(this._onDragEnd,this),onmouseover:W(this._showDataInfo,this,!0),onmouseout:W(this._showDataInfo,this,!1),z2:5});var S=b.getBoundingRect(),T=l.get("handleSize");this._handleHeight=H(T,this._size[1]),this._handleWidth=S.width/S.height*this._handleHeight,b.setStyle(l.getModel("handleStyle").getItemStyle()),b.style.strokeNoScale=!0,b.rectHover=!0,b.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),oa(b);var C=l.get("handleColor");C!=null&&(b.style.fill=C),o.add(a[x]=b);var A=l.getModel("textStyle");t.add(n[x]=new gt({silent:!0,invisible:!0,style:Vt(A,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:A.getTextColor(),font:A.getFont()}),z2:10}))},this);var h=c;if(p){var v=H(l.get("moveHandleSize"),s[1]),d=i.moveHandle=new ht({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:v}}),m=v*.8,g=i.moveHandleIcon=Gt(l.get("moveHandleIcon"),-m/2,-m/2,m,m,"#fff",!0);g.silent=!0,g.y=s[1]+v/2-.5,d.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var y=Math.min(s[1]/2,Math.max(v,10));h=i.moveZone=new ht({invisible:!0,shape:{y:s[1]-y,height:v+y}}),h.on("mouseover",function(){u.enterEmphasis(d)}).on("mouseout",function(){u.leaveEmphasis(d)}),o.add(d),o.add(g),o.add(h)}h.attr({draggable:!0,cursor:Xz(this._orient),drift:W(this._onDragMove,this,"all"),ondragstart:W(this._showDataInfo,this,!0),ondragend:W(this._onDragEnd,this),onmouseover:W(this._showDataInfo,this,!0),onmouseout:W(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),i=this._getViewExtent();this._handleEnds=[kt(t[0],[0,100],i,!0),kt(t[1],[0,100],i,!0)]},e.prototype._updateInterval=function(t,i){var a=this.dataZoomModel,n=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Ur(i,n,o,a.get("zoomLock")?"all":t,s.minSpan!=null?kt(s.minSpan,l,o,!0):null,s.maxSpan!=null?kt(s.maxSpan,l,o,!0):null);var u=this._range,f=this._range=Ae([kt(n[0],o,l,!0),kt(n[1],o,l,!0)]);return!u||u[0]!==f[0]||u[1]!==f[1]},e.prototype._updateView=function(t){var i=this._displayables,a=this._handleEnds,n=Ae(a.slice()),o=this._size;w([0,1],function(h){var v=i.handles[h],d=this._handleHeight;v.attr({scaleX:d/2,scaleY:d/2,x:a[h]+(h?-1:1),y:o[1]/2-d/2})},this),i.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]});var s={x:n[0],width:n[1]-n[0]};i.moveHandle&&(i.moveHandle.setShape(s),i.moveZone.setShape(s),i.moveZone.getBoundingRect(),i.moveHandleIcon&&i.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=i.dataShadowSegs,u=[0,n[0],n[1],o[0]],f=0;fi[0]||a[1]<0||a[1]>i[1])){var n=this._handleEnds,o=(n[0]+n[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var i=t.offsetX,a=t.offsetY;this._brushStart=new St(i,a),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var i=this._displayables.brushRect;if(this._brushing=!1,!!i){i.attr("ignore",!0);var a=i.shape,n=+new Date;if(!(n-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100];this._range=Ae([kt(a.x,o,s,!0),kt(a.x+a.width,o,s,!0)]),this._handleEnds=[a.x,a.x+a.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(_r(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,i){var a=this._displayables,n=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new cp({silent:!0,style:n.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,i),f=l.transformCoordToLocal(s.x,s.y),p=this._size;u[0]=Math.max(Math.min(p[0],u[0]),0),o.setShape({x:f[0],y:0,width:u[0]-f[0],height:p[1]})},e.prototype._dispatchZoomAction=function(t){var i=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?BX:null,start:i[0],end:i[1]})},e.prototype._findCoordRect=function(){var t,i=Md(this.dataZoomModel).infoList;if(!t&&i.length){var a=i[0].model.coordinateSystem;t=a.getRect&&a.getRect()}if(!t){var n=this.api.getWidth(),o=this.api.getHeight();t={x:n*.2,y:o*.2,width:n*.6,height:o*.6}}return t},e.type="dataZoom.slider",e}(Fl);function GX(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function Xz(r){return r==="vertical"?"ns-resize":"ew-resize"}var qz=FX;function vp(r){r.registerComponentModel(Wz),r.registerComponentView(qz),vs(r)}function J1(r){_t(pp),_t(vp)}var HX={get:function(r,e,t){var i=J((WX[r]||{})[e]);return t&&z(i)?i[i.length-1]:i}},WX={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},qd=HX;var Kz=ce.mapVisual,YX=ce.eachVisual,ZX=z,jz=w,XX=Ae,qX=kt,KX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,i,a){this.mergeDefaultAndTheme(t,a)},e.prototype.optionUpdated=function(t,i){var a=this.option;!i&&Od(a,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var i=this.stateList;t=W(t,this),this.controllerVisuals=sp(this.option.controller,i,t),this.targetVisuals=sp(this.option.target,i,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,i=[];return t==null||t==="all"?this.ecModel.eachSeries(function(a,n){i.push(n)}):i=Pt(t),i},e.prototype.eachTargetSeries=function(t,i){w(this.getTargetSeriesIndices(),function(a){var n=this.ecModel.getSeriesByIndex(a);n&&t.call(i,n)},this)},e.prototype.isTargetSeries=function(t){var i=!1;return this.eachTargetSeries(function(a){a===t&&(i=!0)}),i},e.prototype.formatValueText=function(t,i,a){var n=this.option,o=n.precision,s=this.dataBound,l=n.formatter,u;a=a||["<",">"],z(t)&&(t=t.slice(),u=!0);var f=i?t:u?[p(t[0]),p(t[1])]:p(t);if(B(l))return l.replace("{value}",u?f[0]:f).replace("{value2}",u?f[1]:f);if(Z(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?a[0]+" "+f[1]:t[1]===s[1]?a[1]+" "+f[0]:f[0]+" - "+f[1];return f;function p(c){return c===s[0]?"min":c===s[1]?"max":(+c).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,i=XX([t.min,t.max]);this._dataExtent=i},e.prototype.getDataDimensionIndex=function(t){var i=this.option.dimension;if(i!=null)return t.getDimensionIndex(i);for(var a=t.dimensions,n=a.length-1;n>=0;n--){var o=a[n],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,i=this.option,a={inRange:i.inRange,outOfRange:i.outOfRange},n=i.target||(i.target={}),o=i.controller||(i.controller={});st(n,a),st(o,a);var s=this.isCategory();l.call(this,n),l.call(this,o),u.call(this,n,"inRange","outOfRange"),f.call(this,o);function l(p){ZX(i.color)&&!p.inRange&&(p.inRange={color:i.color.slice().reverse()}),p.inRange=p.inRange||{color:t.get("gradientColor")}}function u(p,c,h){var v=p[c],d=p[h];v&&!d&&(d=p[h]={},jz(v,function(m,g){if(ce.isValidType(g)){var y=qd.get(g,"inactive",s);y!=null&&(d[g]=y,g==="color"&&!d.hasOwnProperty("opacity")&&!d.hasOwnProperty("colorAlpha")&&(d.opacity=[0,0]))}}))}function f(p){var c=(p.inRange||{}).symbol||(p.outOfRange||{}).symbol,h=(p.inRange||{}).symbolSize||(p.outOfRange||{}).symbolSize,v=this.get("inactiveColor"),d=this.getItemSymbol(),m=d||"roundRect";jz(this.stateList,function(g){var y=this.itemSize,x=p[g];x||(x=p[g]={color:s?v:[v]}),x.symbol==null&&(x.symbol=c&&J(c)||(s?m:[m])),x.symbolSize==null&&(x.symbolSize=h&&J(h)||(s?y[0]:[y[0],y[0]])),x.symbol=Kz(x.symbol,function(S){return S==="none"?m:S});var _=x.symbolSize;if(_!=null){var b=-1/0;YX(_,function(S){S>b&&(b=S)}),x.symbolSize=Kz(_,function(S){return qX(S,[0,b],[0,y[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(yt),Zl=KX;var Jz=[20,140],jX=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=Jz[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=Jz[1])},e.prototype._resetRange=function(){var t=this.getExtent(),i=this.option.range;!i||i.auto?(t.auto=1,this.option.range=t):z(i)&&(i[0]>i[1]&&i.reverse(),i[0]=Math.max(i[0],t[0]),i[1]=Math.min(i[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),w(this.stateList,function(t){var i=this.option.controller[t].symbolSize;i&&i[0]!==i[1]&&(i[0]=i[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),i=Ae((this.get("range")||[]).slice());return i[0]>t[1]&&(i[0]=t[1]),i[1]>t[1]&&(i[1]=t[1]),i[0]=a[1]||t<=i[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[];return this.eachTargetSeries(function(a){var n=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&n.push(l)},this),i.push({seriesId:a.id,dataIndex:n})},this),i},e.prototype.getVisualMeta=function(t){var i=Qz(this,"outOfRange",this.getExtent()),a=Qz(this,"inRange",this.option.range.slice()),n=[];function o(h,v){n.push({value:h,color:t(h,v)})}for(var s=0,l=0,u=a.length,f=i.length;lt[1])break;n.push({color:this.getControllerVisual(l,"color",i),offset:s/a})}return n.push({color:this.getControllerVisual(t[1],"color",i),offset:1}),n},e.prototype._createBarPoints=function(t,i){var a=this.visualMapModel.itemSize;return[[a[0]-i[0],t[0]],[a[0],t[0]],[a[0],t[1]],[a[0]-i[1],t[1]]]},e.prototype._createBarGroup=function(t){var i=this._orient,a=this.visualMapModel.get("inverse");return new j(i==="horizontal"&&!a?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:i==="horizontal"&&a?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:i==="vertical"&&!a?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,i){if(this._useHandle){var a=this._shapes,n=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=n.itemSize,u=n.getExtent();QX([0,1],function(f){var p=o[f];p.setStyle("fill",i.handlesColor[f]),p.y=t[f];var c=ba(t[f],[0,l[1]],u,!0),h=this.getControllerVisual(c,"symbolSize");p.scaleX=p.scaleY=h/l[0],p.x=l[0]-h/2;var v=Ye(a.handleLabelPoints[f],Pi(p,this.group));s[f].setStyle({x:v[0],y:v[1],text:n.formatValueText(this._dataInterval[f]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,i,a,n){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],f=this._shapes,p=f.indicator;if(p){p.attr("invisible",!1);var c={convertOpacityToAlpha:!0},h=this.getControllerVisual(t,"color",c),v=this.getControllerVisual(t,"symbolSize"),d=ba(t,s,u,!0),m=l[0]-v/2,g={x:p.x,y:p.y};p.y=d,p.x=m;var y=Ye(f.indicatorLabelPoint,Pi(p,this.group)),x=f.indicatorLabel;x.attr("invisible",!1);var _=this._applyTransform("left",f.mainGroup),b=this._orient,S=b==="horizontal";x.setStyle({text:(a||"")+o.formatValueText(i),verticalAlign:S?_:"middle",align:S?"center":_});var T={x:m,y:d,style:{fill:h}},C={style:{x:y[0],y:y[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var A={duration:100,easing:"cubicInOut",additive:!0};p.x=g.x,p.y=g.y,p.animateTo(T,A),x.animateTo(C,A)}else p.attr(T),x.attr(C);this._firstShowIndicator=!1;var D=this._shapes.handleLabels;if(D)for(var M=0;Mo[1]&&(p[1]=1/0),i&&(p[0]===-1/0?this._showIndicator(f,p[1],"< ",l):p[1]===1/0?this._showIndicator(f,p[0],"> ",l):this._showIndicator(f,f,"\u2248 ",l));var c=this._hoverLinkDataIndices,h=[];(i||ak(a))&&(h=this._hoverLinkDataIndices=a.findTargetDataIndices(p));var v=Yw(c,h);this._dispatchHighDown("downplay",Xl(v[0],a)),this._dispatchHighDown("highlight",Xl(v[1],a))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var i;if(Ui(t.target,function(l){var u=et(l);if(u.dataIndex!=null)return i=u,!0},!0),!!i){var a=this.ecModel.getSeriesByIndex(i.seriesIndex),n=this.visualMapModel;if(n.isTargetSeries(a)){var o=a.getData(i.dataType),s=o.getStore().get(n.getDataDimensionIndex(o),i.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var i=this._shapes.handleLabels;if(i)for(var a=0;a=0&&(n.dimension=o,i.push(n))}}),r.getData().setVisual("visualMeta",i)}}];function iq(r,e,t,i){for(var a=e.targetVisuals[i],n=ce.prepareVisualTypes(a),o={color:fa(r.getData(),"color")},s=0,l=n.length;s0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(sk,lk),w(uk,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor($1))}function mp(r){r.registerComponentModel($z),r.registerComponentView(ok),dp(r)}var aq=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,i){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],nq[this._mode].call(this,this._pieceList),this._resetSelected(t,i);var n=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=J(n)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=k(this._pieceList,function(l){return l=J(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,i={},a=ce.listVisualTypes(),n=this.isCategory();w(t.pieces,function(s){w(a,function(l){s.hasOwnProperty(l)&&(i[l]=1)})}),w(i,function(s,l){var u=!1;w(this.stateList,function(f){u=u||o(t,f,l)||o(t.target,f,l)},this),!u&&w(this.stateList,function(f){(t[f]||(t[f]={}))[l]=qd.get(l,f==="inRange"?"active":"inactive",n)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,i){var a=this.option,n=this._pieceList,o=(i?a:t).selected||{};if(a.selected=o,w(n,function(l,u){var f=this.getSelectedMapKey(l);o.hasOwnProperty(f)||(o[f]=!0)},this),a.selectedMode==="single"){var s=!1;w(n,function(l,u){var f=this.getSelectedMapKey(l);o[f]&&(s?o[f]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=J(t)},e.prototype.getValueState=function(t){var i=ce.findPieceIndex(t,this._pieceList);return i!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[i])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var i=[],a=this._pieceList;return this.eachTargetSeries(function(n){var o=[],s=n.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var f=ce.findPieceIndex(l,a);f===t&&o.push(u)},this),i.push({seriesId:n.id,dataIndex:o})},this),i},e.prototype.getRepresentValue=function(t){var i;if(this.isCategory())i=t.value;else if(t.value!=null)i=t.value;else{var a=t.interval||[];i=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return i},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var i=[],a=["",""],n=this;function o(f,p){var c=n.getRepresentValue({interval:f});p||(p=n.getValueState(c));var h=t(c,p);f[0]===-1/0?a[0]=h:f[1]===1/0?a[1]=h:i.push({value:f[0],color:h},{value:f[1],color:h})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return w(s,function(f){var p=f.interval;p&&(p[0]>u&&o([u,p[0]],"outOfRange"),o(p.slice()),u=p[1])},this),{stops:i,outerColors:a}},e.type="visualMap.piecewise",e.defaultOption=rr(Zl.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e}(Zl),nq={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),i=this.getExtent(),a=e.splitNumber;a=Math.max(parseInt(a,10),1),e.splitNumber=a;for(var n=(i[1]-i[0])/a;+n.toFixed(t)!==n&&t<5;)t++;e.precision=t,n=+n.toFixed(t),e.minOpen&&r.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o","\u2265"][i[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,a)},this)}};function ck(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var hk=aq;var oq=function(r){L(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var i=this.visualMapModel,a=i.get("textGap"),n=i.textStyleModel,o=n.getFont(),s=n.getTextColor(),l=this._getItemAlign(),u=i.itemSize,f=this._getViewData(),p=f.endsText,c=Jt(i.get("showLabel",!0),!p);p&&this._renderEndsText(t,p[0],u,c,l),w(f.viewPieceList,function(h){var v=h.piece,d=new j;d.onclick=W(this._onItemClick,this,v),this._enableHoverLink(d,h.indexInModelPieceList);var m=i.getRepresentValue(v);if(this._createItemSymbol(d,m,[0,0,u[0],u[1]]),c){var g=this.visualMapModel.getValueState(m);d.add(new gt({style:{x:l==="right"?-a:u[0]+a,y:u[1]/2,text:v.text,verticalAlign:"middle",align:l,font:o,fill:s,opacity:g==="outOfRange"?.5:1}}))}t.add(d)},this),p&&this._renderEndsText(t,p[1],u,c,l),zi(i.get("orient"),t,i.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,i){var a=this;t.on("mouseover",function(){return n("highlight")}).on("mouseout",function(){return n("downplay")});var n=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Xl(s.findTargetDataIndices(i),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,i=t.option;if(i.orient==="vertical")return jd(t,this.api,t.itemSize);var a=i.align;return(!a||a==="auto")&&(a="left"),a},e.prototype._renderEndsText=function(t,i,a,n,o){if(i){var s=new j,l=this.visualMapModel.textStyleModel;s.add(new gt({style:Vt(l,{x:n?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:n?o:"center",text:i})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,i=k(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=t.get("text"),n=t.get("orient"),o=t.get("inverse");return(n==="horizontal"?o:!o)?i.reverse():a&&(a=a.slice().reverse()),{viewPieceList:i,endsText:a}},e.prototype._createItemSymbol=function(t,i,a){t.add(Gt(this.getControllerVisual(i,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(i,"color")))},e.prototype._onItemClick=function(t){var i=this.visualMapModel,a=i.option,n=a.selectedMode;if(n){var o=J(a.selected),s=i.getSelectedMapKey(t);n==="single"||n===!0?(o[s]=!0,w(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e}(Kd),vk=oq;function gp(r){r.registerComponentModel(hk),r.registerComponentView(vk),dp(r)}function tb(r){_t(mp),_t(gp)}var sq={label:{enabled:!0},decal:{show:!1}},dk=nt(),lq={};function eb(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var i=J(sq);st(i.label,r.getLocaleModel().get("aria"),!1),st(t.option,i,!1),a(),n();function a(){var u=t.getModel("decal"),f=u.get("show");if(f){var p=Y();r.eachSeries(function(c){if(!c.isColorBySeries()){var h=p.get(c.type);h||(h={},p.set(c.type,h)),dk(c).scope=h}}),r.eachRawSeries(function(c){if(r.isSeriesFiltered(c))return;if(Z(c.enableAriaDecal)){c.enableAriaDecal();return}var h=c.getData();if(c.isColorBySeries()){var y=ju(c.ecModel,c.name,lq,r.getSeriesCount()),x=h.getVisual("decal");h.setVisual("decal",_(x,y))}else{var v=c.getRawData(),d={},m=dk(c).scope;h.each(function(b){var S=h.getRawIndex(b);d[S]=b});var g=v.count();v.each(function(b){var S=d[b],T=v.getName(b)||b+"",C=ju(c.ecModel,T,m,g),A=h.getItemVisual(S,"decal");h.setItemVisual(S,"decal",_(A,C))})}function _(b,S){var T=b?N(N({},S),b):S;return T.dirty=!0,T}})}}function n(){var u=r.getLocaleModel().get("aria"),f=t.getModel("label");if(f.option=X(f.option,u),!!f.get("enabled")){var p=e.getZr().dom;if(f.get("description")){p.setAttribute("aria-label",f.get("description"));return}var c=r.getSeriesCount(),h=f.get(["data","maxCount"])||10,v=f.get(["series","maxCount"])||10,d=Math.min(c,v),m;if(!(c<1)){var g=s();if(g){var y=f.get(["general","withTitle"]);m=o(y,{title:g})}else m=f.get(["general","withoutTitle"]);var x=[],_=c>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);m+=o(_,{seriesCount:c}),r.eachSeries(function(C,A){if(A1?f.get(["series","multiple",I]):f.get(["series","single",I]),D=o(D,{seriesId:C.seriesIndex,seriesName:C.get("name"),seriesType:l(C.subType)});var E=C.getData();if(E.count()>h){var P=f.get(["data","partialData"]);D+=o(P,{displayCnt:h})}else D+=f.get(["data","allData"]);for(var R=f.get(["data","separator","middle"]),O=f.get(["data","separator","end"]),V=[],U=0;U":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},uq=function(){function r(e){var t=this._condVal=B(e)?new RegExp(e):Sb(e)?e:null;if(t==null){var i="";Ut(i)}}return r.prototype.evaluate=function(e){var t=typeof e;return B(t)?this._condVal.test(e):vt(t)?this._condVal.test(e+""):!1},r}(),fq=function(){function r(){}return r.prototype.evaluate=function(){return this.value},r}(),pq=function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t2&&i.push(a),a=[E,P]}function f(E,P,R,O){Kl(E,R)&&Kl(P,O)||a.push(E,P,R,O,R,O)}function p(E,P,R,O,V,U){var F=Math.abs(P-E),q=Math.tan(F/4)*4/3,Q=PC:M2&&i.push(a),i}function sb(r,e,t,i,a,n,o,s,l,u){if(Kl(r,t)&&Kl(e,i)&&Kl(a,o)&&Kl(n,s)){l.push(o,s);return}var f=2/u,p=f*f,c=o-r,h=s-e,v=Math.sqrt(c*c+h*h);c/=v,h/=v;var d=t-r,m=i-e,g=a-o,y=n-s,x=d*d+m*m,_=g*g+y*y;if(x=0&&C=0){l.push(o,s);return}var A=[],D=[];ii(r,t,a,o,.5,A),ii(e,i,n,s,.5,D),sb(A[0],D[0],A[1],D[1],A[2],D[2],A[3],D[3],l,u),sb(A[4],D[4],A[5],D[5],A[6],D[6],A[7],D[7],l,u)}function bk(r,e){var t=Jd(r),i=[];e=e||1;for(var a=0;a0)for(var u=0;uMath.abs(u),p=Ak([l,u],f?0:1,e),c=(f?s:u)/p.length,h=0;ha,o=Ak([i,a],n?0:1,e),s=n?"width":"height",l=n?"height":"width",u=n?"x":"y",f=n?"y":"x",p=r[s]/o.length,c=0;c1?null:new St(d*l+r,d*u+e)}function bq(r,e,t){var i=new St;St.sub(i,t,e),i.normalize();var a=new St;St.sub(a,r,e);var n=a.dot(i);return n}function jl(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function wq(r,e,t){for(var i=r.length,a=[],n=0;no?(u.x=f.x=s+n/2,u.y=l,f.y=l+o):(u.y=f.y=l+o/2,u.x=s,f.x=s+n),wq(e,u,f)}function Qd(r,e,t,i){if(t===1)i.push(e);else{var a=Math.floor(t/2),n=r(e);Qd(r,n[0],a,i),Qd(r,n[1],t-a,i)}return i}function Tq(r,e){for(var t=[],i=0;i0)for(var b=i/t,S=-i/2;S<=i/2;S+=b){for(var T=Math.sin(S),C=Math.cos(S),A=0,x=0;x0;u/=2){var f=0,p=0;(r&u)>0&&(f=1),(e&u)>0&&(p=1),s+=u*u*(3*f^p),p===0&&(f===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function tm(r){var e=1/0,t=1/0,i=-1/0,a=-1/0,n=k(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),f=l.x+l.width/2+(u?u[4]:0),p=l.y+l.height/2+(u?u[5]:0);return e=Math.min(f,e),t=Math.min(p,t),i=Math.max(f,i),a=Math.max(p,a),[f,p]}),o=k(n,function(s,l){return{cp:s,z:Pq(s[0],s[1],e,t,i,a),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function Rk(r){return Dk(r.path,r.count)}function lb(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Ok(r,e,t){var i=[];function a(b){for(var S=0;S=0;a--)if(!t[a].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var n=l.length,u=Math.ceil(n/2);t[a].many=l.slice(u,n),t[s].many=l.slice(0,u),s++}return t}var Rq={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,f;zk(r)&&(u=r,f=e),zk(e)&&(u=e,f=r);function p(g,y,x,_,b){var S=g.many,T=g.one;if(S.length===1&&!b){var C=y?S[0]:T,A=y?T:S[0];if(xp(C))p({many:[C],one:A},!0,x,_,!0);else{var D=s?X({delay:s(x,_)},l):l;em(C,A,D),n(C,A,C,A,D)}}else for(var M=X({dividePath:Rq[t],individualDelay:s&&function(V,U,F,q){return s(V+x,_)}},l),I=y?Ok(S,T,M):Nk(T,S,M),E=I.fromIndividuals,P=I.toIndividuals,R=E.length,O=0;Oe.length,h=u?kk(f,u):kk(c?e:r,[c?r:e]),v=0,d=0;dGk))for(var a=i.getIndices(),n=Nq(i),o=0;o0&&_.group.traverse(function(S){S instanceof it&&!S.animators.length&&S.animateFrom({style:{opacity:0}},b)})})}function Vk(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function Bk(r){return z(r)?r.sort().join(","):r}function Qn(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Uq(r,e){var t=Y(),i=Y(),a=Y();w(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],u=r.oldData[s],f=Vk(o),p=Bk(f);i.set(p,{dataGroupId:l,data:u}),z(f)&&w(f,function(c){a.set(c,{key:p,dataGroupId:l,data:u})})});function n(o){t.get(o)&&kw("Duplicated seriesKey in universalTransition "+o)}return w(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=Vk(o),f=Bk(u),p=i.get(f);if(p)t.set(f,{oldSeries:[{dataGroupId:p.dataGroupId,divide:Qn(p.data),data:p.data}],newSeries:[{dataGroupId:s,divide:Qn(l),data:l}]});else if(z(u)){var c=[];w(u,function(d){var m=i.get(d);m.data&&c.push({dataGroupId:m.dataGroupId,divide:Qn(m.data),data:m.data})}),c.length&&t.set(f,{oldSeries:c,newSeries:[{dataGroupId:s,data:l,divide:Qn(l)}]})}else{var h=a.get(u);if(h){var v=t.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:Qn(h.data)}],newSeries:[]},t.set(h.key,v)),v.newSeries.push({dataGroupId:s,data:l,divide:Qn(l)})}}}}),t}function Fk(r,e){for(var t=0;t=0&&a.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:Qn(e.oldData[s]),dim:o.dimension})}),w(Pt(r.to),function(o){var s=Fk(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();n.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:Qn(l),dim:o.dimension})}}),a.length>0&&n.length>0&&Hk(a,n,i)}function pb(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){w(Pt(i.seriesTransition),function(a){w(Pt(a.to),function(n){for(var o=i.updatedSeries,s=0;s Date: Fri, 9 Feb 2024 14:30:25 +0100 Subject: [PATCH 18/18] Update README --- README.md | 13 +++++++++---- docs/examples/getting_started/app.py | 2 +- docs/examples/getting_started/basic_usage.py | 2 +- .../examples/getting_started/basic_usage_express.py | 4 ++-- shinyecharts/__init__.py | 2 ++ 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 47c3c8f..401423d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ [Shiny for Python](https://shiny.posit.co/py/) bindings for [ECharts JS](https://echarts.apache.org/) +## Note + +This package is still in an early state. + ## Installation ```bash @@ -16,13 +20,13 @@ pip install git+https://github.com/eodaGmbH/py-shiny-echarts ## Basic usage ```python -from shinyecharts.chart import Chart, InitOptions -from shinyecharts.options import Line -from shinyecharts.renderer import ChartRenderer from pandas import DataFrame # Must always be imported, otherwise App is not found from shiny.express import ui +from shinyecharts import Chart, InitOptions +from shinyecharts.options import Line +from shinyecharts.renderer import ChartRenderer init_options = InitOptions(width=600, height=400, renderer="canvas") @@ -31,6 +35,7 @@ data = DataFrame( columns=["a", "b", "c", "d"], ) + lines = ( Line(x="a", y="b", tooltip=dict(trigger="axis"), legend=dict()) .add_series("c") @@ -45,4 +50,4 @@ def render_dataset(): ```bash shiny run docs/examples/getting_started/basic_usage.py --reload -``` \ No newline at end of file +``` diff --git a/docs/examples/getting_started/app.py b/docs/examples/getting_started/app.py index ce871f7..e61ca54 100644 --- a/docs/examples/getting_started/app.py +++ b/docs/examples/getting_started/app.py @@ -1,6 +1,6 @@ from pandas import DataFrame from shiny.express import ui -from shinyecharts.chart import Chart, InitOptions +from shinyecharts import Chart, InitOptions from shinyecharts.renderer import ChartRenderer options = InitOptions(width=600, height=400) diff --git a/docs/examples/getting_started/basic_usage.py b/docs/examples/getting_started/basic_usage.py index cc46d15..f13c8a1 100644 --- a/docs/examples/getting_started/basic_usage.py +++ b/docs/examples/getting_started/basic_usage.py @@ -2,7 +2,7 @@ # Must always be imported, otherwise App is not found from shiny.express import ui -from shinyecharts.chart import Chart, InitOptions +from shinyecharts import Chart, InitOptions from shinyecharts.options import Line from shinyecharts.renderer import ChartRenderer diff --git a/docs/examples/getting_started/basic_usage_express.py b/docs/examples/getting_started/basic_usage_express.py index 3d2055e..5199792 100644 --- a/docs/examples/getting_started/basic_usage_express.py +++ b/docs/examples/getting_started/basic_usage_express.py @@ -2,8 +2,8 @@ # Must always be imported, otherwise App is not found from shiny.express import ui -from shinyecharts.chart import Chart, InitOptions -from shinyecharts.options import Bar, ChartOption, Line, Pie, Scatter +from shinyecharts import Chart, InitOptions +from shinyecharts.options import Bar, Line, Pie, Scatter from shinyecharts.renderer import ChartRenderer # General options diff --git a/shinyecharts/__init__.py b/shinyecharts/__init__.py index e69de29..7564e4c 100644 --- a/shinyecharts/__init__.py +++ b/shinyecharts/__init__.py @@ -0,0 +1,2 @@ +from .chart import Chart, InitOptions +from .options import ChartOption