clustergrammer
Version:
This is a clustergram implemented in D3.js. I started from the example http://bost.ocks.org/mike/miserables/ and added the following features
57 lines (36 loc) • 1.36 kB
JavaScript
var dendro_shade_bars = require('./dendro_shade_bars');
module.exports = function dendro_group_highlight(params, inst_selection, inst_data, inst_rc){
var wait_before_make_shade = 500;
setTimeout(still_hovering, wait_before_make_shade);
function still_hovering(){
// check that user is still hovering over dendrogram group
if (d3.select(inst_selection).classed('hovering')){
// check that user is not using dendrogram slider
if (params.is_slider_drag === false){
d3.select(inst_selection)
.style('opacity', 0.7);
make_shade_bars();
}
}
}
function make_shade_bars(){
if (inst_rc === 'row'){
// row and col labling are reversed
if (params.viz.inst_order.col === 'clust'){
dendro_shade_bars(params, inst_selection, inst_rc, inst_data);
}
} else if (inst_rc === 'col') {
// row and col labeling are reversed
if (params.viz.inst_order.row === 'clust'){
dendro_shade_bars(params, inst_selection, inst_rc, inst_data);
}
} else if (inst_rc === 'both'){
if (params.viz.inst_order.col === 'clust'){
dendro_shade_bars(params, inst_selection, 'row', inst_data);
}
if (params.viz.inst_order.row === 'clust'){
dendro_shade_bars(params, inst_selection, 'col', inst_data);
}
}
}
};