Skip to content

Commit

Permalink
dynamically center 'No Data' in Proportions graph, #319
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 21, 2023
1 parent 6a177af commit 6613686
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/common/view/proportions/ProportionsGraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ export default class ProportionsGraphNode extends Node {
// 'No Data', visible when we have no data to display.
const noDataText = new Text( NaturalSelectionStrings.noDataStringProperty, {
font: NaturalSelectionConstants.INSTRUCTIONS_FONT,
centerX: backgroundNode.centerX,
centerY: backgroundNode.top + ( backgroundNode.height / 6 ),
maxWidth: 0.5 * backgroundNode.width,
tandem: options.tandem.createTandem( 'noDataText' )
} );
noDataText.boundsProperty.link( bounds => {
noDataText.centerX = backgroundNode.centerX;
noDataText.centerY = backgroundNode.top + ( backgroundNode.height / 6 );
} );

assert && assert( !options.children, 'ProportionGraphNode sets children' );
options.children = [ backgroundNode, noDataText, content ];
Expand Down

0 comments on commit 6613686

Please sign in to comment.