Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Population data does not clip properly when scrolling through generations #146

Closed
phet-steele opened this issue Jul 31, 2020 · 12 comments
Closed
Assignees
Labels

Comments

@phet-steele
Copy link

phet-steele commented Jul 31, 2020

It looks like data from "further down" the x axis gets "squished" onto the chart when scrolling through generations. In the below screenshots, notice in the Before screenshot that the 5th generation shows the pop. at ~500, and the 6th generation is ~1400. Once you scroll backwards to view the 1st generation (and hide the 6th generation) in the After screenshot, the drawn section of the 6th generation does not get clipped correctly and gets drawn over the 5th gen data, making it tricky to read.

Up to @amanda-phet to decide if this has a problematic pedagogical impact and if it should be addressed before the prototype release. There is no setup for this to occur; it will happen every time you scroll through generations and occurs for all data types, not just "Total".

Before:
image

After:
image

Seen on Win 10 Chrome 84.0.4147.89. For phetsims/qa/issues/522.

Troubleshooting Information

Name: ‪Natural Selection‬
URL: https://phet-dev.colorado.edu/html/natural-selection/1.0.0-rc.1/phet/natural-selection_all_phet.html
Version: 1.0.0-rc.1 2020-07-29 19:13:57 UTC
Features missing: touch
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Language: en-US
Window: 1456x923
Pixel Ratio: 1/1
WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium)
GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium)
Vendor: WebKit (WebKit WebGL)
Vertex: attribs: 16 varying: 30 uniform: 4095
Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32)
Max viewport: 32767x32767
OES_texture_float: true

@phet-steele phet-steele added the type:bug Something isn't working label Jul 31, 2020
@pixelzoom
Copy link
Contributor

No need for @amanda-phet to review, this is buggy. Should be an easy fix.

@pixelzoom pixelzoom assigned pixelzoom and unassigned amanda-phet Jul 31, 2020
@pixelzoom
Copy link
Contributor

pixelzoom commented Jul 31, 2020

Note to self: the problem is in PopulationPlotNode.plotPoints.

Steps to reproduce:

  1. Start the sim with ?secondsPerGeneration=1
  2. Go to either screen
  3. Set Population graph y-axis range to 0-2000.
  4. Press "Add a Mate" button.
  5. Wait for bunnies to take over the world, close dialog
  6. Press left arrow button for Generation below the Population graph

@pixelzoom
Copy link
Contributor

I also discovered that PopulationPlotNode does not handle the case where a count remains constant for > 6 generations, and we need to connect 2 points where p1.x < xRange.min and p2.x > xRange.max. I haven't seen that happen, but it could.

@pixelzoom
Copy link
Contributor

I totally rewrote PopulationPlotNode.plotPoints to handle all possible datasets. So it's now less specific to Natural Selection, and more general, in case we ever need to reuse it elsewhere (e.g. in griddle).

@amanda-phet and @phet-steele please have a look at this in 1.1.0-dev.3, with high priority since it's a major change.

@pixelzoom
Copy link
Contributor

Cherry-picked to 1.0 (prototype) branch.

@pixelzoom
Copy link
Contributor

pixelzoom commented Aug 5, 2020

@amanda-phet if you could prioritize review of this issue, it would be great. It needs to be completed before I can publish the next RC for the 1.0 prototype.

@amanda-phet
Copy link
Contributor

Looks good to me.

@phet-steele
Copy link
Author

The original issue seems fine, but I'm seeing weird behaviour.

  1. Intro screen, enable at least "brown fur" in the population graph
  2. Add a mate
  3. Run until gen 3, then add limited food
  4. Run until gen 5, then add the fur mutation (doesn't matter which is chosen to be dominant)
  5. Let the sim run for 6+ generations and until there are >0 brown fur bunnies.

In the below screenshots, you'll notice that when I am viewing the data for gen 6+, everything looks fine. But as soon as I scroll and clip gen 6, the data is incorrect (the dashed line should be at 0, not 4)

Before:
image

After:
image

This was seen on Win 10 Chrome using https://phet-dev.colorado.edu/html/natural-selection/1.1.0-dev.3/phet/natural-selection_all_phet.html

pixelzoom added a commit that referenced this issue Aug 7, 2020
@pixelzoom
Copy link
Contributor

Good catch @phet-steele. Fixed in the above commit. Please verify in master.

@pixelzoom
Copy link
Contributor

@phet-steele
Copy link
Author

#146 (comment) looks resolved in 1.1.0-dev.4.

@pixelzoom
Copy link
Contributor

Excellent, thanks @phet-steele. Since the next RC is going to be published out of master, I'm going to go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants