From e871459fefc066ef2c83a3b55330311f65aebc89 Mon Sep 17 00:00:00 2001 From: "akash.sonune" Date: Wed, 14 Jan 2026 20:09:16 +0530 Subject: [PATCH] refactor(charts): remove deprecated method BREAKING CHANGE: Removed deprecated `SiChartBaseComponent.resetChart` method as it should not be directly used by the consumer. --- api-goldens/charts-ng/common/index.api.md | 2 -- .../common/si-chart-base.component.ts | 29 +------------------ 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/api-goldens/charts-ng/common/index.api.md b/api-goldens/charts-ng/common/index.api.md index 84c8f8d75..3d8330384 100644 --- a/api-goldens/charts-ng/common/index.api.md +++ b/api-goldens/charts-ng/common/index.api.md @@ -262,8 +262,6 @@ export class SiChartBaseComponent implements AfterViewInit, OnChanges, OnInit, O readonly pointer: _angular_core.OutputEmitterRef; refreshSeries(isLive?: boolean, dzToSet?: DataZoomRange): void; readonly renderer: _angular_core.InputSignal<"canvas" | "svg">; - // @deprecated - resetChart(): void; resize(): void; readonly selectedItem: _angular_core.InputSignal; readonly selectionChanged: _angular_core.OutputEmitterRef; diff --git a/projects/charts-ng/common/si-chart-base.component.ts b/projects/charts-ng/common/si-chart-base.component.ts index b1a0c52e5..57942bdd3 100644 --- a/projects/charts-ng/common/si-chart-base.component.ts +++ b/projects/charts-ng/common/si-chart-base.component.ts @@ -386,8 +386,7 @@ export class SiChartBaseComponent implements AfterViewInit, OnChanges, OnInit, O this.actualOptions.color = changes.options.previousValue.color; } if (changes.theme || changes.renderer) { - // need to completely redo the chart for the theme change to take effect - return this.resetChart(); + return this.themeSwitch(); } let updates = 0; @@ -612,32 +611,6 @@ export class SiChartBaseComponent implements AfterViewInit, OnChanges, OnInit, O this.cdRef.markForCheck(); } - /** - * Re-render the whole chart. - * @deprecated The method is deprecated and should not be used directly by the consumer. - */ - resetChart(): void { - this.applyTheme(); - - if (!this.actualOptions) { - // this can happen if the SiThemeService fires the theme switch when the chart is not - // yet completely initialized - return; - } - - this.disposeChart(); - this.applyPalette(); - const addOpts = this.additionalOptions(); - if (addOpts?.palette) { - echarts.util.merge(this.actualOptions.palette, addOpts.palette, true); - } - this.themeChanged(); - this.applyStyles(); - this.applyTitles(); - this.ngAfterViewInit(true); // eslint-disable-line @angular-eslint/no-lifecycle-call - this.cdRef.markForCheck(); - } - protected handleLegendClick(legend: CustomLegendItem): void { this.doToggleSeriesVisibility(legend.name, legend.selected, legend); this.cdRef.markForCheck();