Update plot data based on slider selection

Hi

I have a data set of x,y and z values. I am trying to update the x and y data values on my chart depending on the z value selected on the slider. The z values are dates.

I have looked at the example and i am trying to use it, https://plot.ly/javascript/gapminder-example/

But I’ve got a little stuck in the part where you set the frame data values.

var frames = [];
for (i = 0; i < points.length; i++) {
frames.push({
name: points[i].z,
data: ???

JS fiddle here: https://jsfiddle.net/MulliganL/rdcg0819/

Any advice would be greatly appreciated

Thanks