Skip to content

Commit

Permalink
Customize histogram zoom levels for PSD sim - see #310
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-blackman committed Apr 23, 2024
1 parent fe3d500 commit 6c6e4ec
Showing 1 changed file with 56 additions and 25 deletions.
81 changes: 56 additions & 25 deletions js/common/model/Histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import HistogramSonifier from './HistogramSonifier.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import PDLPreferences from '../PDLPreferences.js';
import packageJSON from '../../../../joist/js/packageJSON.js';

// ZoomLevel describes the characteristics of how the HistogramNode and the SampleSizeThumbnailNode look at a given zoom
// level.
Expand All @@ -36,31 +37,61 @@ type ZoomLevel = {
numberOfThumbnailGridLines: number;
};

export const ZOOM_LEVELS: ZoomLevel[] = [ {
maxCount: 500,
minorSpacing: 10,
numberOfThumbnailGridLines: 15
}, {
maxCount: 200,
minorSpacing: 8,
numberOfThumbnailGridLines: 13
}, {
maxCount: 100,
minorSpacing: 5,
numberOfThumbnailGridLines: 11
}, {
maxCount: 75,
minorSpacing: 5,
numberOfThumbnailGridLines: 9
}, {
maxCount: 50,
minorSpacing: 5,
numberOfThumbnailGridLines: 7
}, {
maxCount: 25,
minorSpacing: null,
numberOfThumbnailGridLines: 5
} ];
// On the Projectile Sampling Distributions sim, the zoom levels are different from the Projectile Data Lab sim.
export const ZOOM_LEVELS: ZoomLevel[] = packageJSON.name === 'projectile-sampling-distributions' ?
[ {
maxCount: 250,
minorSpacing: 5,
numberOfThumbnailGridLines: 17
}, {
maxCount: 200,
minorSpacing: 5,
numberOfThumbnailGridLines: 15
}, {
maxCount: 150,
minorSpacing: 5,
numberOfThumbnailGridLines: 13
}, {
maxCount: 100,
minorSpacing: 5,
numberOfThumbnailGridLines: 11
}, {
maxCount: 75,
minorSpacing: 5,
numberOfThumbnailGridLines: 9
}, {
maxCount: 50,
minorSpacing: 5,
numberOfThumbnailGridLines: 7
}, {
maxCount: 25,
minorSpacing: null,
numberOfThumbnailGridLines: 5
} ] : [ {
maxCount: 500,
minorSpacing: 10,
numberOfThumbnailGridLines: 15
}, {
maxCount: 200,
minorSpacing: 8,
numberOfThumbnailGridLines: 13
}, {
maxCount: 100,
minorSpacing: 5,
numberOfThumbnailGridLines: 11
}, {
maxCount: 75,
minorSpacing: 5,
numberOfThumbnailGridLines: 9
}, {
maxCount: 50,
minorSpacing: 5,
numberOfThumbnailGridLines: 7
}, {
maxCount: 25,
minorSpacing: null,
numberOfThumbnailGridLines: 5
} ];

type SelfOptions = EmptySelfOptions;
type HistogramOptions = SelfOptions & PickRequired<PhetioObjectOptions, 'tandem'>;
Expand Down

0 comments on commit 6c6e4ec

Please sign in to comment.