Commit fa7d5fcc authored by Jean-Clement Gallardo's avatar Jean-Clement Gallardo
Browse files

Graph Distrib : only display data option

parent 7971fb7a
......@@ -22,7 +22,7 @@ Ext.define('metExploreViz.view.button.buttonImportFlux.ButtonImportFluxControlle
},
/*****************************************************
* Parse file and map data
* Parse file and create flux object
* @param tabTxt : file content
* @param title : file title
*/
......
......@@ -205,10 +205,17 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingForm', {
]
},
{
xtype: 'checkboxfield',
boxLabel: 'Distribution graph : only display data',
reference: 'displayGraphDistrib',
margin: '5 5 5 5'
},
{
xtype: 'checkboxfield',
boxLabel: 'Add flux values on network',
margin: '15 15 10 5',
margin: '0 0 0 5',
reference: 'addValueNetwork'
},
......
......@@ -72,19 +72,20 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
var selectedFile = view.lookupReference('selectFile').getValue();
var nbColSelect = view.lookupReference('selectColNumber').getValue();
var condSelect = view.lookupReference('selectConditionFlux').getValue();
var switchGraph = view.lookupReference('displayGraphDistrib').getValue();
if (selectedFile !== null && nbColSelect !== null && condSelect !== null){
if (nbColSelect === "one"){
var color = document.getElementById("html5colorpickerFlux1").value;
metExploreD3.GraphStyleEdition.fluxPath1 = true;
me.computeFlux(selectedFile, nbColSelect, condSelect, "null", color);
me.computeFlux(selectedFile, nbColSelect, condSelect, "null", color, switchGraph);
}
if (nbColSelect === "two"){
var color = [document.getElementById("html5colorpickerFlux1").value,
document.getElementById("html5colorpickerFlux2").value];
metExploreD3.GraphStyleEdition.fluxPath2 = true;
var condSelect2 = view.lookupReference('selectConditionFlux2').getValue();
me.computeFlux(selectedFile, nbColSelect, condSelect, condSelect2, color);
me.computeFlux(selectedFile, nbColSelect, condSelect, condSelect2, color, switchGraph);
}
if (view.lookupReference('addValueNetwork').getValue() === true){
var size = view.lookupReference('fontSize').getValue();
......@@ -125,19 +126,20 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
var selectedFile = view.lookupReference('selectFile').getValue();
var nbColSelect = view.lookupReference('selectColNumber').getValue();
var condSelect = view.lookupReference('selectConditionFlux').getValue();
var switchGraph = view.lookupReference('displayGraphDistrib').getValue();
if (selectedFile !== null && nbColSelect !== null && condSelect !== null){
if (nbColSelect === "one"){
var color = document.getElementById("html5colorpickerFlux1").value;
metExploreD3.GraphStyleEdition.fluxPath1 = true;
me.computeFlux(selectedFile, nbColSelect, condSelect, "null", color);
me.computeFlux(selectedFile, nbColSelect, condSelect, "null", color, switchGraph);
}
if (nbColSelect === "two"){
var color = [document.getElementById("html5colorpickerFlux1").value,
document.getElementById("html5colorpickerFlux2").value];
metExploreD3.GraphStyleEdition.fluxPath2 = true;
var condSelect2 = view.lookupReference('selectConditionFlux2').getValue();
me.computeFlux(selectedFile, nbColSelect, condSelect, condSelect2, color);
me.computeFlux(selectedFile, nbColSelect, condSelect, condSelect2, color, switchGraph);
}
if (view.lookupReference('addValueNetwork').getValue() === true){
var size = view.lookupReference('fontSize').getValue();
......@@ -243,7 +245,7 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
condStore.setData(fileName);
},
computeFlux: function(selectedFile, nbCol, condSelect, condSelect2, color){
computeFlux: function(selectedFile, nbCol, condSelect, condSelect2, color, switchGraph){
var fluxList = _metExploreViz.flux;
var fileIndex = [];
fluxList.forEach(function(list, i){
......@@ -294,10 +296,10 @@ Ext.define('metExploreViz.view.form.fluxMappingForm.FluxMappingFormController',
}
metExploreD3.GraphFlux.displayChoice(conData, targetLabel, nbCol, color);
if (nbCol === "one"){
metExploreD3.GraphFlux.graphDistribOne(conData, color);
metExploreD3.GraphFlux.graphDistribOne(conData, color, switchGraph);
}
if (nbCol === "two"){
metExploreD3.GraphFlux.graphDistribTwo(conData, color);
metExploreD3.GraphFlux.graphDistribTwo(conData, color, switchGraph);
}
}
......
......@@ -1203,7 +1203,8 @@ metExploreD3.GraphFlux = {
}
},
graphDistribOne: function(fluxData, color){
graphDistribOne: function(fluxData, color, switchGraph){
console.log(fluxData);
var data = [];
var valNeg = [];
var valPos = [];
......@@ -1211,22 +1212,49 @@ metExploreD3.GraphFlux = {
var min = 0;
var max = 0;
fluxData.forEach(function(value) {
var val = value[1]*1;
data.push(val);
if (min > val){
min = val;
}
if (max < val){
max = val;
}
if (val < 0){
valNeg.push(val);
}
if (val > 0){
valPos.push(val);
}
});
if (switchGraph === false){
fluxData.forEach(function(value) {
var val = value[1]*1;
data.push(val);
if (min > val){
min = val;
}
if (max < val){
max = val;
}
if (val < 0){
valNeg.push(val);
}
if (val > 0){
valPos.push(val);
}
});
}
if (switchGraph === true){
var session = _metExploreViz.getSessionById('viz');
var networkData = session.getD3Data();
fluxData.forEach(function(value) {
var nodeName = networkData.getNodeByName(value[0]);
var nodeId = networkData.getNodeByDbIdentifier(value[0]);
if (nodeName !== undefined || nodeId !== undefined){
var val = value[1]*1;
data.push(val);
if (min > val){
min = val;
}
if (max < val){
max = val;
}
if (val < 0){
valNeg.push(val);
}
if (val > 0){
valPos.push(val);
}
}
});
}
var negDistrib = metExploreD3.GraphFlux.fluxDistribution(valNeg);
var interLineNeg = {x1: negDistrib["inter"], x2: negDistrib["inter"], y1: 0, y2: 340};
......@@ -1301,7 +1329,7 @@ metExploreD3.GraphFlux = {
}
},
graphDistribTwo: function(fluxData, color){
graphDistribTwo: function(fluxData, color, switchGraph){
var data1 = [];
var data2 = [];
var valNeg = [];
......@@ -1310,36 +1338,76 @@ metExploreD3.GraphFlux = {
var min = 0;
var max = 0;
fluxData.forEach(function(value) {
var val1 = value[1]*1;
var val2 = value[2]*1;
data1.push(val1);
data2.push(val2);
if (min > val1){
min = val1;
}
if (max < val1){
max = val1;
}
if (min > val2){
min = val2;
}
if (max < val2){
max = val2;
}
if (val1 < 0){
valNeg.push(val1);
}
if (val1 > 0){
valPos.push(val1);
}
if (val2 < 0){
valNeg.push(val2);
}
if (val2 > 0){
valPos.push(val2);
}
});
if (switchGraph === false){
fluxData.forEach(function(value) {
var val1 = value[1]*1;
var val2 = value[2]*1;
data1.push(val1);
data2.push(val2);
if (min > val1){
min = val1;
}
if (max < val1){
max = val1;
}
if (min > val2){
min = val2;
}
if (max < val2){
max = val2;
}
if (val1 < 0){
valNeg.push(val1);
}
if (val1 > 0){
valPos.push(val1);
}
if (val2 < 0){
valNeg.push(val2);
}
if (val2 > 0){
valPos.push(val2);
}
});
}
if (switchGraph === true){
var session = _metExploreViz.getSessionById('viz');
var networkData = session.getD3Data();
fluxData.forEach(function(value) {
var nodeName = networkData.getNodeByName(value[0]);
var nodeId = networkData.getNodeByDbIdentifier(value[0]);
if (nodeName !== undefined || nodeId !== undefined){
var val1 = value[1]*1;
var val2 = value[2]*1;
data1.push(val1);
data2.push(val2);
if (min > val1){
min = val1;
}
if (max < val1){
max = val1;
}
if (min > val2){
min = val2;
}
if (max < val2){
max = val2;
}
if (val1 < 0){
valNeg.push(val1);
}
if (val1 > 0){
valPos.push(val1);
}
if (val2 < 0){
valNeg.push(val2);
}
if (val2 > 0){
valPos.push(val2);
}
}
});
}
var negDistrib = metExploreD3.GraphFlux.fluxDistribution(valNeg);
var interLineNeg = {x1: negDistrib["inter"], x2: negDistrib["inter"], y1: 100, y2: 340};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment