d3.js - Setting tick intervals on a D3 time axis throwing an exception -
I have a simple piece of JavaScript that creates a time axis in D3:
var xScale = D3.time.scale () .domain ([testData.datapoints [0] .at, testData.datapoints [testData.datapoints.length - 1] .at]) .ange ([0, ( New Date (testData.datapoints) [TestData.datapoints.length - 1] .at - testData.datapoints [0] .at) .gettime () / interval) * 21], xAxis = d3.svg.axis (). Scale (xScale) .orient ("bottom"). Tick ([d3.time.minute, 15]) / * This row is an exception * /. Tick format (d3.time.format ("% d /% m /% y% H:% M: It is to say that to make a tick at a 15 minute interval: scale.ticks (d3.time.minute, 15) ; But I get an exception:
Line 9204, column 7 in Dell. 7
0x800a138a - JavaScript runtime error: Function expected < / P>
(NB does not make any difference to the chain in the xScale
series> moving the offensive line from xAxis .ticks (20)
Excludes an exception, but I'm not after that.)
D3 The line where the error has been thrown, this function is the last line in D.J.J:
scale.ticks = function (interval, left) {var extent = d3_scaleExtent (scale.domain () Tick-method (extent, interval): interval.ange & amp; amp; [[ Border: interval}, skip;; if (method) interval = method [0], leave = method [1]; Return interval.ange (extent [0], d3_time_scademet (+ extent [1] + 1), leave; 1? 1: skip); };
An exception is thrown at this point skip
is undefined.
What is wrong with the D3 Javascript line? It has been copied from the documentation, but I suspect that this is a bug in D3, more likely I have used it in some way wrongly.
You have it: But what do you want: array will only occur when you are passing a specific list of values in the function. And in that case you want to use the function
.ticks ([d3. Time.minute, 15])
.ticks (d3.time.minute, 15)
< The / pre>
Comments
Post a Comment