从我以前的答案略微扩大,因为我已私下联系到解释我是如何做到的。
首先,应用程序的屏幕截图,主要工作是聚合并显示从各种来源(PowerPoint文件,企业数据库等)收集的计划数据。
相关位是正确的纵轴与彩色圆点,每个圆点代表一个项目的努力和参与组织。轴上的灰色区域是d3.js画笔,可以进行平移/调整大小以实时更改图表/表格数据。
// the axis is a regular ordinal axis, with a brush
y2 = d3.scale.ordinal(),
brush = d3.svg.brush().y(y2).on('brush', brushReact),
// [...]
// brush event handler
function brushReact() {
if (tasksSlice == null)
return;
var yrb = y2.rangeBand(),
extent = brush.extent(),
s0 = Math.round(extent[0]/yrb),
s1 = Math.round(extent[1]/yrb);
if (s0 == tasksSlice[0] && s1 == tasksSlice[1])
return;
tasksSlice = [s0, s1];
inner.refresh();
}
的处理程序中,会发生什么是相当简单:
- 拿到刷程度
- 它移植到索引中我的数据阵列
- 片我的数据阵列,并设置结果作为数据显示
- 刷新图表和表
我希望这可以清除它。
你能发表一个片段吗?谢谢! – Dan
对于某些示例代码+1。 – Thomas
举一个例子会很棒,谢谢! – Kristoffer