diff --git a/panel/models/echarts.py b/panel/models/echarts.py index 7ef583b3a0..137651db77 100644 --- a/panel/models/echarts.py +++ b/panel/models/echarts.py @@ -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)) diff --git a/panel/models/echarts.ts b/panel/models/echarts.ts index 198609d7f6..f461646394 100644 --- a/panel/models/echarts.ts +++ b/panel/models/echarts.ts @@ -80,7 +80,7 @@ export class EChartsView extends HTMLBoxView { _plot(): void { if ((window as any).echarts == null) return - this._chart.setOption(this.model.data, true); + this._chart.setOption(this.model.data, this.model.options_kwargs ); } _resize(): void { @@ -137,6 +137,7 @@ export namespace ECharts { export type Attrs = p.AttrsOf export type Props = HTMLBox.Props & { data: p.Property + options_kwargs: p.Property event_config: p.Property js_events: p.Property renderer: p.Property @@ -159,11 +160,12 @@ export class ECharts extends HTMLBox { this.prototype.default_view = EChartsView this.define(({ 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"] })) } } diff --git a/panel/pane/echarts.py b/panel/pane/echarts.py index c9787a7353..48f3180156 100644 --- a/panel/pane/echarts.py +++ b/panel/pane/echarts.py @@ -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""")