從我以前的答案略微擴大,因爲我已私下聯繫到解釋我是如何做到的。
首先,應用程序的屏幕截圖,主要工作是聚合並顯示從各種來源(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