javascript - Why is there no x or y axis shown on this d3 chart? -



javascript - Why is there no x or y axis shown on this d3 chart? -

i have d3 chart follows.

html:

<svg></svg>

js:

var margin = {top: 10, right: 10, bottom: 10, left: 10}, width = 960, height = 500; var startofweek = moment().startof("week").todate(); var endofweek = moment().endof("week").todate(); var dxsyncevents = []; var = moment(); var times = []; var sites = []; /* stuff pushes js date objects onto times[] , strings onto sites[] */ var xscale = d3.time.scale().domain([startofweek, endofweek]).range([0, 960]); var yscale = d3.scale.ordinal().domain(sites).rangepoints(500, 10); var xaxis = d3.svg.axis().scale(xscale).orient("bottom") .ticks(d3.time.hours, 12) .tickformat(d3.time.format('%h:%m')) .ticksize(8) .tickpadding(8); var yaxis = d3.svg.axis().scale(yscale).orient("left"); d3.select("svg") .attr("width", width) .attr("height", height) .selectall("circle") .data(times) .enter().append("circle") .attr("r", "10px") .attr("fill", "black") .attr("cx", xscale) .attr("cy", yscale) .call(xaxis) .call(yaxis);

why don't axes on chart? can't see them on screen , can't see them in dom in developer tools. see circles, however.

there console errors don't offer much help:

error: invalid value <path> attribute d="m-6,undefinedh0vundefinedh-6" error: invalid value <g> attribute transform="translate(0,nan)" (twice)

it looks you're calling xaxis , yaxis objects on result of .enter().append("circle") call, create circle element each new info element in times.

i suspect not want. want append g element each axis , perform .call(xaxis) , .call(yaxis) on those.

http://bl.ocks.org/mbostock/3883245 simple line chart might help.

javascript d3.js

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -