d3.js - dc.js linechart not showing anything -



d3.js - dc.js linechart not showing anything -

i using dc.linechart generate line chart show frequenct vs time. next code

var freqchart=dc.linechart("#chart1"); var ndx=crossfilter(data); var countbytime=ndx.dimension(function (d) { homecoming d.time; }); var dateformat=d3.time.format("%m-%d-%y"); var freqbytimegroup = countbytime.group() .reducecount(function(d) { homecoming d.time; }); freqchart.width(400).height(200).transitionduration(500) .dimension(countbytime).group(freqbytimegroup) .elasticy(true).x( d3.time.scale().domain([d3.min(data,function(d){return d.time}),d3.max(data,function(d){return d.time})])).on("filtered", onfilt).yaxislabel("frequency").xaxislabel('time');

but getting next blank thing without graph. why can't view graph. sort of alter needed in graph. wan show total events in particular time period. there many detectors giving response @ same time. want show count of these detectors @ particular time.

i made number of changes fiddle , got work.

here fork: http://jsfiddle.net/gordonwoodhull/6e67uzfn/11/

some of changes made:

fixed dates, had invalid syntax. (made own because wasn't sure meant there.) make pass on info parse dates using dateformat.parse() call chart.render() removed argument group.reducecount(), not take arguments (probably clue looking for) phone call .xunits(d3.time.days) - phone call required dc.js knows ticks create on x axis.

you want match granularity of xunits granularity utilize date bins. specify bin granularity when define dimension or group, e.g. if want bin days,

var countbytime = data.dimension(function(d) { homecoming d3.time.day(d.time); });

otherwise utilize exact time values, downwards millisecond , might not bin @ all.

hope helps!

d3.js dc.js crossfilter

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -