@ -3,14 +3,19 @@
< div id = "FeatureGraph" style = "border-style: solid; border-width: 2px; border-color: yellow; min-height: 819px; max-height: 819px; min-width: 819px" > < / div >
< div id = "toolbar" style = "min-height: 67px; max-height: 67px; margin-top: 25px" >
< div class = "panel panel-default" data -placement = " center " >
< div class = "panel-body" id = "resetAllFilters" data -placement = " center " style = "margin-top: 3 px" >
< div class = "panel-body" id = "resetAllFilters" data -placement = " center " style = "margin-top: -20 px" >
< table class = "table table-borderless centerTable" >
< tbody >
< tr >
< td scope = "row" > < button class = "btn btn-primary active" id = "initButton" v -on :click ="setLayerExplore" style = "margin-left: -1px !important" > < font -awesome -icon icon = "search" style = "margin-right: 5px" / > Feature exploration < / button > < / td >
< td > < button class = "btn btn-primary" v -on :click ="setLayerCompare" style = "margin-left: -1.4px" > < font -awesome -icon icon = "balance-scale-left" style = "margin-right: 5px" / > Feature generation < / button > < / td >
< td scope = "row" > < button class = "btn btn-primary" v -on :click ="setLayerEngineer" style = "margin-left: -2px !important" > < font -awesome -icon icon = "wrench" style = "margin-right: 5px" / > Feature transformation < / button > < / td >
<!-- < td scope = "row" > < p style = "margin-left: -2px !important; color: #007bff;" > Warning : pick between 2 to 3 features for detailed comparison of features . < / p > < / td > -- >
< td scope = "row" > < button class = "btn btn-primary active" id = "initButton" v -on :click ="setLayerExplore" style = "margin-left: -1px !important" > < font -awesome -icon icon = "search" style = "margin-right: 5px" / > Exploration < / button > < / td >
< td > < button class = "btn btn-primary" v -on :click ="setLayerCompare" style = "margin-left: -1.4px" > < font -awesome -icon icon = "balance-scale-left" style = "margin-right: 5px" / > Generation < / button > < / td >
< td scope = "row" > < button class = "btn btn-primary" v -on :click ="setLayerEngineer" style = "margin-left: -2px !important" > < font -awesome -icon icon = "wrench" style = "margin-right: 5px" / > Transformation < / button > < / td >
< td >
< div class = "row align-items-center" >
< div class = "col-lg-4" > < p > Correl . ( > ) < / p > < / div >
< div class = "col-lg-8" > < div id = "thres" > < / div > < / div >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
@ -35,6 +40,7 @@ export default {
dataFS : [ ] ,
dataFSTrans : [ ] ,
quadrantNumber : 4 ,
threshold : 0.4 ,
jsonData : [ ] ,
corrMatrixComb : [ ] ,
corrMatrixCombTotal : [ ] ,
@ -45,6 +51,33 @@ export default {
}
} ,
methods : {
InitSlider ( ) {
var dataCorrect = [ 0 , 0.2 , 0.4 , 0.6 , 0.8 , 1 ] ;
var sliderStepPos = d3
. sliderBottom ( )
. min ( d3 . min ( dataCorrect ) )
. max ( d3 . max ( dataCorrect ) )
. width ( 180 )
. tickFormat ( d3 . format ( ".1f" ) )
. ticks ( 6 )
. step ( 0.2 )
. default ( 0.4 )
. on ( 'onchange' , val => {
EventBus . $emit ( 'CorrThres' , d3 . format ( ".1f" ) ( val ) )
} ) ;
var gStepPos = d3
. select ( 'div#thres' )
. append ( 'svg' )
. attr ( 'width' , 230 )
. attr ( 'height' , 80 )
. append ( 'g' )
. attr ( 'transform' , 'translate(30,30)' ) ;
gStepPos . call ( sliderStepPos ) ;
} ,
setLayerExplore ( ) {
this . mode = 0
this . graphVizualization ( )
@ -167,6 +200,8 @@ export default {
} ,
initializeNetwork ( ) {
this . jsonData = [ ]
var threshLoc = this . threshold
this . corrMatrixComb = [ ]
this . corrMatrixCombTotal = [ ]
@ -302,8 +337,10 @@ export default {
function ( [ feature , value ] ) {
Object . entries ( value ) . forEach ( function ( [ featureInside , value ] ) {
if ( feature != featureInside ) {
if ( value >= 0 ) {
if ( value >= threshLoc ) {
links . push ( { "source" : listofNodes . indexOf ( feature ) , "target" : listofNodes . indexOf ( featureInside ) , "value" : Math . abs ( value ) * 30 , "lin_color" : "#D3D3D3" } )
} else {
links . push ( { "source" : listofNodes . indexOf ( feature ) , "target" : listofNodes . indexOf ( featureInside ) , "value" : 0 , "lin_color" : "#D3D3D3" } )
}
}
} )
@ -327,8 +364,7 @@ export default {
feature . value . forEach ( function ( element , indexIns ) {
if ( element . valueIns > 0 ) {
links . push ( { "source" : index , "target" : ( index * feature . value . length + feature . value . length + indexIns ) - lengthFeatureAddRem , "value" : Math . abs ( element . valueIns ) * 30 , "lin_color" : "#33a02c" } )
}
else {
} else {
links . push ( { "source" : index , "target" : ( index * feature . value . length + feature . value . length + indexIns ) - lengthFeatureAddRem , "value" : Math . abs ( element . valueIns ) * 30 , "lin_color" : "#e31a1c" } )
}
} )
@ -386,22 +422,26 @@ export default {
for ( let i = 0 ; i < Object . keys ( VIFVar ) . length ; i ++ ) {
if ( i != 0 ) {
if ( Object . values ( VIFVar ) [ i ] > 10 ) {
VIFVarFormatted . push ( 4 )
VIFVarFormatted . push ( 100 )
} else if ( Object . values ( VIFVar ) [ i ] > 5 ) {
VIFVarFormatted . push ( 2 )
VIFVarFormatted . push ( 75 )
} else if ( Object . values ( VIFVar ) [ i ] > 2.5 ) {
VIFVarFormatted . push ( 50 )
} else {
VIFVarFormatted . push ( 0 )
VIFVarFormatted . push ( 25 )
}
}
}
for ( let i = 0 ; i < this . VIFRemaining . length ; i ++ ) {
if ( this . VIFRemaining [ i ] > 10 ) {
VIFVarFormatted . push ( 4 )
} else if ( this . VIFRemaining [ i ] > 5 ) {
VIFVarFormatted . push ( 2 )
if ( Object . values ( VIFVar ) [ i ] > 10 ) {
VIFVarFormatted . push ( 100 )
} else if ( Object . values ( VIFVar ) [ i ] > 5 ) {
VIFVarFormatted . push ( 75 )
} else if ( Object . values ( VIFVar ) [ i ] > 2.5 ) {
VIFVarFormatted . push ( 50 )
} else {
VIFVarFormatted . push ( 0 )
VIFVarFormatted . push ( 25 )
}
}
@ -474,22 +514,32 @@ export default {
var numb = graph . nodes [ i ] [ 'group' ] . match ( /\d/g )
numb = parseInt ( numb . join ( "" ) )
var items = document . getElementsByClassName ( numb )
console . log ( items )
items . forEach ( function ( it ) {
it . style . visibility = "hidden" ;
it . childNodes [ 0 ] . style . visibility = "hidden" ;
it . childNodes [ 1 ] . setAttribute ( "transform" , "translate(50,50) scale(0.3) rotate(180)" ) ;
it . childNodes [ 1 ] . childNodes [ 0 ] . style . fill = "#D3D3D3" ;
it . childNodes [ 2 ] . style . visibility = "hidden" ;
} )
}
var groupLoc = index + 1
var items = document . getElementsByClassName ( groupLoc )
items . forEach ( function ( it ) {
if ( it . style . visibility == "hidden" ) {
it . style . visibility = "visible" ;
if ( it . childNodes [ 0 ] . style . visibility == "hidden" ) {
it . childNodes [ 0 ] . style . visibility = "visible" ;
it . childNodes [ 1 ] . setAttribute ( "transform" , "translate(50,50) scale(1) rotate(180)" ) ;
it . childNodes [ 1 ] . childNodes [ 0 ] . style . fill = "none" ;
it . childNodes [ 2 ] . style . visibility = "visible" ;
} else {
it . style . visibility = "hidden" ;
it . childNodes [ 0 ] . style . visibility = "hidden" ;
it . childNodes [ 1 ] . setAttribute ( "transform" , "translate(50,50) scale(0.3) rotate(180)" ) ;
it . childNodes [ 1 ] . childNodes [ 0 ] . style . fill = "#D3D3D3" ;
it . childNodes [ 2 ] . style . visibility = "hidden" ;
}
} )
EventBus . $emit ( 'brushLink' , groupLoc - 1 )
} else {
var groupsColor = d3 . select ( '#svg' + index ) . _groups [ '0' ] [ 0 ] . childNodes [ 3 ] . childNodes [ 0 ]
var groupsColor = d3 . select ( '#svg' + index ) . _groups [ '0' ] [ 0 ] . childNodes [ 0 ] . childNodes [ 1 ]
if ( groupsColor . getAttribute ( 'fill' ) == "black" ) {
if ( selectionCounter < 3 ) {
/ / a d d h e r e t h e d i f f e r e n t s t a t e s o f c o m p a r i s o n ! ( = 2 a n d = 3 )
@ -508,7 +558,10 @@ export default {
numb = parseInt ( numb . join ( "" ) )
var items = document . getElementsByClassName ( numb )
items . forEach ( function ( it ) {
it . style . visibility = "hidden" ;
it . childNodes [ 0 ] . style . visibility = "hidden" ;
it . childNodes [ 1 ] . setAttribute ( "transform" , "translate(50,50) scale(0.3) rotate(180)" ) ;
it . childNodes [ 1 ] . childNodes [ 0 ] . style . fill = "white" ;
it . childNodes [ 2 ] . style . visibility = "hidden" ;
} )
}
EventBus . $emit ( 'brushLink' , - 1 )
@ -576,7 +629,9 @@ export default {
var widthLoc = 100 ;
var arcSize = ( 6 * widthLoc / 100 ) ;
var innerRadius = arcSize * 2 ;
var arcSizeBlack = ( 10.2 * widthLoc / 100 ) ;
var innerRadius = arcSize * 4.95 ;
var innerRadiusBlack = arcSize * 3.7
var svgLoc = node . append ( 'svg' ) . attr ( 'width' , widthLoc ) . attr ( 'height' , widthLoc ) . attr ( "class" , function ( d , i ) { return d . group ; } )
. attr ( "id" , function ( d , i ) { return "svg" + ( i ) ; } )
@ -584,19 +639,25 @@ export default {
graph . nodes . forEach ( function ( itemVal , indexNode ) {
var data = [ ]
var barchartData = [ ]
data . push ( { value : VIFVarFormatted [ indexNode ] , color : 'black' } )
data . push ( { value : corrGlobFormatted [ indexNode ] , color : colorsScaleNodes ( MIVar [ indexNode ] ) } )
for ( let k = 0 ; k < uniqueTarget . length ; k ++ ) {
data . push ( { value : corrTargetFormatted [ k ] [ indexNode ] , label : '' , color : colorCateg ( uniqueTarget [ k ] ) , lcolor : '' } )
barchartD ata. push ( { value : corrTargetFormatted [ k ] [ indexNode ] , class : k , color : colorCateg ( uniqueTarget [ k ] ) } )
}
var length = data . length
data . push ( { value : 100 , label : corrGlobFormatted [ indexNode ] , color : 'black' , lcolor : colorsScaleNodes ( MIVar [ indexNode ] ) } )
/ / d a t a . p u s h ( { v a l u e : 1 0 0 , l a b e l : c o r r G l o b F o r m a t t e d [ i n d e x N o d e ] , c o l o r : ' b l a c k ' , l c o l o r : c o l o r s S c a l e N o d e s ( M I V a r [ i n d e x N o d e ] ) } )
var border = VIFVarFormatted [ indexNode ]
/ / v a r b o r d e r = V I F V a r F o r m a t t e d [ i n d e x N o d e ]
var arcs = data . map ( function ( obj , i ) {
if ( i == length ) {
return d3 . arc ( ) . innerRadius ( i * arcSize + innerRadius ) . outerRadius ( ( i + 1 ) * arcSize - ( widthLoc / 100 ) + innerRadius + border ) ;
return d3 . arc ( ) . innerRadius ( i * arcSize + innerRadius ) . outerRadius ( ( i + 1 ) * arcSize - ( widthLoc / 100 ) + innerRadius ) ;
} else if ( i == 0 ) {
return d3 . arc ( ) . innerRadius ( i * arcSizeBlack + innerRadiusBlack ) . outerRadius ( ( i + 1 ) * arcSizeBlack - ( widthLoc / 100 ) + innerRadiusBlack ) ;
} else {
return d3 . arc ( ) . innerRadius ( i * arcSize + innerRadius ) . outerRadius ( ( i + 1 ) * arcSize - ( widthLoc / 100 ) + innerRadius ) ;
}
@ -620,12 +681,27 @@ export default {
var id = indexNode
var g = d3 . select ( '#svg' + id ) . selectAll ( 'g' ) . data ( pieData ) . enter ( )
. append ( 'g' )
. attr ( 'transform' , 'translate(' + widthLoc / 2 + ',' + widthLoc / 2 + ') rotate(180)' ) ;
. attr ( 'transform' , function ( d , i ) {
if ( i == 0 ) {
return 'translate(' + widthLoc / 2 + ',' + widthLoc / 2 + ') rotate(225)'
} else {
return 'translate(' + widthLoc / 2 + ',' + widthLoc / 2 + ') rotate(180)'
}
} ) ;
g . append ( "circle" ) . attr ( "cx" , 0 ) . attr ( "cy" , 0 ) . attr ( "r" , 38 ) . attr ( "fill" , function ( d , i ) {
if ( i == 0 ) {
return "white"
} else {
return "none"
}
} ) ;
var gText = d3 . select ( '#svg' + id ) . selectAll ( 'g.textClass' ) . data ( [ { } ] ) . enter ( )
. append ( 'g' )
. classed ( 'textClass' , true )
. attr ( 'transform' , 'translate(' + widthLoc / 2 + ',' + widthLoc / 2 + ') rotate(180)' ) ;
. attr ( 'transform' , 'translate(' + 27.5 + ',' + 27.5 + ') rotate(0)' ) ;
var insideRadius = 0
g . selectAll ( 'path' ) . data ( function ( d ) {
return pie ( d ) ;
} ) . enter ( ) . append ( 'path' )
@ -636,44 +712,96 @@ export default {
} )
. attr ( 'd' , function ( d ) {
return d . data . arc ( d ) ;
} ) . attr ( 'fill' , function ( d , i ) {
return i == 0 ? d . data . object . color : i == 1 ? '#D3D3D3' : 'none' ;
} ) . attr ( 'fill' , function ( d , i , j ) {
if ( i == 0 ) {
return d . data . object . color
} else if ( i == 1 && insideRadius != 0 ) {
return '#D3D3D3'
} else {
insideRadius = 1
return 'none'
}
} ) ;
var margin = { top : 0 , right : 0 , bottom : 0 , left : 0 } ,
width = 45 - margin . left - margin . right ,
height = 45 - margin . top - margin . bottom ;
g . each ( function ( d , index ) {
var el = d3 . select ( this ) ;
var path = el . selectAll ( 'path' ) . each ( function ( r , i ) {
if ( i === 1 ) {
var centroid = r . data . arc . centroid ( {
startAngle : r . startAngle + 0.05 ,
endAngle : r . startAngle + 0.001 + 0.05
} ) ;
var lableObj = r . data . object ;
g . append ( 'text' )
. attr ( 'font-size' , ( ( 2 * width ) / 100 ) )
. attr ( 'dominant-baseline' , 'central' )
. append ( "textPath" )
. attr ( "textLength" , function ( d , i ) {
return 0 ;
} )
. attr ( "startOffset" , '5' )
. attr ( "dy" , '-3em' )
. text ( lableObj . value + '%' ) ;
}
if ( i === 0 ) {
var centroidText = r . data . arc . centroid ( {
startAngle : r . startAngle ,
endAngle : r . startAngle
} ) ;
var lableObj = r . data . object ;
gText . append ( 'text' )
. attr ( 'font-size' , ( ( 2 * width ) / 100 ) )
. text ( lableObj . label )
. style ( 'fill' , lableObj . lcolor )
. attr ( 'transform' , "translate(" + ( 10 ) + "," + ( 0 + ") rotate(" + ( 180 ) + ")" ) )
. attr ( 'dominant-baseline' , 'central' ) ;
gText . append ( 'svg' )
. attr ( "width" , width + margin . left + margin . right )
. attr ( "height" , height + margin . top + margin . bottom )
gText . append ( "rect" )
. attr ( "width" , width )
. attr ( "height" , height )
. attr ( "fill" , "white" ) ;
/ / A d d X a x i s
var x = d3 . scaleLinear ( )
. domain ( [ 0 , 100 ] )
. range ( [ 0 , width ] ) ;
/ / Y a x i s
var y = d3 . scaleBand ( )
. range ( [ 0 , height ] )
. domain ( barchartData . map ( function ( d ) { return d . class ; } ) )
. padding ( .0 ) ;
/ / B a r s
gText . selectAll ( "myRect" )
. data ( barchartData )
. enter ( )
. append ( "rect" )
. attr ( "x" , x ( 0 ) )
. attr ( "y" , function ( d ) { return y ( d . class ) ; } )
. attr ( "width" , function ( d ) { return x ( d . value ) ; } )
. attr ( "height" , y . bandwidth ( ) )
. attr ( "fill" , function ( d ) { return d . color } )
}
/ / i f ( i = = 0 ) {
/ / / / s e t t h e d i m e n s i o n s a n d m a r g i n s o f t h e g r a p h
/ / v a r m a r g i n = { t o p : 3 0 , r i g h t : 3 0 , b o t t o m : 7 0 , l e f t : 6 0 } ,
/ / w i d t h = 4 6 0 - m a r g i n . l e f t - m a r g i n . r i g h t ,
/ / h e i g h t = 4 0 0 - m a r g i n . t o p - m a r g i n . b o t t o m ;
/ / / / a p p e n d t h e s v g o b j e c t t o t h e b o d y o f t h e p a g e
/ / v a r s v g = d 3 . s e l e c t ( " # m y _ d a t a v i z " )
/ / i f ( i = = = 1 ) {
/ / v a r c e n t r o i d = r . d a t a . a r c . c e n t r o i d ( {
/ / s t a r t A n g l e : r . s t a r t A n g l e + 0 . 0 5 ,
/ / e n d A n g l e : r . s t a r t A n g l e + 0 . 0 0 1 + 0 . 0 5
/ / } ) ;
/ / v a r l a b l e O b j = r . d a t a . o b j e c t ;
/ / g . a p p e n d ( ' t e x t ' )
/ / . a t t r ( ' f o n t - s i z e ' , ( ( 2 * w i d t h ) / 1 0 0 ) )
/ / . a t t r ( ' d o m i n a n t - b a s e l i n e ' , ' c e n t r a l ' )
/ / . a p p e n d ( " t e x t P a t h " )
/ / . a t t r ( " t e x t L e n g t h " , f u n c t i o n ( d , i ) {
/ / r e t u r n 0 ;
/ / } )
/ / . a t t r ( " s t a r t O f f s e t " , ' 5 ' )
/ / . a t t r ( " d y " , ' - 3 e m ' )
/ / . t e x t ( l a b l e O b j . v a l u e + ' % ' ) ;
/ / }
/ / i f ( i = = = 0 ) {
/ / v a r c e n t r o i d T e x t = r . d a t a . a r c . c e n t r o i d ( {
/ / s t a r t A n g l e : r . s t a r t A n g l e ,
/ / e n d A n g l e : r . s t a r t A n g l e
/ / } ) ;
/ / v a r l a b l e O b j = r . d a t a . o b j e c t ;
/ / g T e x t . a p p e n d ( ' t e x t ' )
/ / . a t t r ( ' f o n t - s i z e ' , ( ( 2 * w i d t h ) / 1 0 0 ) )
/ / . t e x t ( l a b l e O b j . l a b e l )
/ / . s t y l e ( ' f i l l ' , l a b l e O b j . l c o l o r )
/ / . a t t r ( ' t r a n s f o r m ' , " t r a n s l a t e ( " + ( 1 0 ) + " , " + ( 0 + " ) r o t a t e ( " + ( 1 8 0 ) + " ) " ) )
/ / . a t t r ( ' d o m i n a n t - b a s e l i n e ' , ' c e n t r a l ' ) ;
/ / }
} ) ;
} ) ;
@ -709,7 +837,10 @@ export default {
numb = parseInt ( numb . join ( "" ) )
var items = document . getElementsByClassName ( numb )
items . forEach ( function ( it ) {
it . style . visibility = "hidden" ;
it . childNodes [ 0 ] . style . visibility = "hidden" ;
it . childNodes [ 1 ] . setAttribute ( "transform" , "translate(50,50) scale(0.3) rotate(180)" ) ;
it . childNodes [ 1 ] . childNodes [ 0 ] . style . fill = "#D3D3D3" ;
it . childNodes [ 2 ] . style . visibility = "hidden" ;
} )
}
@ -834,6 +965,11 @@ export default {
} ,
} ,
mounted ( ) {
this . InitSlider ( )
EventBus . $on ( 'CorrThres' , data => { this . threshold = data } )
EventBus . $on ( 'CorrThres' , this . initializeNetwork )
EventBus . $on ( 'updateSlice' , data => { this . quadrantNumber = data } )
EventBus . $on ( 'updateSlice' , data => {
document . getElementById ( "initButton" ) . click ( )