@@ -23,7 +23,7 @@ import {
2323 Revision ,
2424 ComparisonRevisionData ,
2525 DEFAULT_SECTION_COLLAPSED ,
26- DEFAULT_SECTION_NB_ITEMS_PER_ROW ,
26+ DEFAULT_SECTION_NB_ITEMS_PER_ROW_OR_WIDTH ,
2727 PlotsSection ,
2828 SectionCollapsed ,
2929 CustomPlotData ,
@@ -56,7 +56,7 @@ export type CustomPlotsOrderValue = { metric: string; param: string }
5656export class PlotsModel extends ModelWithPersistence {
5757 private readonly experiments : Experiments
5858
59- private nbItemsPerRow : Record < PlotsSection , number >
59+ private nbItemsPerRowOrWidth : Record < PlotsSection , number >
6060 private height : Record < PlotsSection , PlotHeight >
6161 private customPlotsOrder : CustomPlotsOrderValue [ ]
6262 private sectionCollapsed : SectionCollapsed
@@ -85,9 +85,9 @@ export class PlotsModel extends ModelWithPersistence {
8585 super ( dvcRoot , workspaceState )
8686 this . experiments = experiments
8787
88- this . nbItemsPerRow = this . revive (
89- PersistenceKey . PLOT_NB_ITEMS_PER_ROW ,
90- DEFAULT_SECTION_NB_ITEMS_PER_ROW
88+ this . nbItemsPerRowOrWidth = this . revive (
89+ PersistenceKey . PLOT_NB_ITEMS_PER_ROW_OR_WIDTH ,
90+ DEFAULT_SECTION_NB_ITEMS_PER_ROW_OR_WIDTH
9191 )
9292 this . height = this . revive ( PersistenceKey . PLOT_HEIGHT , DEFAULT_HEIGHT )
9393
@@ -183,7 +183,9 @@ export class PlotsModel extends ModelWithPersistence {
183183 return {
184184 colors,
185185 height : this . getHeight ( PlotsSection . CHECKPOINT_PLOTS ) ,
186- nbItemsPerRow : this . getNbItemsPerRow ( PlotsSection . CHECKPOINT_PLOTS ) ,
186+ nbItemsPerRow : this . getNbItemsPerRowOrWidth (
187+ PlotsSection . CHECKPOINT_PLOTS
188+ ) ,
187189 plots : this . getPlots ( this . checkpointPlots , selectedExperiments ) ,
188190 selectedMetrics : this . getSelectedMetrics ( )
189191 }
@@ -195,7 +197,7 @@ export class PlotsModel extends ModelWithPersistence {
195197 }
196198 return {
197199 height : this . getHeight ( PlotsSection . CUSTOM_PLOTS ) ,
198- nbItemsPerRow : this . getNbItemsPerRow ( PlotsSection . CUSTOM_PLOTS ) ,
200+ nbItemsPerRow : this . getNbItemsPerRowOrWidth ( PlotsSection . CUSTOM_PLOTS ) ,
199201 plots : this . customPlots
200202 }
201203 }
@@ -403,14 +405,17 @@ export class PlotsModel extends ModelWithPersistence {
403405 this . persist ( PersistenceKey . PLOT_METRIC_ORDER , this . metricOrder )
404406 }
405407
406- public setNbItemsPerRow ( section : PlotsSection , nbItemsPerRow : number ) {
407- this . nbItemsPerRow [ section ] = nbItemsPerRow
408- this . persist ( PersistenceKey . PLOT_NB_ITEMS_PER_ROW , this . nbItemsPerRow )
408+ public setNbItemsPerRowOrWidth ( section : PlotsSection , nbItemsPerRow : number ) {
409+ this . nbItemsPerRowOrWidth [ section ] = nbItemsPerRow
410+ this . persist (
411+ PersistenceKey . PLOT_NB_ITEMS_PER_ROW_OR_WIDTH ,
412+ this . nbItemsPerRowOrWidth
413+ )
409414 }
410415
411- public getNbItemsPerRow ( section : PlotsSection ) {
412- if ( this . nbItemsPerRow [ section ] ) {
413- return this . nbItemsPerRow [ section ]
416+ public getNbItemsPerRowOrWidth ( section : PlotsSection ) {
417+ if ( this . nbItemsPerRowOrWidth [ section ] ) {
418+ return this . nbItemsPerRowOrWidth [ section ]
414419 }
415420 return DEFAULT_NB_ITEMS_PER_ROW
416421 }
@@ -511,7 +516,7 @@ export class PlotsModel extends ModelWithPersistence {
511516 id,
512517 title : truncateVerticalTitle (
513518 id ,
514- this . getNbItemsPerRow ( PlotsSection . CHECKPOINT_PLOTS ) ,
519+ this . getNbItemsPerRowOrWidth ( PlotsSection . CHECKPOINT_PLOTS ) ,
515520 this . getHeight ( PlotsSection . CHECKPOINT_PLOTS )
516521 ) as string ,
517522 values : values . filter ( value =>
@@ -563,7 +568,7 @@ export class PlotsModel extends ModelWithPersistence {
563568 selectedRevisions . map ( ( { revision } ) => revision ) ,
564569 this . templates ,
565570 this . revisionData ,
566- this . getNbItemsPerRow ( PlotsSection . TEMPLATE_PLOTS ) ,
571+ this . getNbItemsPerRowOrWidth ( PlotsSection . TEMPLATE_PLOTS ) ,
567572 this . getHeight ( PlotsSection . TEMPLATE_PLOTS ) ,
568573 this . getRevisionColors ( selectedRevisions ) ,
569574 this . multiSourceEncoding
0 commit comments