Closed pixelzoom closed 1 year ago
Here's my first attempt at Axis.ts, not committed.
Looking at published version 1.0.26, here is the info for the axes.
=== Fruit ===
Numerator axisLabel: UnitRatesStrings.dollars = 'dollars' maxDigits: 4 maxDecimals: 2 trimZeros: false pickerColor: 'black' valueFormat: UnitRatesStrings.pattern_0cost = '${0}'
Denominator axisLabel: itemData.pluralName maxDigits: 4 maxDecimals: 2 trimZeros: true pickerColor: 'red' valueFormat: SunConstants.VALUE_NUMBERED_PLACEHOLDER = '{0}'
=== Vegetables ===
Numerator axisLabel: UnitRatesStrings.dollars = 'dollars' maxDigits: 4 maxDecimals: 2 trimZeros: false pickerColor: 'black' valueFormat: UnitRatesStrings.pattern_0cost = '${0}'
Denominator axisLabel: itemData.pluralName maxDigits: 4 maxDecimals: 2 trimZeros: true pickerColor: 'orange' valueFormat: SunConstants.VALUE_NUMBERED_PLACEHOLDER = '{0}'
=== Candy ===
Numerator axisLabel: UnitRatesStrings.dollars = 'dollars' maxDigits: 4 maxDecimals: 2 trimZeros: false pickerColor: 'black' valueFormat: UnitRatesStrings.pattern_0cost = '${0}'
Denominator axisLabel: UnitRatesStrings.pounds = 'pounds' maxDigits: 4 maxDecimals: 2 trimZeros: true pickerColor: 'purple' valueFormat: SunConstants.VALUE_NUMBERED_PLACEHOLDER = '{0}'
=== Racing Lab ===
Numerator axisLabel: UnitRatesStrings.miles = 'miles' maxDigits: 5 maxDecimals: 1 trimZeros: true pickerColor: car.color = URColors.car1 = 'red' valueFormat: SunConstants.VALUE_NUMBERED_PLACEHOLDER = '{0}'
Denominator axisLabel: itemData.pluralName = 'hours' maxDigits: 4 maxDecimals: 2 trimZeros: true pickerColor: car.color = URColors.car2 = 'red' valueFormat: SunConstants.VALUE_NUMBERED_PLACEHOLDER = '{0}'
Done in the above commits. The various numeratorOptions
and denominatorOptions
have been replaced by numeratorAxis: Axis
and denominatorAxis: Axis
throughout.
Tested by manually comparing to published 1.0.26 and the specification in https://github.com/phetsims/unit-rates/issues/221.
Closing.
numeratorOptions
anddenominatorOptions
are confused throughout. They are also the only case where@ts-expect-error
was needed for TypeScript, in https://github.com/phetsims/unit-rates/issues/219. They should be cleaned up when there's time.In DoubleNumberLine.ts:
In ShoppingQuestionsFactory.ts
In ShoppingScene.ts:
It might be nice to define an
Axis
class in the model, with instancesnumeratorAxis
anddenominatorAxis
.