score:1
Accepted answer
I'm not sure how d3 will coerce your date strings into dates so I'd suggest converting them explicitly. I think that should fix your problem.
First in the source data e.g.
var timeFormat = d3.time.format("%m/%d/%Y");
var cd = data.filter(function(d) {
return (d.Style == "solo")
})
.map(function(d){
d["starting date"] = timeFormat.parse(d["starting date"]);
d["arrival date"] = timeFormat.parse(d["arrival date"]);
return d;
});
And then similarly when you create your domain...
var x = d3.time.scale()
.domain([timeFormat.parse('11/18/1992'), timeFormat.parse('10/25/2013')])
.range([0, w]);
To determine the extent of the dates automatically you could use d3.array.extent
(docs)
Source: stackoverflow.com
Related Query
- How to set date range when using d3.time.scale()
- How can I set a minimum range for an interval for a time scale in d3.js?
- how to set proper domain for date time scale in d3
- How to do SVG translation when using time scale on X-axis in D3
- How to set up brush extent in d3 js while using time scale?
- Why do the d3 time range functions normalize values when using step?
- How to fix d3 parsing error when using function and return value to set "d"?
- How to scale an integer to date with range and domain
- Wrong values returned for x(i) when using time scale in D3.js
- How do I take into account scale when getting height/width of a d3 element using bounding rectangle
- How to put data on line chart when x axis and data has a time range
- How to remove unwanted lines in Axis scale of a graph when using D3.js?
- How do I set a different range for line chart embedded in a bar chart using d3.js
- How to set a scale for the time series, current x scale gives me NaN?
- How to place a date in a tooltip when only part of axis ticks with dates are shown? Using D3.js
- How to set fixed number of ticks despite the number of date range
- How do I prevent selection of data outside my selected range from highlighting when using crossfilter.js?
- d3.js & nvd3.js -- How to set y-axis range
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- D3.js How to apply multiple classes when using a function
- How do I resolve "[ERR_REQUIRE_ESM]: Must use import to load ES Module" when using D3.js 7.0.0 with Next.js 11.0.1?
- d3.js how to get minimum value of scale's domain when using nice()
- how to set the domain and scale on an axis on a nvd3.js multiBarChart
- D3js: How do I clear the zoom scale set by the d3.zoom event?
- How can I show a graph using d3 force layout with initial positions set and no movement at all?
- How to change speed of translate and scale when zooming in and out in D3 (using zoom.on & d3.event.translate, d3.event.zoom)?
- How to mark discrete points on a time series graph using D3 / Rickshaw?
- How to show a tooltip with value when mouseover a svg line graph using d3.js?
- How to set the domain and scale on an yaxis on a discreteBarChart nvd3.js
- How to set y-axis to fixed range in rickshaw?
More Query from same tag
- Combining translate and rotate with D3
- Flask+d3.js: Passing multiple datasets to html
- Show all data for a variable in box next to d3 chart on mouseover
- D3.js - Use newline character in rendered text
- Error with .compose using dc.js
- Updating nested d3 bubble chart with streaming data
- display popup/infotip/tooltip as hover a particular text
- D3 color change on mouseover using classed("active",true)
- After a few clicks the animation freezes, why?
- Cannot get line to draw on log scale y-axis, but can on linear
- Updating graph with new data
- create fluid (scaling) concentric arcs using css, canvas, or svg
- Vertical d3.svg.area?
- d3.js - starting and ending tick
- Can I define data point color with a function when using angular-chart?
- custom ordering in custom reduce functions in dc.js crossfilter.js
- D3.JS theta in force layout
- Custom the scale function in d3.js
- d3: Multi-Foci Force key code component understanding
- Processing a multidimensional data array with d3.js
- D3 JS: Create a page index.html to run the js project
- Using setTimeout to delay d3 transition
- How can i show the labels on the x axis when there is data overlap in d3js?
- Static D3 Force-Directed Graph performance
- D3 V4 with Angular-cli
- Drawing LineStrings d3
- D3 Canvas force layout - disjointed group replelling the other group
- Migrating from D3.js v3 to D3.js v4 not working - a select issue?
- How can one scale GIS data in d3.js?
- Mimicking an audio waveform with d3