js/tsne_vis.js
//Function runs on a brush move - to update the big bar chart
Function runs on a brush move - to update the big bar chart
Function runs on a brush move - to update the big bar chart
function updateBarChart() {
  var bar = d3v3.select(".mainGroup").selectAll(".bar")
      .data(correlationResultsFinal, function(d) { return +d[2]; })
  bar
    .attr("x", function (d) { return main_xScale(Math.min(0, d[1])); })
    .attr("width", function(d) { return Math.abs(main_xScale(d[1]) - main_xScale(0)); })
    .attr("y", function(d,i) { return main_yScale(d[0]); })
    .attr("height", main_yScale.rangeBand());
  bar.enter().append("rect")
    .attr("class", "bar")
    .style("fill", "url(#gradient-main)")
    .attr("x", function (d) { return main_xScale(Math.min(0, d[1])); })
    .attr("width", function(d) { return Math.abs(main_xScale(d[1]) - main_xScale(0)); })
    .attr("y", function(d,i) { return main_yScale(d[0]); })
    .attr("height", main_yScale.rangeBand())
    .on("mouseover", () => {
      svg.select('.tooltip').style('display', 'none'); 
    })
    .on("click", function(d) {
      var flag = false;
      points.forEach(function (p) {
        if (p.DimON == d[0])
        {
          flag = true;
        }
      });
      if (flag == false){
        correlationResultsFinal.forEach(function(corr){
          var str2 = corr[0];
            var elements2 = $("*:contains('"+ str2 +"')").filter(
                    function(){
                        return $(this).find("*:contains('"+ str2 +"')").length == 0
                    }
                 );
                 elements2[0].style.fontWeight = 'normal';
                 if (typeof elements2[1] != "undefined"){
                  elements2[1].style.fontWeight = 'normal';
                 }
        });
        points.forEach(function (p) {
          if (p.schemaInv == true) {
            p.DimON = d[0];
            var str = p.DimON;
            var elements = $("*:contains('"+ str +"')").filter(
                    function(){
                        return $(this).find("*:contains('"+ str +"')").length == 0
                    }
                 );
                 elements[0].style.fontWeight = 'bold';
          }
        })
      } else{
        correlationResultsFinal.forEach(function(corr){
          var str2 = corr[0];
            var elements2 = $("*:contains('"+ str2 +"')").filter(
                    function(){
                        return $(this).find("*:contains('"+ str2 +"')").length == 0
                    }
                 );
                 elements2[0].style.fontWeight = 'normal';
                 if (typeof elements2[1] != "undefined"){
                  elements2[1].style.fontWeight = 'normal';
                 }
        });
        points.forEach(function (p) {
          p.DimON = null;
        });
      }
      BetatSNE(points);
    });
  bar.exit()
    .remove();
}
function updateBarChart ( ) { var bar = d3v3 . select ( ".mainGroup" ) . selectAll ( ".bar" ) . data ( correlationResultsFinal , function ( d ) { return + d [ 2 ] ; } ) bar . attr ( "x" , function ( d ) { return main_xScale ( Math . min ( 0 , d [ 1 ] ) ) ; } ) . attr ( "width" , function ( d ) { return Math . abs ( main_xScale ( d [ 1 ] ) - main_xScale ( 0 ) ) ; } ) . attr ( "y" , function ( d , i ) { return main_yScale ( d [ 0 ] ) ; } ) . attr ( "height" , main_yScale . rangeBand ( ) ) ; bar . enter ( ) . append ( "rect" ) . attr ( "class" , "bar" ) . style ( "fill" , "url(#gradient-main)" ) . attr ( "x" , function ( d ) { return main_xScale ( Math . min ( 0 , d [ 1 ] ) ) ; } ) . attr ( "width" , function ( d ) { return Math . abs ( main_xScale ( d [ 1 ] ) - main_xScale ( 0 ) ) ; } ) . attr ( "y" , function ( d , i ) { return main_yScale ( d [ 0 ] ) ; } ) . attr ( "height" , main_yScale . rangeBand ( ) ) . on ( "mouseover" , ( ) => { svg . select ( '.tooltip' ) . style ( 'display' , 'none' ) ; } ) . on ( "click" , function ( d ) { var flag = false ; points . forEach ( function ( p ) { if ( p . DimON == d [ 0 ] ) { flag = true ; } } ) ; if ( flag == false ) { correlationResultsFinal . forEach ( function ( corr ) { var str2 = corr [ 0 ] ; var elements2 = $ ( "*:contains('" + str2 + "')" ) . filter ( function ( ) { return $ ( this ) . find ( "*:contains('" + str2 + "')" ) . length == 0 } ) ; elements2 [ 0 ] . style . fontWeight = 'normal' ; if ( typeof elements2 [ 1 ] != "undefined" ) { elements2 [ 1 ] . style . fontWeight = 'normal' ; } } ) ; points . forEach ( function ( p ) { if ( p . schemaInv == true ) { p . DimON = d [ 0 ] ; var str = p . DimON ; var elements = $ ( "*:contains('" + str + "')" ) . filter ( function ( ) { return $ ( this ) . find ( "*:contains('" + str + "')" ) . length == 0 } ) ; elements [ 0 ] . style . fontWeight = 'bold' ; } } ) } else { correlationResultsFinal . forEach ( function ( corr ) { var str2 = corr [ 0 ] ; var elements2 = $ ( "*:contains('" + str2 + "')" ) . filter ( function ( ) { return $ ( this ) . find ( "*:contains('" + str2 + "')" ) . length == 0 } ) ; elements2 [ 0 ] . style . fontWeight = 'normal' ; if ( typeof elements2 [ 1 ] != "undefined" ) { elements2 [ 1 ] . style . fontWeight = 'normal' ; } } ) ; points . forEach ( function ( p ) { p . DimON = null ; } ) ; } BetatSNE ( points ) ; } ) ; bar . exit ( ) . remove ( ) ; }
Function runs on a brush move - to update the big bar chart
Function runs on a brush move - to update the big bar chart
///////////////////////////////////////////////////////////// ////////// Update the bars of the main bar chart //////////// ///////////////////////////////////////////////////////////// //, function(d) { return d.key; }); //ENTER //EXIT //update