-
-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
echart: enable svg rendering #3936
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,7 +9,12 @@ export default { | |||||
await import("echarts-gl"); | ||||||
} | ||||||
|
||||||
this.chart = echarts.init(this.$el); | ||||||
if (this.enable_svg) { | ||||||
this.chart = echarts.init(this.$el, null, {renderer: 'svg'}); | ||||||
} else { | ||||||
this.chart = echarts.init(this.$el); | ||||||
} | ||||||
|
||||||
this.chart.on("click", (e) => this.$emit("pointClick", e)); | ||||||
for (const event of [ | ||||||
"click", | ||||||
|
@@ -90,5 +95,6 @@ export default { | |||||
props: { | ||||||
options: Object, | ||||||
enable_3d: Boolean, | ||||||
enable_svg: Boolean | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}, | ||||||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -22,7 +22,7 @@ class EChart(Element, | |||||||||||||||
dependencies=['lib/echarts/echarts.min.js', 'lib/echarts-gl/echarts-gl.min.js'], | ||||||||||||||||
default_classes='nicegui-echart'): | ||||||||||||||||
|
||||||||||||||||
def __init__(self, options: Dict, on_point_click: Optional[Handler[EChartPointClickEventArguments]] = None, *, enable_3d: bool = False) -> None: | ||||||||||||||||
def __init__(self, options: Dict, on_point_click: Optional[Handler[EChartPointClickEventArguments]] = None, *, enable_3d: bool = False, enable_svg: bool = False) -> None: | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
"""Apache EChart | ||||||||||||||||
|
||||||||||||||||
An element to create a chart using `ECharts <https://echarts.apache.org/>`_. | ||||||||||||||||
|
@@ -32,10 +32,12 @@ def __init__(self, options: Dict, on_point_click: Optional[Handler[EChartPointCl | |||||||||||||||
:param options: dictionary of EChart options | ||||||||||||||||
:param on_click_point: callback that is invoked when a point is clicked | ||||||||||||||||
:param enable_3d: enforce importing the echarts-gl library | ||||||||||||||||
:param enable_svg: enable svg rendering for this chart | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
""" | ||||||||||||||||
super().__init__() | ||||||||||||||||
self._props['options'] = options | ||||||||||||||||
self._props['enable_3d'] = enable_3d or any('3D' in key for key in options) | ||||||||||||||||
self._props['enable_svg'] = enable_svg | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
if on_point_click: | ||||||||||||||||
self.on_point_click(on_point_click) | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.