Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
metexplore
MetExploreViz
Commits
057ca51b
Commit
057ca51b
authored
Jul 12, 2021
by
Jean-Clement Gallardo
Browse files
Add reset scale editor function + bug fix
parent
750b35b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/view/form/fluxMappingForm/FluxMappingFormController.js
View file @
057ca51b
...
...
@@ -31,6 +31,9 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
},
updateScaleEditor
:
function
(){
me
.
updateScaleEditor
();
},
resetScale
:
function
(
cond
,
svgView
){
me
.
resetScale
(
cond
,
svgView
)
}
});
...
...
@@ -38,10 +41,24 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
change
:
function
(){
var
selectFile
=
this
.
getValue
();
var
nbCol
=
view
.
lookupReference
(
'
selectColNumber
'
).
getValue
();
var
scaleSelector
=
view
.
lookupReference
(
'
scaleSelector
'
).
getValue
();
if
(
scaleSelector
===
"
Manual
"
){
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor
'
).
el
.
dom
).
select
(
"
#scaleEditor
"
)
.
selectAll
(
"
*
"
).
remove
();
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor2
'
).
el
.
dom
).
select
(
"
#scaleEditor2
"
)
.
selectAll
(
"
*
"
).
remove
();
view
.
lookupReference
(
'
scaleEditor
'
).
setHidden
(
true
);
view
.
lookupReference
(
'
scaleEditor2
'
).
setHidden
(
true
);
view
.
lookupReference
(
'
scaleEditorLabel1
'
).
setHidden
(
true
);
view
.
lookupReference
(
'
scaleEditorLabel2
'
).
setHidden
(
true
);
}
if
(
nbCol
===
"
one
"
){
view
.
lookupReference
(
'
selectConditionFlux
'
).
setValue
(
"
-- Select Condition --
"
);
me
.
colParse
(
1
,
selectFile
);
}
if
(
nbCol
===
"
two
"
){
view
.
lookupReference
(
'
selectConditionFlux
'
).
setValue
(
"
-- Select Condition --
"
);
view
.
lookupReference
(
'
selectConditionFlux2
'
).
setValue
(
"
-- Select Condition --
"
);
me
.
colParse
(
2
,
selectFile
);
}
}
...
...
@@ -260,10 +277,10 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
var
condSelect2
=
view
.
lookupReference
(
'
selectConditionFlux2
'
).
getValue
();
var
selectedFile
=
view
.
lookupReference
(
'
selectFile
'
).
getValue
();
var
nbColSelect
=
view
.
lookupReference
(
'
selectColNumber
'
).
getValue
();
if
(
condSelect2
===
undefined
){
if
(
condSelect2
===
null
&&
condSelect
!==
null
){
me
.
drawScaleEditor
(
selectedFile
,
condSelect
,
"
null
"
,
nbColSelect
);
}
if
(
condSelect2
!==
undefined
){
if
(
condSelect2
!==
null
&&
condSelect
!==
null
){
me
.
drawScaleEditor
(
selectedFile
,
condSelect
,
condSelect2
,
nbColSelect
);
}
}
...
...
@@ -281,6 +298,12 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
var
condSelect2
=
view
.
lookupReference
(
'
selectConditionFlux2
'
).
getValue
();
var
selectedFile
=
view
.
lookupReference
(
'
selectFile
'
).
getValue
();
var
nbColSelect
=
view
.
lookupReference
(
'
selectColNumber
'
).
getValue
();
if
(
condSelect2
!==
null
&&
condSelect
===
null
){
me
.
drawScaleEditor
(
selectedFile
,
"
null
"
,
condSelect2
,
nbColSelect
);
}
if
(
condSelect2
!==
null
&&
condSelect
!==
null
){
me
.
drawScaleEditor
(
selectedFile
,
condSelect
,
condSelect2
,
nbColSelect
);
}
me
.
drawScaleEditor
(
selectedFile
,
condSelect
,
condSelect2
,
nbColSelect
);
}
}
...
...
@@ -461,31 +484,35 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
view
[
selectedFile
]
=
dataSave
;
var
svg
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor
'
).
el
.
dom
).
select
(
"
#scaleEditor
"
);
if
(
scaleRange1
!==
undefined
){
var
svg
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor
'
).
el
.
dom
).
select
(
"
#scaleEditor
"
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg
,
width
,
height
,
margin
,
scaleRange1
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg
,
width
,
height
,
margin
,
scaleRange1
);
svg
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange1
,
cond
:
"
first
"
});
svg
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange1
,
cond
:
"
first
"
});
win
.
show
();
});
win
.
show
();
});
}
var
svg2
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor2
'
).
el
.
dom
).
select
(
"
#scaleEditor2
"
);
if
(
scaleRange2
!==
undefined
){
var
svg2
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor2
'
).
el
.
dom
).
select
(
"
#scaleEditor2
"
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg2
,
width
,
height
,
margin
,
scaleRange2
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg2
,
width
,
height
,
margin
,
scaleRange2
);
svg2
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange2
,
cond
:
"
second
"
});
svg2
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange2
,
cond
:
"
second
"
});
win
.
show
();
});
win
.
show
();
});
}
}
if
(
nbCol
===
"
one
"
){
...
...
@@ -500,18 +527,20 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
view
[
selectedFile
]
=
dataSave
;
var
svg
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor
'
).
el
.
dom
).
select
(
"
#scaleEditor
"
);
if
(
scaleRange
!==
undefined
){
var
svg
=
d3
.
select
(
view
.
lookupReference
(
'
scaleEditor
'
).
el
.
dom
).
select
(
"
#scaleEditor
"
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg
,
width
,
height
,
margin
,
scaleRange
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleCaption
(
svg
,
width
,
height
,
margin
,
scaleRange
);
svg
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange
,
cond
:
"
first
"
});
svg
.
on
(
"
click
"
,
function
(){
var
win
=
Ext
.
create
(
"
metExploreViz.view.form.fluxScaleEditor.FluxScaleEditor
"
,
{
scaleRange
:
scaleRange
,
cond
:
"
first
"
});
win
.
show
();
});
win
.
show
();
});
}
}
},
...
...
@@ -590,6 +619,30 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
}
},
resetScale
:
function
(
cond
,
svgView
){
var
me
=
this
;
var
view
=
me
.
getView
();
if
(
cond
===
"
first
"
){
var
selectedCond
=
view
.
lookupReference
(
'
selectConditionFlux
'
).
getValue
();
}
if
(
cond
===
"
second
"
){
var
selectedCond
=
view
.
lookupReference
(
'
selectConditionFlux2
'
).
getValue
();
}
var
selectedCond2
=
"
null
"
;
var
selectedFile
=
view
.
lookupReference
(
'
selectFile
'
).
getValue
();
var
nbCol
=
view
.
lookupReference
(
'
selectColNumber
'
).
getValue
();
var
data
=
this
.
getFluxData
(
selectedFile
,
nbCol
,
selectedCond
,
selectedCond2
);
var
fluxData
=
data
[
0
];
var
targetLabel
=
data
[
1
];
var
scaleRange
=
metExploreD3
.
GraphFlux
.
getScale
(
fluxData
,
targetLabel
);
svgView
.
scaleRange
=
scaleRange
;
}
});
app/view/form/fluxScaleEditor/FluxScaleEditorController.js
View file @
057ca51b
...
...
@@ -115,7 +115,26 @@ Ext.define('metExploreViz.view.form.fluxScaleEditor.FluxScaleEditorController',
view
.
lookupReference
(
'
resetButton
'
).
on
({
click
:
function
(){
metExploreD3
.
GraphNumberScaleEditor
.
reset
();
// metExploreD3.GraphNumberScaleEditor.reset();
metExploreD3
.
fireEvent2Arg
(
"
fluxMapping
"
,
"
resetScale
"
,
view
.
cond
,
view
);
var
width
=
450
;
var
height
=
85
;
var
svg
=
d3
.
select
(
view
.
el
.
dom
).
select
(
"
#svgScaleEditor
"
);
var
numberButton
=
view
.
lookupReference
(
'
numberButton
'
);
var
delButton
=
view
.
lookupReference
(
'
delButton
'
);
var
textfieldValue
=
view
.
lookupReference
(
'
textfieldValue
'
);
metExploreD3
.
GraphNumberScaleEditor
.
createNumberScaleEditor
(
svg
,
width
,
height
,
numberButton
,
textfieldValue
,
delButton
,
view
.
scaleRange
);
}
});
...
...
resources/lib/functions/GraphFlux.js
View file @
057ca51b
...
...
@@ -431,6 +431,24 @@ metExploreD3.GraphFlux = {
var
axe
=
"
horizontal
"
;
// For each node, compute the path of the arcs exiting that node, and the path of the arcs exiting that node
if
(
node
.
fluxDirection1
===
""
||
node
.
fluxDirection1
===
undefined
){
enteringLinks
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
exitingLinks
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
}
if
(
node
.
fluxDirection1
===
0
){
enteringLinks
...
...
@@ -634,6 +652,51 @@ metExploreD3.GraphFlux = {
var
axe
=
"
horizontal
"
;
// For each node, compute the path of the arcs exiting that node, and the path of the arcs exiting that node
if
(
node
.
fluxDirection1
===
""
||
node
.
fluxDirection1
===
undefined
){
enteringLinks
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
exitingLinks
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
}
if
(
node
.
fluxDirection2
===
""
||
node
.
fluxDirection2
===
undefined
){
var
newEnter
=
enteringLinks
.
clone
();
d3
.
select
(
"
#viz
"
).
select
(
"
#D3viz
"
).
select
(
"
graphComponent
"
).
append
(
newEnter
);
newEnter
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
classed
(
"
clone
"
,
true
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
var
newExit
=
exitingLinks
.
clone
();
d3
.
select
(
"
#viz
"
).
select
(
"
#D3viz
"
).
select
(
"
graphComponent
"
).
append
(
newExit
);
newExit
.
each
(
function
(
link
){
var
path
=
metExploreD3
.
GraphLink
.
funcPath3
(
link
,
"
viz
"
);
d3
.
select
(
this
).
attr
(
"
d
"
,
path
)
.
classed
(
"
clone
"
,
true
)
.
attr
(
"
fill
"
,
"
none
"
)
.
classed
(
"
horizontal
"
,
false
)
.
classed
(
"
vertical
"
,
false
);
});
}
if
(
node
.
fluxDirection1
===
0
){
enteringLinks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment