Skip to content

Commit 83d61c3

Browse files
akashsonunespike-rabbit
authored andcommitted
refactor(charts): improve type safety
1 parent d79cb07 commit 83d61c3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

projects/charts-ng/src/components/si-chart-circle/si-chart-circle.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class SiChartCircleComponent extends SiChartComponent {
4141
: 0;
4242
const top = 32 + offset;
4343
this.series()?.forEach(series => {
44-
const s: any = Object.assign({ type: 'pie', top }, series);
44+
const s: PieSeriesOption = { type: 'pie', top, ...series };
4545
optionSeries.push(s);
4646
if (this.showLegend()) {
4747
series.data.forEach(data => {

projects/charts-ng/src/components/si-chart-gauge/si-chart-gauge.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class SiChartGaugeComponent extends SiChartComponent implements OnChanges
123123
const colors: string[] = this.colors() ?? effectiveOpts.color;
124124
const hasIndicator = !!this.segments().length;
125125

126-
let newColors: any[];
126+
let newColors: [number, string][];
127127
if (hasIndicator) {
128128
newColors = this.segments().map((threshold, index) => {
129129
const color = colors[index % colors.length];
@@ -146,7 +146,7 @@ export class SiChartGaugeComponent extends SiChartComponent implements OnChanges
146146
this.refreshSeries();
147147
}
148148

149-
private setAxisLineColor(colors: any[], axisLine: any): void {
149+
private setAxisLineColor(colors: [number, string][], axisLine: any): void {
150150
axisLine.lineStyle = axisLine.lineStyle ?? {};
151151
axisLine.lineStyle.color = colors;
152152
}

projects/charts-ng/src/components/si-chart-sankey/si-chart-sankey.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class SiChartSankeyComponent extends SiChartComponent {
2929
protected override applyOptions(): void {
3030
const series = this.series();
3131
this.actualOptions = {
32-
series: series ? (Object.assign({ type: 'sankey' }, series) as any) : [],
32+
series: series ? [{ type: 'sankey', ...series }] : [],
3333
tooltip: { show: this.toolTip() || this.tooltip() }
3434
};
3535

projects/charts-ng/src/components/si-chart-sunburst/si-chart-sunburst.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class SiChartSunburstComponent extends SiChartComponent {
2929
protected override applyOptions(): void {
3030
const series = this.series();
3131
this.actualOptions = {
32-
series: series ? (Object.assign({ type: 'sunburst' }, series) as any) : [],
32+
series: series ? [{ type: 'sunburst', ...series }] : [],
3333
tooltip: { show: this.toolTip() || this.tooltip() }
3434
};
3535

0 commit comments

Comments
 (0)