Skip to content

Commit 5c4ea13

Browse files
committed
fix scale
Signed-off-by: Qxisylolo <[email protected]>
1 parent 3d63f35 commit 5c4ea13

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/plugins/explore/public/components/visualizations/bar_gauge/to_expression.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ export const createBarGaugeSpec = (
107107
const maxBase = styleOptions?.max ?? maxNumber;
108108
const minBase = styleOptions?.min ?? 0;
109109

110+
const scaleType =
111+
styleOptions.exclusive.displayMode === 'stack'
112+
? {
113+
scale: {
114+
domainMin: { expr: 'minBase' },
115+
},
116+
}
117+
: { domain: { expr: '[minBase,maxBase]' } };
118+
110119
const params = [
111120
{ name: 'fontColor', value: getColors().text },
112121
{
@@ -143,21 +152,13 @@ export const createBarGaugeSpec = (
143152
field: yAxis?.column,
144153
type: getSchemaByAxis(yAxis),
145154
...yAxisStyle,
146-
...(!adjustEncoding
147-
? {
148-
domain: { expr: '[minBase,maxBase]' },
149-
}
150-
: {}),
155+
...(!adjustEncoding ? scaleType : {}),
151156
},
152157
x: {
153158
field: xAxis?.column,
154159
type: getSchemaByAxis(xAxis),
155160
...xAxisStyle,
156-
...(adjustEncoding
157-
? {
158-
domain: { expr: '[minBase,maxBase]' },
159-
}
160-
: {}),
161+
...(adjustEncoding ? scaleType : {}),
161162
},
162163
...(styleOptions.tooltipOptions?.mode !== 'hidden' && {
163164
tooltip: [
@@ -239,16 +240,10 @@ export const createBarGaugeSpec = (
239240
[`${processedSymbol}`]: {
240241
type: 'quantitative',
241242
field: 'gradEnd',
242-
scale: {
243-
domainMin: { expr: 'minBase' },
244-
},
245243
},
246244

247245
[`${processedSymbol}2`]: {
248246
field: 'gradStart',
249-
scale: {
250-
domainMin: { expr: 'minBase' },
251-
},
252247
},
253248
},
254249
},

0 commit comments

Comments
 (0)