Skip to content

Commit

Permalink
For projectile-sampling-distributions: remove bin width of 10, set de…
Browse files Browse the repository at this point in the history
…fault bin width to 0.5, remove total number of bins, see #317 and #318 and #315

(cherry picked from commit b81909b)
  • Loading branch information
samreid committed Apr 24, 2024
1 parent c655901 commit 107ba25
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
3 changes: 2 additions & 1 deletion js/common/PDLPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import PDLQueryParameters from './PDLQueryParameters.js';
import projectileDataLab from '../projectileDataLab.js';
import { LaunchSoundStrategy, LaunchSoundStrategyValues } from './LaunchSoundStrategy.js';
import BooleanProperty from '../../../axon/js/BooleanProperty.js';
import packageJSON from '../../../joist/js/packageJSON.js';

const PDLPreferences = {

Expand All @@ -32,7 +33,7 @@ const PDLPreferences = {
// phet-types.d.ts does not support inferring string union types for string query parameters, so we need to cast
binStrategyProperty: new StringUnionProperty( PDLQueryParameters.binStrategy as BinStrategy, {
validValues: BinStrategyValues,
tandem: Tandem.PREFERENCES.createTandem( 'binStrategyProperty' ),
tandem: packageJSON.name === 'projectile-data-lab' ? Tandem.PREFERENCES.createTandem( 'binStrategyProperty' ) : Tandem.OPT_OUT,
phetioFeatured: true,
phetioDocumentation: 'Indicates whether the histogram bins are sized based on the bin width or the number of bins.'
} ),
Expand Down
10 changes: 7 additions & 3 deletions js/common/model/Histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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';
import Tandem from '../../../../tandem/js/Tandem.js';

// ZoomLevel describes the characteristics of how the HistogramNode and the SampleSizeThumbnailNode look at a given zoom
// level.
Expand Down Expand Up @@ -124,8 +125,11 @@ export default class Histogram {
playMeanTone: () => void, // See the method declaration in PDLModel.ts
providedOptions: HistogramOptions ) {

this.selectedBinWidthProperty = new NumberProperty( 1, {
validValues: [ 0.5, 1, 2, 5, 10 ],
this.selectedBinWidthProperty = new NumberProperty( packageJSON.name === 'projectile-sampling-distributions' ? 0.5 : 1, {
validValues: [ 0.5, 1, 2, 5,

...( packageJSON.name === 'projectile-data-lab' ? [ 10 ] : [] )
],
tandem: providedOptions.tandem.createTandem( 'selectedBinWidthProperty' ),
phetioFeatured: true,
phetioDocumentation: 'This Property configures the bin width of the field and histogram. It is used when the bin strategy is "bin width".',
Expand All @@ -134,7 +138,7 @@ export default class Histogram {

this.selectedTotalBinsProperty = new NumberProperty( 10, {
validValues: [ 10, 20, 50, 100, 200 ],
tandem: providedOptions.tandem.createTandem( 'selectedTotalBinsProperty' ),
tandem: packageJSON.name === 'projectile-data-lab' ? providedOptions.tandem.createTandem( 'selectedTotalBinsProperty' ) : Tandem.OPT_OUT,
phetioFeatured: true,
phetioDocumentation: 'This Property configures the total number of bins in the histogram. It is used when the bin strategy is "total bins".'
} );
Expand Down
24 changes: 12 additions & 12 deletions js/common/view/SimulationPreferencesContentNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ export default class SimulationPreferencesContentNode extends PreferencesPanelCo
} );

content.push( showStandardErrorControl );
}

const binStrategyControl = new PreferencesControl( {
labelNode: new PDLText( ProjectileDataLabStrings.histogramBinsStringProperty, PreferencesDialogConstants.CONTROL_LABEL_OPTIONS ),
descriptionNode: new RichText( ProjectileDataLabStrings.histogramBinsPreferenceDescriptionStringProperty, PreferencesDialogConstants.CONTROL_DESCRIPTION_OPTIONS ),
controlNode: binTypeRadioButtonGroup,
tandem: binStrategyControlTandem,
phetioFeatured: true,
visiblePropertyOptions: {
phetioFeatured: true
}
} );
const binStrategyControl = new PreferencesControl( {
labelNode: new PDLText( ProjectileDataLabStrings.histogramBinsStringProperty, PreferencesDialogConstants.CONTROL_LABEL_OPTIONS ),
descriptionNode: new RichText( ProjectileDataLabStrings.histogramBinsPreferenceDescriptionStringProperty, PreferencesDialogConstants.CONTROL_DESCRIPTION_OPTIONS ),
controlNode: binTypeRadioButtonGroup,
tandem: binStrategyControlTandem,
phetioFeatured: true,
visiblePropertyOptions: {
phetioFeatured: true
}
} );

content.push( binStrategyControl );
content.push( binStrategyControl );
}

super( {
fill: null,
Expand Down

0 comments on commit 107ba25

Please sign in to comment.