Skip to content

Commit f224427

Browse files
committed
fix(custom-chart-web): override with spread order instead of conditions
1 parent 0c5f801 commit f224427

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

packages/pluggableWidgets/custom-chart-web/src/controllers/ChartPropsController.ts

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,47 +84,40 @@ export class ChartPropsController implements ReactiveController {
8484
height: this.sizeProvider.height,
8585
autosize: true,
8686
font: {
87-
family: this.layout.font?.family ? this.layout.font.family : "Open Sans, sans-serif",
88-
size: this.layout.font?.size
89-
? this.layout.font.size
90-
: Math.max(12 * (this.sizeProvider.width / 1000), 8)
87+
family: "Open Sans, sans-serif",
88+
size: Math.max(12 * (this.sizeProvider.width / 1000), 8),
89+
...this.layout.font
9190
},
9291
legend: {
93-
...this.layout.legend,
9492
font: {
95-
...this.layout.legend?.font,
96-
size: this.layout.legend?.font?.size
97-
? this.layout.legend.font.size
98-
: Math.max(10 * (this.sizeProvider.width / 1000), 7)
93+
size: Math.max(10 * (this.sizeProvider.width / 1000), 7),
94+
...this.layout.legend?.font
9995
},
10096
itemwidth: Math.max(10 * (this.sizeProvider.width / 1000), 3),
101-
itemsizing: "constant"
97+
itemsizing: "constant",
98+
...this.layout.legend
10299
},
103100
xaxis: {
104-
...this.layout.xaxis,
105101
tickfont: {
106-
...this.layout.xaxis?.tickfont,
107-
size: this.layout.xaxis?.tickfont?.size
108-
? this.layout.xaxis.tickfont.size
109-
: Math.max(10 * (this.sizeProvider.width / 1000), 7)
110-
}
102+
size: Math.max(10 * (this.sizeProvider.width / 1000), 7),
103+
...this.layout.xaxis?.tickfont
104+
},
105+
...this.layout.xaxis
111106
},
112107
yaxis: {
113-
...this.layout.yaxis,
114108
tickfont: {
115-
...this.layout.yaxis?.tickfont,
116-
size: this.layout.yaxis?.tickfont?.size
117-
? this.layout.yaxis.tickfont.size
118-
: Math.max(10 * (this.sizeProvider.width / 1000), 7)
119-
}
109+
size: Math.max(10 * (this.sizeProvider.width / 1000), 7),
110+
...this.layout.yaxis?.tickfont
111+
},
112+
...this.layout.yaxis
120113
},
121114
margin: {
122-
...this.layout.margin,
123-
l: this.layout.margin?.l ? this.layout.margin.l : 60,
124-
r: this.layout.margin?.r ? this.layout.margin.r : 60,
125-
t: this.layout.margin?.t ? this.layout.margin.t : 60,
126-
b: this.layout.margin?.b ? this.layout.margin.b : 60,
127-
pad: this.layout.margin?.pad ? this.layout.margin.pad : 10
115+
l: 60,
116+
r: 60,
117+
t: 60,
118+
b: 60,
119+
pad: 10,
120+
...this.layout.margin
128121
}
129122
};
130123
}

0 commit comments

Comments
 (0)