>;
cardsAtFullHeight = new Set();
@@ -69,6 +84,21 @@ export class SuperimposedCardsViewComponent {
this.cardsAtFullWidth$ = this.store.select(getFullWidthSuperimposedCards);
}
+ ngOnChanges(changes: SimpleChanges) {
+ if (changes['cardMinWidth']) {
+ const width = changes['cardMinWidth'].currentValue;
+ if (
+ width &&
+ width >= MIN_CARD_MIN_WIDTH_IN_PX &&
+ width <= MAX_CARD_MIN_WIDTH_IN_PX
+ ) {
+ this.gridTemplateColumn = `repeat(auto-fill, minmax(${width}px, 1fr))`;
+ } else {
+ this.gridTemplateColumn = '';
+ }
+ }
+ }
+
trackByCard(index: number, card: SuperimposedCardMetadata): string {
return card.id;
}
diff --git a/tensorbored/webapp/metrics/views/main_view/superimposed_cards_view_container.ts b/tensorbored/webapp/metrics/views/main_view/superimposed_cards_view_container.ts
index 15231d87808..1ccd19084ea 100644
--- a/tensorbored/webapp/metrics/views/main_view/superimposed_cards_view_container.ts
+++ b/tensorbored/webapp/metrics/views/main_view/superimposed_cards_view_container.ts
@@ -17,6 +17,7 @@ import {Store} from '@ngrx/store';
import {Observable} from 'rxjs';
import {startWith} from 'rxjs/operators';
import {State} from '../../../app_state';
+import {getMetricsCardMinWidth} from '../../../selectors';
import {getSuperimposedCardsWithMetadata} from '../../store';
import {SuperimposedCardMetadata} from '../../types';
import {CardObserver} from '../card_renderer/card_lazy_loader';
@@ -28,6 +29,7 @@ import {CardObserver} from '../card_renderer/card_lazy_loader';
`,
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -35,11 +37,13 @@ import {CardObserver} from '../card_renderer/card_lazy_loader';
export class SuperimposedCardsViewContainer {
@Input() cardObserver!: CardObserver;
+ readonly superimposedCards$: Observable;
+ readonly cardMinWidth$: Observable;
+
constructor(private readonly store: Store) {
this.superimposedCards$ = this.store
.select(getSuperimposedCardsWithMetadata)
.pipe(startWith([]));
+ this.cardMinWidth$ = this.store.select(getMetricsCardMinWidth);
}
-
- readonly superimposedCards$: Observable;
}
diff --git a/tensorbored/webapp/widgets/line_chart_v2/line_chart_component.ts b/tensorbored/webapp/widgets/line_chart_v2/line_chart_component.ts
index b7cbf9d5f78..911b76abd9d 100644
--- a/tensorbored/webapp/widgets/line_chart_v2/line_chart_component.ts
+++ b/tensorbored/webapp/widgets/line_chart_v2/line_chart_component.ts
@@ -250,6 +250,17 @@ export class LineChartComponent
this.setIsViewBoxOverridden(false);
}
+ // When the chart transitions from disabled to enabled, the container may
+ // have been resized while updates were suppressed (e.g. persistResize
+ // restoring a height, or a full-width toggle applied asynchronously).
+ // The ResizeDetectorDirective's skip(1) can swallow the only
+ // ResizeObserver event in that window, leaving the renderer and the
+ // interactive overlay with stale dimensions. Re-read and apply now.
+ if (changes['disableUpdate'] && !this.disableUpdate && this.lineChart) {
+ this.readAndUpdateDomDimensions();
+ this.lineChart.resize(this.domDimensions.main);
+ }
+
this.isViewBoxChanged =
this.isViewBoxChanged ||
this.userViewBoxUpdated ||