score:0
var xaxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.tickformat(function(d) {
var minutes = math.floor(d / 60000);
var seconds = +((d % 60000) / 1000).tofixed(0);
return (seconds == 60 ? (minutes+1) + ":00" : minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
});
this will convert milliseconds to minutes and seconds.
score:3
here's the answer for posterity (when you set the date, it should be relative to when you're initializing your other date objects, if necessary):
var xaxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.tickformat(function(d) {
return d3.timeformat('%-m')( new date(0).setseconds(d) ) # formats minutes
});
Source: stackoverflow.com
Related Query
- Converting seconds to minutes and formatting axes
- Formating minutes and seconds on a D3 axis
- d3.js & nvd3.js axis and label precision formatting
- How can I plot positive and negative values for both axes in a scatter plot with d3?
- Using d3.js is there a way to zero align two Y Axes with positive and negative values
- d3 v4 drag line chart with x and y axes
- Converting nodes and links to hierarchical tree in d3.js
- How to apply padding between D3 axes and chart?
- Outliers in Axes in D3 (Mixing numerical and categorical specifications)
- Get X and Y axes values from the mouse position in d3.js
- d3 zoom and drag with SVG axes and canvas chart
- Comparing and converting multiple arrays
- Javascript D3 graph sorting the graph and axes
- d3js v4: independent multiple axes scaling and panning
- Drawing circles via d3js and converting coordinates
- I am trying to build a d3js graph but on the x-axis i am getting the timestamps instead of date and time even after i used formatting
- Set d3 y-axis time format with 15 second increments and seconds % 15 == 0?
- dc.js - Chart not rendering (single row bar chart - horizontal row), with the exception of legend, axes and tick marks/values (which do render)
- Stack and nest not working converting v3 to v4
- Converting shapefiles and geoJson to TopoJson and/or using geo2topo
- Multiple d3 charts on a page with different (linear and log) axes
- How to properly transpose X and Y axes using the D3 axis commands?
- height,width and font not consistent when converting svg to png
- Formatting multiple axes in D3 indivdiually
- Formatting data for use with JSON and D3.js
- Setting range and domain for x time axes in d3 js
- plotting the points x and y, the axes y and x are not shown correctly
- d3.js horizontal stacked bar chart with 2 vertical axes and tooltips
- hide X and Y axes on charts with n3-line-chart
- Not able to update the graph and axes both dynamically in D3.js
More Query from same tag
- Does d3.timer wait for the callback to complete before re-running it?
- D3.js: How can i change xlink:href image after "if..else" Statements
- Animating D3 globe (d3.geo.azimuthal)
- Delimited text to nested javascript object/JSON
- text-anchor don't appear in D3
- Filter data in d3 to draw either circle or square
- d3.js time series infinite scroll
- d3.js Force Directed Graph Not Functioning
- D3: Referencing Drop Down Menu Selection
- convert html5 svg element to pdf without canvas
- DC.JS scatterplot chart selection
- d3.js barchart incorrect alignment
- creating a enlarged duplicate of the d3.js element onclick event
- Drag and linking rectangles, d3+js
- Access Element using D3
- D3.js: yAxis text bold and blur
- D3.Geo performance on Pan/Zoom
- nvd3.js how to properly redraw chart
- Bootstrap get width of div column in pixels
- Operating on exiting data
- d3; attaching multiple svg to div's
- Time series line chart is not sync with axis
- VueJS lifecycle after submit form
- Nested plot and line graph in d3
- d3 transitions stop working after timer ends
- mouseover on d3 force layout bubbles not working
- How to create group on drag drop
- D3 v4 transition or update
- Arc Chart - with various segment indentions/heights
- Collapsible/hierarchical AND force-directed graph in d3.js