Commit fdde97370155ae2567cff589aec8235529a12f25

Authored by ww
1 parent 099ab666

fix: visual instrument component 2 scale can not dynamic update

@@ -304,12 +304,15 @@ export const update_instrument_2_value = (params: DashBoardValue) => { @@ -304,12 +304,15 @@ export const update_instrument_2_value = (params: DashBoardValue) => {
304 304
305 let max = thirdRecord?.value || secondRecord?.value || firstRecord?.value || 70; 305 let max = thirdRecord?.value || secondRecord?.value || firstRecord?.value || 70;
306 max = Number(1 + Array(String(max).length).fill(0).join('')); 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 const firstGradient = firstRecord?.value ? firstRecord.value / max : 0.3; 310 const firstGradient = firstRecord?.value ? firstRecord.value / max : 0.3;
309 const secondGradient = secondRecord?.value ? secondRecord.value / max : 0.7; 311 const secondGradient = secondRecord?.value ? secondRecord.value / max : 0.7;
310 return { 312 return {
311 series: [ 313 series: [
312 { 314 {
  315 + max: max < 100 ? 100 : max,
313 data: [{ value: handleValue(value) }], 316 data: [{ value: handleValue(value) }],
314 detail: { 317 detail: {
315 formatter: `{value} ${unit ?? ''}`, 318 formatter: `{value} ${unit ?? ''}`,
@@ -351,7 +354,7 @@ export const Instrument2DefaultConfig: Partial<ComponentInfo> = { @@ -351,7 +354,7 @@ export const Instrument2DefaultConfig: Partial<ComponentInfo> = {
351 354
352 export const transformDashboardComponentConfig = ( 355 export const transformDashboardComponentConfig = (
353 config: DashboardComponentLayout, 356 config: DashboardComponentLayout,
354 - record: DataComponentRecord, 357 + _record: DataComponentRecord,
355 dataSourceRecord: DataSource 358 dataSourceRecord: DataSource
356 ) => { 359 ) => {
357 let chartOption = config.chartOption; 360 let chartOption = config.chartOption;