Converting milliseconds to Mins/Secs format in D3

I’m doing the 2nd of the final projects in the Data Visualization course, where we have to make a scatterplot of dates on the X axis, and times (in mins:secs) on the Y axis.

I have everything finished, except the correct display of the times on the Y axis. It’s displaying in milliseconds, and I can’t figure out a simple way to convert them to Mins:Secs like in the example we need to emulate.

I figure it has something to do with adding a tickFormat to the Y axis, but I’ve tried several things and none of them have worked. Any help is greatly appreciated!

Link to the pen:

I figured this out, in case anyone else is having this problem.

In order to use “.tickFormat(d3.timeFormat(”%M:%S"))" on the yAxis, the time first has to be converted into milliseconds, as in, multiplied by 1000.

I did that in the yScale domain and circle plotting sections and now everything displays correctly.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.