The key is this line:
let xAxis = axisBottom().scale(x).ticks(6);
Try changing like so:
let xAxis = axisBottom(x).ticks(6);
For a full working example see - jsFiddle
Improved the above js fiddle to include formatting.
Snippet from jsFiddle below:
let x = d3 .scaleTime() .range([0, totalWidth]) .domain(d3.extent(data)); let xAxis = d3 .axisBottom(x) .ticks(d3.timeDay, 1) .tickFormat(d3.timeFormat("%a %d"));
- D3v4 time scale axis error in ticks display
- D3 time scale axis ticks are irregular on year boundaries
- How to spcify ticks on x axis for time scale in d3js?
- Time scale axis ticks positions
- d3.js time scale axis ticks are not equally spaced
- d3 time scale x axis with unix timestamp
- d3.js - Time scale with ticks in milliseconds
- d3js set tickValues for time scale axis
- Display only values from the data set into X axis ticks
- dc.js modify time scale x axis after filtering
- D3 time scale – ticks(count) yields error, omitting ticks(count) yields no error
- NVD3 x axis time scale misaligned
- Display different values on axis than those found by the scale function in D3
- Give outerspacepadding at x axis with time scale in d3 js
- D3, variable x axis ticks based on time
- Setting ticks on a time scale during zoom
- d3 time axis NaN error
- d3.js scale time on x axis not working
- Round x axis of a time scale to nearest half hour
- D3 decennial time scale ticks with data formatted as years
- Display missing ticks on y axis
- d3 js time axis ticks slightly off / skewed /moved
- D3js Changing ticks on Zoomable Time axis
- d3 changing x Axis Time ticks only full years and full months
- labels on x axis in scale time d3.js
- JS d3 scale time doesn't produce the correct ticks
- D3 Line chart - display value label on Y axis tick and a not scale
- D3.js - Line graph does not display Y axis and scale of X axis is incorrect
- Histogram with Time scale error in D3
- D3 Updating x axis ticks throws error "translate(NaN,0)"
More Query from same tag
- Draw a graph using D3 (v3) in a WebWorker
- D3.js collapsable tree - visualise set number of levels
- D3 line chart giving wrong values at highest number
- Popup form to edit shape position and label?
- D3.js v4.10 x-axis timscale and XMLHttpRequest Data
- How do I render D3 with D3-force in Meteor-React setting?
- Live code examples of NVD3 does not accept my JSON
- D3 bounded dragging
- How to display all circles when none is selected in d3?
- Trying to create an SVG with a grid of images. But the images don't show
- d3js how to scroll or tween properties
- d3.js line chart not rendering stocks line chart
- Plot timeline graph with repetitive image patten in d3.js
- D3.js in line Chart fetch data from local variable
- d3js animated horizontal chart improvements
- d3.behavior.zoom disable double tap behaviour
- Dynamically new dimensions with D3 JS parallel sets
- d3.json, d3.xhr and cross-domain problems
- Not able to generate area in D3
- Get width from element using D3.js
- D3 trouble while appending text on mouseover
- XMLHTTPRequest error while trying to add d3 to project
- d3.js force directed tree matrix
- Given latitude and longitude, plotting points on D3 geo projection
- d3.js throws an error 't.slice is not a function'
- Maximum Capacity of Input Data (CSV or JSON format) in drawing D3 visualization?
- react-d3-graph set starting positions for nodes
- D3 Concentric/Nested Donut Chart
- How to efficiently remove first element from a selection?