Skip to content
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

Fix #5424 : update echarts when removing series #5435

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions panel/models/echarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def __js_skip__(cls):

data = Nullable(Dict(String, Any))

options_kwargs = Nullable(Dict(String, Any))

event_config = Dict(String, Any)

js_events = Dict(String, List(Any))
Expand Down
14 changes: 8 additions & 6 deletions panel/models/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class EChartsView extends HTMLBoxView {
_plot(): void {
if ((window as any).echarts == null)
return
this._chart.setOption(this.model.data);
this._chart.setOption(this.model.data, this.model.options_kwargs );
}

_resize(): void {
Expand Down Expand Up @@ -137,6 +137,7 @@ export namespace ECharts {
export type Attrs = p.AttrsOf<Props>
export type Props = HTMLBox.Props & {
data: p.Property<any>
options_kwargs: p.Property<any>
event_config: p.Property<any>
js_events: p.Property<any>
renderer: p.Property<string>
Expand All @@ -159,11 +160,12 @@ export class ECharts extends HTMLBox {
this.prototype.default_view = EChartsView

this.define<ECharts.Props>(({ Any, String }) => ({
data: [ Any, {} ],
event_config: [ Any, {} ],
js_events: [ Any, {} ],
theme: [ String, "default"],
renderer: [ String, "canvas"]
data: [ Any, {} ],
options_kwargs:[ Any, {} ],
event_config: [ Any, {} ],
js_events: [ Any, {} ],
theme: [ String, "default"],
renderer: [ String, "canvas"]
}))
}
}
4 changes: 4 additions & 0 deletions panel/pane/echarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class ECharts(ModelPane):
object = param.Parameter(default=None, doc="""
The Echarts object being wrapped. Can be an Echarts dictionary or a pyecharts chart""")

options_kwargs = param.Parameter(default=None, doc="""
An optional dict of options passed to Echarts.setOption. Allows to fine-tune the rendering behavior.
""")

renderer = param.ObjectSelector(default="canvas", objects=["canvas", "svg"], doc="""
Whether to render as HTML canvas or SVG""")

Expand Down