Commit fdde97370155ae2567cff589aec8235529a12f25
1 parent
099ab666
fix: visual instrument component 2 scale can not dynamic update
Showing
1 changed file
with
4 additions
and
1 deletions
... | ... | @@ -304,12 +304,15 @@ export const update_instrument_2_value = (params: DashBoardValue) => { |
304 | 304 | |
305 | 305 | let max = thirdRecord?.value || secondRecord?.value || firstRecord?.value || 70; |
306 | 306 | max = Number(1 + Array(String(max).length).fill(0).join('')); |
307 | + max = value > 1 ? Number(1 + Array(String(value).length).fill(0).join('')) / 2 : 100 / 2; | |
308 | + max = value > max ? max * 2 : max; | |
307 | 309 | |
308 | 310 | const firstGradient = firstRecord?.value ? firstRecord.value / max : 0.3; |
309 | 311 | const secondGradient = secondRecord?.value ? secondRecord.value / max : 0.7; |
310 | 312 | return { |
311 | 313 | series: [ |
312 | 314 | { |
315 | + max: max < 100 ? 100 : max, | |
313 | 316 | data: [{ value: handleValue(value) }], |
314 | 317 | detail: { |
315 | 318 | formatter: `{value} ${unit ?? ''}`, |
... | ... | @@ -351,7 +354,7 @@ export const Instrument2DefaultConfig: Partial<ComponentInfo> = { |
351 | 354 | |
352 | 355 | export const transformDashboardComponentConfig = ( |
353 | 356 | config: DashboardComponentLayout, |
354 | - record: DataComponentRecord, | |
357 | + _record: DataComponentRecord, | |
355 | 358 | dataSourceRecord: DataSource |
356 | 359 | ) => { |
357 | 360 | let chartOption = config.chartOption; | ... | ... |