diff --git a/src/main/java/com/github/appreciated/apexcharts/ApexCharts.java b/src/main/java/com/github/appreciated/apexcharts/ApexCharts.java index 5e87fff..dcccdd4 100644 --- a/src/main/java/com/github/appreciated/apexcharts/ApexCharts.java +++ b/src/main/java/com/github/appreciated/apexcharts/ApexCharts.java @@ -159,6 +159,10 @@ public void setYaxis(YAxis[] yaxis) { setPropertyObject("yaxis", yaxis); } + public void updateConfig() { + getElement().callJsFunction("updateConfigAndApply"); + } + /** * This method will be called automatically and does not require to be called manually */ diff --git a/src/main/resources/META-INF/resources/frontend/com/github/appreciated/apexcharts/apexcharts-wrapper.ts b/src/main/resources/META-INF/resources/frontend/com/github/appreciated/apexcharts/apexcharts-wrapper.ts index 1314103..5da15e8 100644 --- a/src/main/resources/META-INF/resources/frontend/com/github/appreciated/apexcharts/apexcharts-wrapper.ts +++ b/src/main/resources/META-INF/resources/frontend/com/github/appreciated/apexcharts/apexcharts-wrapper.ts @@ -387,6 +387,11 @@ export class ApexChartsWrapper extends LitElement { } } + updateConfigAndApply() { + this.updateConfig(); + this.chartComponent.updateOptions(this.config); + } + /** * This is due to the way the eval function works eval("function (){return \"test\"}") will throw an * Uncaught SyntaxError: Function statements require a function name.