update: 隐藏图表的准确率
This commit is contained in:
parent
ae88d465ee
commit
36ff64fd96
@ -7,7 +7,7 @@
|
||||
<div class="chart-container" id="chartContainer">
|
||||
<div id="stationInfoTitle" class="station-info-title">{{ selectedTitle }}</div>
|
||||
<div class="chart-wrapper">
|
||||
<chart-panel [history]="history" [forecast]="forecast" [legendMode]="legendMode"></chart-panel>
|
||||
<chart-panel [history]="history" [forecast]="forecast" [legendMode]="legendMode" [showAccuracy]="false"></chart-panel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="map-container" id="mapContainer">
|
||||
|
||||
@ -10,6 +10,7 @@ export class ChartPanelComponent implements OnChanges {
|
||||
@Input() history: WeatherPoint[] = [];
|
||||
@Input() forecast: ForecastPoint[] = [];
|
||||
@Input() legendMode: string = 'combo_standard';
|
||||
@Input() showAccuracy: boolean = true;
|
||||
|
||||
@ViewChild('canvas', { static: true }) canvas!: ElementRef<HTMLCanvasElement>;
|
||||
@ViewChild('accPanel', { static: true }) accPanel!: ElementRef<HTMLDivElement>;
|
||||
@ -155,6 +156,7 @@ export class ChartPanelComponent implements OnChanges {
|
||||
|
||||
private updateAccuracyPanel(labels: string[], historyRain: (number|null)[], h1: (number|null)[], h2: (number|null)[], h3: (number|null)[]) {
|
||||
const panel = this.accPanel?.nativeElement; if (!panel) return;
|
||||
if (!this.showAccuracy) { panel.style.display = 'none'; return; }
|
||||
const isNum = (v:any)=> v!=null && !isNaN(Number(v));
|
||||
const usedIdx = historyRain.map((v, idx) => ({v, idx})).filter(x => isNum(x.v)).map(x => x.idx);
|
||||
const total = usedIdx.length;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user