这里第一个跨度是从其他一些javascript源接收数据,我想要的是,当这些数据到来时,它应该转移到另一个跨度,但我不知道如何做到这一点。
这是我的小提琴链接http://
// project | subproject | budget
data = [
["PrA", "SubPr1", 100],
["PrA", "SubPr2", 150],
["PrA", "SubPr3", 200],
["PrB", "SubPr4", 300],
["PrB", "SubPr5", 500],
["PrC", "SubPr6", 450]];
data = data.map(function (d) {
return {
project: d[0],
subproject: d[1],
budget: d[2]
};
});
var ndx = crossfilter(data)
var projDim = ndx.dimension(function(d){return d.project;});
var projGroup = projDim.group().reduceSum(function(d){return d.budget;});
dc.rowChart("#projectChart")
.renderLabel(true)
.dimension(projDim)
.group(projGroup)
.xAxis().ticks(2);
dc.renderAll();
var c = 10;
var a = document.getElementById("abc").value;
if(a === NULL)
{
document.getElementById("xyz").innerHTML = a;
}
<div id="projectChart">
<div class="reset" >selected: <span class="filter" id = "abc"></span></div>
<div class="reset">
into:<span id = "xyz"></span>
</div>
</div>
jsfiddle.net/amru/mjput2fw /