DC 박스 플롯을 정리하기 위해 일부 D3 코드를 사용하고 있습니다. circle.outlier 반지름을 더 작게 만들고 각 boxplot 뒤에 사각형을 삽입하고 호버의 제목을 붙입니다.DC.js | D3 업데이트를 어떻게 트리거 할 수 있습니까?
페이지로드시 잘 작동합니다. 필터링 작업도하고 싶습니다. 한 종류의 필터링과 다른 필터링에는 작동하지 않습니다.
나는 같은 대시 보드에 히스토그램을 가지고 있고, .brushOn (참)로, 나는 제대로 필터에 상자 그림을 업데이트하는 이벤트가 있습니다
.on("filtered", function(obj){ update(); });
이 코드는 호출하는 아래의 함수를 호출을 두 가지 기능 : (1) updateFactorFields2 : 가짜 그룹을 통해 boxplots 뒤에있는 데이터를 업데이트하고 작동하는 것처럼 보입니다. 및 (2) tidyBoxPlots가 문제입니다.
function update() {
var grps = window.grps;//an array holding my crossfilter groups
var dims = window.dims; //an array holding CF dimensions
updateFactorFields2(grps[0]);
factorBox.render();//factorBox is my DC boxplot chart
tidyBoxPlots('postRender');
}
tidyBoxPlots도 .title을 업데이트하지만 아래 코드는 충분합니다. tidyBoxPlots는 궁극적으로 histChart.on ("filtered", ...)에 의해 트리거 될 때 작동합니다.
function tidyBoxPlots(evType) {
d3.selectAll("circle.outlier").attr("r","2");//works in one case and not another
d3.selectAll("g.box").insert("rect","line.center").attr("x","0").attr("y","0").attr("width","8").attr("height","102.5").attr("class","boxHover");//ditto
}
그러나 업데이트가()가 호출에도 불구하고, 아래에 의해 트리거와 updateFactorFields 작동 할 때 tidyBoxPlots이 작동하지 않습니다
$("[id='filterDropdown']").on('change',function(e,p){
if (p.selected) {
var tempIndex = filters[0].indexOf(e.target.id);
filters[6][tempIndex].push(p.selected);//store this filter
filters[5][tempIndex].filterFunction(function(d){ return filters[6][tempIndex].indexOf(d)!=-1; });//filter the dimension stored in filters[5] by the array values stored in filters[6]
update();//calls update() fine
}
내가 문제가 이벤트 유형 I입니다 확신 전에이 문제가 생겨서 사용하고있어. 그래서 나는하지 않을 경우 이러한하지만 기쁨을 모두 대부분을 시도했다 : 나는 그러므로 내 드롭 다운에 대한 jQuery를 chosen.js을 사용하고
http://dc-js.github.io/dc.js/docs/html/dc.baseMixin.html#on
.
아무도 도와 줄 수 있습니까?
감사
같은 문제를 가진 다른 사람에게
다음 주셔서 감사합니다. 올바른 이벤트 유형은 무엇입니까? – Gordon
그것은 postRender 였지만, .render()를 호출 한 후에 그것을 얻기 위해 몇 줄의 코드를 교환해야했습니다. – emma