dc.js - Bubbles are not showing in Bubble chart using dc.jc -
i making bubble chart using dc.js , crossfilter.js bubbles not showing in chart !!!! showing x axis , y axis bubbles disappeared.
i trying make bubble chart in click see
here code :
var datedim = ndx.dimension(function(d) {return d.date;}); var mindate = datedim.bottom(1)[0].date; var maxdate = datedim.top(1)[0].date; console.log(mindate); console.log(maxdate); //var agedim = ndx.dimension(function(d){return +d.age;}); var daysum = datedim.group().reducesum(function(d){return 1;}); //print_filter("agesum"); // var hits = datedim.group().reducesum(function(d) {return d.age;}); var brush = d3.svg.brush(); suicidebubblechart .width(990).height(200) .transitionduration(1500) .dimension(datedim) .group(daysum) .colors(d3.scale.category10()) .x(d3.time.scale().domain([mindate,maxdate])) .y(d3.time.scale().domain([mindate,maxdate])) .r(d3.scale.linear().domain([0, 4000])) .minradiuswithlabel(15) .yaxislabel("suicides") .elasticy(true) .yaxispadding(100) .elasticx(true) .xaxispadding(200) .maxbubblerelativesize(0.07) .renderhorizontalgridlines(true) .renderverticalgridlines(true) .renderlabel(true) .rendertitle(true);
thank you.
i fixed enough start getting stuff showing on chart.
there space before date caused field name come out wrong, , date format wrong, , added radiusvalueaccessor.
var dateformat = d3.time.format('%m/%d/%y');
...
.r(d3.scale.linear().domain([0, 10])) .radiusvalueaccessor(function(d) { return d.value; })
http://jsfiddle.net/gordonwoodhull/wjeonreq/15/
obviously still not chart want, have stuff showing on screen, can start shape , debug it.
in particular, need valueaccessor in order place bubbles in y, , y scale.
it 1 of frustrating things dc & d3 if doesn't work, empty chart. way tracked down, after dealing errors above, showed in console,
- look @ daysum.all() make sure data okay (it was, after date correction)
- inspect svg element in elements tab of developer tools.
g.chart-body
inside there has actual content. saw bubbles there had radius zero. looked @ stock example see radius setup must missing.
Comments
Post a Comment