Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript d3筛选后无法追加完整数据_Javascript_D3.js - Fatal编程技术网

Javascript d3筛选后无法追加完整数据

Javascript d3筛选后无法追加完整数据,javascript,d3.js,Javascript,D3.js,我有一个简化版的项目,我将其浓缩到以下片段中: var-margins={top:20,bottom:300,left:100,right:100}; var高度=600; var宽度=1200; var totalWidth=宽度+边距。左+边距。右; var totalHeight=高度+边距。顶部+边距。底部; var svg=d3.select('body') .append('svg') .attr('width',totalWidth) .attr(“高度”,总高度); var g

我有一个简化版的项目,我将其浓缩到以下片段中:

var-margins={top:20,bottom:300,left:100,right:100};
var高度=600;
var宽度=1200;
var totalWidth=宽度+边距。左+边距。右;
var totalHeight=高度+边距。顶部+边距。底部;
var svg=d3.select('body')
.append('svg')
.attr('width',totalWidth)
.attr(“高度”,总高度);
var graphGroup=svg.append('g')
.attr('transform','translate(“+margins.left+”,“+margins.top+”);
风险值数据=[
{'manager':'ABC-CA','aum':230561804112.86996,'type':'JV'},
{'manager':'AEGON-Industrial','aum':1876730861.82004,'type':'JV'},
{'manager':'AVIC','aum':677643221.859999',type':'DM'},
{'manager':'AXA-SPDB','aum':111220010833.66998',type':'JV'},
{'manager':'Baoying','aum':26328526612.41,'type':'DM'},
{'manager':'Beixin Ruifeng','aum':10500065729.3',type':'JV'},
{'manager':'BOB-Scotiabank','aum':69159188249.67,'type':'JV'},
{'manager':'BOC IM','aum':396466612963.73,'type':'DM'},
{'manager':'BOCI Securities','aum':57940275708.97,'type':'JV'}
];
var yExtents=d3.extent(数据,函数(d){return d.aum;})
var xScale=d3.scaleBand()
.rangeRound([0,宽度])
.domain(data.map(函数(d){return d.manager;}));
var yScale=d3.scaleLinear()
.范围([高度,0])
.域名(yExtents);
graphGroup.append(“g”)
.attr(“类”、“轴--y”)
.attr(“转换”、“转换(0、+0+)”)
.call(d3.axisRight(yScale))
.selectAll(“文本”)
.attr('text-align','right')
.attr(“转换”、“翻译(-90,0)”);
graphGroup.append(“g”)
.attr(“类”、“轴--x”)
.attr(“变换”、“平移(0)”、“高度+”)
.call(d3.axisBottom(xScale))
.selectAll(“文本”)
.attr(“转换”、“翻译(0,0)”);
var bar=graphGroup.selectAll('rect')
.数据(数据)
.输入()
.append('rect')
.attr('x',函数(d){return xScale(d.manager);})
.attr('y',函数(d){返回yScale(d.aum);})
.attr('width',xScale.bandwidth())
.attr('height',function(d){返回高度yScale(d.aum);})
.style('fill','003366');
d3.选择('rd1')。在('click',function()上{
var newData=数据;
bars.data(newData).enter()
.append('rect');
bar.transition()
.持续时间(750)
.attr('x',函数(d){return xScale(d.manager);})
.attr('y',函数(d){返回yScale(d.aum);})
.attr('height',function(d){返回高度yScale(d.aum);})
.style('fill','003366');
});
d3.选择('rd2')。在('click',function()上{
var newData=data.filter(函数(d){returnd.type==“JV”});
bar.data(newData.exit().remove();
输入()
.attr('x',函数(d){return xScale(d.manager);})
.attr('y',高度);
bar.transition()
.持续时间(750)
.attr('x',函数(d){return xScale(d.manager);})
.attr('y',函数(d){返回yScale(d.aum);})
.attr('height',function(d){返回高度yScale(d.aum);});
});

全部的
合资企业
var页边距={
前20名,
底数:300,
左:100,,
右:100
};
var高度=600;
var宽度=1200;
var totalWidth=宽度+边距.left+边距.right;
var totalHeight=高度+页边距.top+页边距.bottom;
var svg=d3.select('body')
.append('svg')
.attr('width',totalWidth)
.attr(“高度”,总高度);
var graphGroup=svg.append('g')
.attr('transform','translate(“+margins.left+”,“+margins.top+”);
风险值数据=[{
“经理”:“ABC-CA”,
“奥姆”:230561804112.86996,
“类型”:“JV”
},
{
“经理”:“AEGON Industrial”,
“奥姆”:1876730861.82004,
“类型”:“JV”
},
{
“经理”:“中航工业”,
“奥姆”:677643221.859999,
“类型”:“DM”
},
{
“经理”:“AXA-SPDB”,
“奥姆”:111220010833.66998,
“类型”:“JV”
},
{
‘经理’:‘宝英’,
“奥姆”:26328526612.41,
“类型”:“DM”
},
{
“经理”:“北新瑞丰”,
“奥姆”:10500065729.3,
“类型”:“JV”
},
{
“经理”:“鲍勃丰业银行”,
“奥姆”:69159188249.67,
“类型”:“JV”
},
{
“经理”:“中行IM”,
“奥姆”:396466612963.73,
“类型”:“DM”
},
{
“经理”:“中银国际证券”,
“奥姆”:57940275708.97,
“类型”:“JV”
}
];
var yExtents=d3.extent(数据,函数(d){
返回d.aum;
})
var xScale=d3.scaleBand()
.rangeRound([0,宽度])
.domain(data.map)(函数(d){
返回d.manager;
}));
var yScale=d3.scaleLinear()
.范围([高度,0])
.域名(yExtents);
graphGroup.append(“g”)
.attr(“类”、“轴--y”)
.attr(“转换”、“转换(0、+0+)”)
.call(d3.axisRight(yScale))
.selectAll(“文本”)
.attr('text-align','right')
.attr(“转换”、“翻译(-90,0)”);
graphGroup.append(“g”)
.attr(“类”、“轴--x”)
.attr(“变换”、“平移(0)”、“高度+”)
.call(d3.axisBottom(xScale))
.selectAll(“文本”)
.attr(“转换”、“翻译(0,0)”);
函数applyData(新数据){
变量条=图形组
.selectAll('rect')
.数据(新数据);
bar.exit().remove();
输入()
.append('rect')
.attr('x',函数(d){
返回xScale(d.manager);
})
.attr('y',高度)
.attr('width',xScale.bandwidth())
.style('fill','003366')
.合并(条)
.transition()
.持续时间(750)
.attr('x',函数(d){
返回xScale(d.manager);
})
.attr('y',函数(d){
返回yScale(d.aum);
})
.attr(高度),功能(d){
返回高度-yScale(d.aum);
});
}
d3.选择('rd1')。在('click',function()上{
applyData(数据);
});
d3.选择('rd2')。在('click',function()上{
var newData=data.filter(函数(d){
返回d.type==“JV”
});
applyData(新数据);
});
applyData(数据)

全部的
合资企业