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
06b9abc3
Commit
06b9abc3
authored
Jan 02, 2020
by
maxchaza
Browse files
Fix saving styles
parent
ca513cb0
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/view/form/aStyleForm/AStyleFormController.js
View file @
06b9abc3
...
...
@@ -220,6 +220,33 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', {
}
},
updateDiscreteMapping
:
function
(){
var
me
=
this
;
var
view
=
me
.
getView
();
var
conditionName
=
view
.
lookupReference
(
'
selectConditionForm
'
).
lookupReference
(
'
selectCondition
'
).
getValue
();
var
selectConditionType
=
view
.
lookupReference
(
'
selectConditionForm
'
).
lookupReference
(
'
selectConditionType
'
);
var
dataType
=
selectConditionType
.
getValue
();
var
session
=
_metExploreViz
.
getSessionById
(
"
viz
"
);
if
(
dataType
===
"
Alias
"
){
session
.
setMappingDataType
(
dataType
);
metExploreD3
.
GraphMapping
.
graphMappingDiscreteData
(
conditionName
,
view
);
}
if
(
dataType
===
"
Discrete
"
){
session
.
setMappingDataType
(
dataType
);
metExploreD3
.
GraphMapping
.
graphMappingDiscreteData
(
conditionName
,
view
);
}
if
(
dataType
===
"
As selection
"
){
session
.
setMappingDataType
(
dataType
);
metExploreD3
.
GraphMapping
.
graphMappingAsSelectionData
(
conditionName
,
view
);
}
},
updateFormValues
:
function
(){
var
me
=
this
;
var
view
=
me
.
getView
();
...
...
@@ -614,7 +641,6 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', {
},
addValueMapping
:
function
(
type
,
n
,
c
){
var
valueMappings
=
this
.
getValueMappingsByType
(
type
);
console
.
log
(
valueMappings
);
var
newVal
=
new
ValueMapping
(
n
,
c
);
if
(
valueMappings
.
findIndex
(
function
(
valueMap
)
{
return
valueMap
.
getName
()
===
n
;
})
===-
1
)
valueMappings
.
push
(
newVal
);
...
...
app/view/form/allStylesForm/AllStylesFormController.js
View file @
06b9abc3
...
...
@@ -43,8 +43,6 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
view
.
query
(
"
allStylesByTypeForm
"
).
forEach
(
function
(
allStylesByTypeForm
)
{
console
.
log
(
aStyleForm
);
var
partOfAllScales
=
allStylesByTypeForm
.
query
(
"
aStyleForm
"
)
.
map
(
function
(
aStyleForm
)
{
return
{
...
...
@@ -120,9 +118,8 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
Continuous
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateContinuousCaption
();
theStyleForm
.
getController
().
updateContinuousMapping
();
if
(
dataType
===
"
Discrete
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
...
...
@@ -141,9 +138,8 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
Continuous
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateContinuousCaption
();
theStyleForm
.
getController
().
updateContinuousMapping
();
if
(
dataType
===
"
As selection
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
...
...
@@ -162,9 +158,8 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
Continuous
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateContinuousCaption
();
theStyleForm
.
getController
().
updateContinuousMapping
();
if
(
dataType
===
"
Alias
"
&&
selectedCondition
!==
null
){
theStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
...
...
app/view/form/selectConditionForm/SelectConditionFormController.js
View file @
06b9abc3
...
...
@@ -118,20 +118,75 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
if
(
dataType
===
"
Continuous
"
){
// Allows to reload the same file
var
viewAStyleForm
=
me
.
getAStyleFormParent
();
viewAStyleForm
.
scaleRange
=
metExploreD3
.
GraphUtils
.
decodeJSON
(
json
);
viewAStyleForm
.
getController
().
updateContinuousCaption
();
viewAStyleForm
.
getController
().
updateContinuousMapping
();
}
if
(
dataType
===
"
Discrete
"
||
dataType
===
"
As selection
"
||
dataType
===
"
Alias
"
){
// Allows to reload the same file
var
viewAStyleForm
=
me
.
getAStyleFormParent
();
viewAStyleForm
.
scaleRange
=
metExploreD3
.
GraphUtils
.
decodeJSON
(
json
);
viewAStyleForm
.
getController
().
updateContinuousCaption
();
viewAStyleForm
.
getController
().
updateContinuousMapping
();
if
(
dataType
===
"
Discrete
"
){
me
.
removeCaption
();
var
newArray
=
metExploreD3
.
GraphUtils
.
decodeJSON
(
json
).
map
(
function
(
val
)
{
return
new
ValueMapping
(
val
.
name
,
val
.
value
);
});
if
(
newArray
!==
viewAStyleForm
.
valueDiscreteMappings
){
viewAStyleForm
.
valueDiscreteMappings
=
newArray
;
var
selectConditionForm
=
viewAStyleForm
.
lookupReference
(
'
selectConditionForm
'
);
var
selectCondition
=
selectConditionForm
.
lookupReference
(
'
selectCondition
'
);
var
selectConditionType
=
selectConditionForm
.
lookupReference
(
'
selectConditionType
'
);
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
Discrete
"
&&
selectedCondition
!==
null
){
viewAStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
if
(
dataType
===
"
As selection
"
){
me
.
removeCaption
();
var
newArray
=
metExploreD3
.
GraphUtils
.
decodeJSON
(
json
).
map
(
function
(
val
)
{
return
new
ValueMapping
(
val
.
name
,
val
.
value
);
});
if
(
newArray
!==
viewAStyleForm
.
valueAsSelectionMappings
){
viewAStyleForm
.
valueAsSelectionMappings
=
newArray
;
var
selectConditionForm
=
viewAStyleForm
.
lookupReference
(
'
selectConditionForm
'
);
var
selectCondition
=
selectConditionForm
.
lookupReference
(
'
selectCondition
'
);
var
selectConditionType
=
selectConditionForm
.
lookupReference
(
'
selectConditionType
'
);
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
As selection
"
&&
selectedCondition
!==
null
){
viewAStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
if
(
dataType
===
"
Alias
"
){
me
.
removeCaption
();
var
newArray
=
metExploreD3
.
GraphUtils
.
decodeJSON
(
json
).
map
(
function
(
val
)
{
return
new
ValueMapping
(
val
.
name
,
val
.
value
);
});
if
(
newArray
!==
viewAStyleForm
.
valueAliasMappings
){
viewAStyleForm
.
valueAliasMappings
=
newArray
;
var
selectConditionForm
=
viewAStyleForm
.
lookupReference
(
'
selectConditionForm
'
);
var
selectCondition
=
selectConditionForm
.
lookupReference
(
'
selectCondition
'
);
var
selectConditionType
=
selectConditionForm
.
lookupReference
(
'
selectConditionType
'
);
var
dataType
=
selectConditionType
.
getValue
();
var
selectedCondition
=
selectCondition
.
getValue
();
if
(
dataType
===
"
Alias
"
&&
selectedCondition
!==
null
){
viewAStyleForm
.
getController
().
updateDiscreteMapping
();
}
}
}
});
},
scope
:
me
...
...
@@ -149,6 +204,27 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
});
},
/*******************************************
* Remove all mapping in visualisation and in side panel
*/
removeCaption
:
function
(){
var
me
=
this
;
var
view
=
me
.
getView
();
var
session
=
_metExploreViz
.
getSessionById
(
'
viz
'
);
var
aStyleFormParent
=
me
.
getAStyleFormParent
();
var
colorStore
=
aStyleFormParent
.
getController
().
getValueMappingsSet
(
session
.
getMappingDataType
());
colorStore
.
forEach
(
function
(
color
){
var
newId
=
color
.
getName
().
toString
().
replace
(
me
.
regexpPanel
,
"
_
"
);
if
(
view
.
down
(
"
#mappingCaptionForm
"
+
newId
))
view
.
down
(
"
#mappingCaptionForm
"
+
newId
).
close
();
});
if
(
view
.
down
(
"
#undefined
"
))
view
.
down
(
"
#undefined
"
).
close
();
},
/*******************************************
* Remove all mapping in visualisation and in side panel
*/
...
...
app/view/panel/viz/Viz.js
View file @
06b9abc3
...
...
@@ -35,6 +35,7 @@
'
-
'
,
{
xtype
:
'
button
'
,
hidden
:
true
,
iconCls
:
'
edgesSelection
'
,
align
:
"
right
"
,
scale
:
'
large
'
,
...
...
@@ -45,6 +46,7 @@
},
{
xtype
:
'
button
'
,
hidden
:
true
,
iconCls
:
'
metaboliteSelection
'
,
align
:
"
right
"
,
scale
:
'
large
'
,
...
...
@@ -55,6 +57,7 @@
},
{
xtype
:
'
button
'
,
hidden
:
true
,
iconCls
:
'
reactionSelection
'
,
align
:
"
right
"
,
scale
:
'
large
'
,
...
...
resources/lib/functions/GraphMapping.js
View file @
06b9abc3
...
...
@@ -998,19 +998,19 @@ metExploreD3.GraphMapping = {
.
range
([
aStyleFormParent
.
min
,
aStyleFormParent
.
max
]);
for
(
var
i
=
0
;
i
<
valuesParsed
.
length
;
i
++
)
{
aStyleFormParent
.
getController
().
addValueMapping
(
"
Discrete
"
,
values
[
i
],
linearScale
(
valuesParsed
[
i
]));
metExploreD3
.
GraphStyleEdition
.
setCollectionStyleDiscreteMapping
(
aStyleFormParent
.
target
,
aStyleFormParent
.
attrType
,
aStyleFormParent
.
attrName
,
aStyleFormParent
.
biologicalType
,
conditionName
,
mappingName
,
values
[
i
],
linearScale
(
valuesParsed
[
i
]))
// metExploreD3.GraphMapping.fixMappingColorOnNodeData(color, values[i], conditionName, mappingName);
}
var
valueMapping
=
aStyleFormParent
.
getController
().
getValueMappingsSet
(
session
.
getMappingDataType
());
valueMapping
.
forEach
(
function
(
valMapping
){
metExploreD3
.
GraphStyleEdition
.
setCollectionStyleDiscreteMapping
(
aStyleFormParent
.
target
,
aStyleFormParent
.
attrType
,
aStyleFormParent
.
attrName
,
aStyleFormParent
.
biologicalType
,
conditionName
,
mappingName
,
valMapping
.
getName
(),
valMapping
.
getValue
())
});
}
if
(
aStyleFormParent
.
styleType
===
"
color
"
)
{
center
=
128
;
width
=
127
;
frequency
=
Math
.
PI
*
2
*
0.95
/
values
.
length
;
var
position
=
top
;
var
colorStore
=
aStyleFormParent
.
getController
().
getValueMappingsSet
(
session
.
getMappingDataType
());
for
(
var
i
=
0
;
i
<
values
.
length
;
i
++
)
{
var
red
=
Math
.
sin
(
frequency
*
i
+
2
+
values
.
length
)
*
width
+
center
;
...
...
@@ -1020,9 +1020,15 @@ metExploreD3.GraphMapping = {
color
=
metExploreD3
.
GraphUtils
.
RGB2Color
(
red
,
green
,
blue
);
aStyleFormParent
.
getController
().
addValueMapping
(
"
Discrete
"
,
values
[
i
],
color
);
metExploreD3
.
GraphStyleEdition
.
setCollectionStyleDiscreteMapping
(
aStyleFormParent
.
target
,
aStyleFormParent
.
attrType
,
aStyleFormParent
.
attrName
,
aStyleFormParent
.
biologicalType
,
conditionName
,
mappingName
,
values
[
i
],
color
)
// metExploreD3.GraphMapping.fixMappingColorOnNodeData(color, values[i], conditionName, mappingName);
}
var
colorStore
=
aStyleFormParent
.
getController
().
getValueMappingsSet
(
session
.
getMappingDataType
());
colorStore
.
forEach
(
function
(
color
){
console
.
log
(
color
.
getName
());
console
.
log
(
color
.
getValue
());
metExploreD3
.
GraphStyleEdition
.
setCollectionStyleDiscreteMapping
(
aStyleFormParent
.
target
,
aStyleFormParent
.
attrType
,
aStyleFormParent
.
attrName
,
aStyleFormParent
.
biologicalType
,
conditionName
,
mappingName
,
color
.
getName
(),
color
.
getValue
())
});
}
...
...
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