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

User Request: Graphing tool for plotting oscillation #347

Open
Denz1994 opened this issue Apr 9, 2019 · 4 comments
Open

User Request: Graphing tool for plotting oscillation #347

Denz1994 opened this issue Apr 9, 2019 · 4 comments

Comments

@Denz1994
Copy link
Contributor

Denz1994 commented Apr 9, 2019

A user at NCTM 2019 (San Diego, CA) suggested a graphing tool to plot the y position of an oscillating spring plotted over an interval of time.

Consider the MemberPotentialChart.jsin Neuron as an example, excluding the playback feature. This isn't the first time this has been suggested according to @ariel-phet so this issue has been created to track the progress of this feature.

@Denz1994
Copy link
Contributor Author

Denz1994 commented Apr 9, 2019

Alternatively, we could use our Griddle library to handle this.

@Denz1994
Copy link
Contributor Author

Denz1994 commented Apr 9, 2019

I did some rough experimenting with XY plotting for about 30 minutes. I was able to plot time (30 sec) along the x-axis and y position(m) along the y-axis using using XYPlot and XYDataSeries. This was just proof of concept so pardon the visuals.
image

   this.plot = new XYPlot( {
      minX: 0,
      maxX: 30,
      minY: 0,
      maxY: 2,
      showVerticalIntermediateLines:false
    } );
    this.series = new XYDataSeries( { color: Color.BLUE } );
    this.plot.addSeries( this.series, true );
    this.plot.x = 0;
    this.plot.y = 500;
    this.addChild( this.plot );
 step: function( dt ) {
      this.energyGraphNode.update();
      this.periodTraceNode.step( dt, this.model.playingProperty );

      // Testing plotting
      if ( this.model.firstSpring.massAttachedProperty.value && !this.model.firstSpring.massAttachedProperty.value.userControlledProperty.value ) {
        console.log( 'x = ', this.model.timerSecondsProperty.value, '\ty =', this.model.firstSpring.massAttachedProperty.value.positionProperty.value.y );
        this.series.addPoint( this.model.timerSecondsProperty.value, this.model.firstSpring.massAttachedProperty.value.positionProperty.value.y );
      }
    }

@arouinfar
Copy link

Nice @Denz1994! Glad to see you got the graph hooked up.

I'll tag for design meeting. Perhaps this is something @kathy-phet, @ariel-phet, and I can review in an upcoming brainstorming meeting.

@ariel-phet ariel-phet self-assigned this Oct 8, 2019
@ariel-phet
Copy link

Received another request for this feature today on twitter - might be worth considering after BAM

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

No branches or pull requests

3 participants