Skip to content

Commit

Permalink
fixed bugs seen on beta with gray line checkbox #568
Browse files Browse the repository at this point in the history
  • Loading branch information
Eileen Choe committed Apr 21, 2018
1 parent e2e2968 commit 78e85af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
9 changes: 3 additions & 6 deletions web-client/public/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Grid from "d3-v4-grid";
/* eslint no-unused-vars: [2, {"varsIgnorePattern": "text|getMappedValue|manualZoom"}] */
/* eslint-disable no-unused-vars */

export var drawGraph = function (network, sliderController, normalization, grayThreshold, dashedLine, nodeColoring) {
export var drawGraph = function (network, sliderController, normalization, grayThreshold, nodeColoring) {
/* eslint-enable no-unused-vars */
var $container = $(".grnsight-container");
d3.selectAll("svg").remove();
Expand All @@ -28,6 +28,8 @@ export var drawGraph = function (network, sliderController, normalization, grayT
var nodeHeight = 30;
var colorOptimal = true;

var dashedLine = $("#dashedGrayLineButton").prop("checked");

var CURSOR_CLASSES = "cursorGrab cursorGrabbing";

var zoomSliderScale = 1; // Tracks the value of the zoom slider, initally at 100%
Expand Down Expand Up @@ -403,11 +405,6 @@ export var drawGraph = function (network, sliderController, normalization, grayT

grayThreshold = +$("#grayThresholdInput").val();

dashedLine = $("#dashedGrayLineButton").is(":checked", function () {
$("#dashedGrayLineButton").prop("checked", true);
});


link.append("path")
.attr("class", "main")
.attr("id", function (d) {
Expand Down
14 changes: 6 additions & 8 deletions web-client/public/js/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const upload = function (sliderObject, sliderGroupController, drawGraph,

var normalization = false;

var displayNetwork = function (network, name, normalization, grayThreshold, dashedLine) {
var displayNetwork = function (network, name, normalization, grayThreshold) {
nodeColoring.reload(network, name);
if (document.getElementById("zoomSlider").disabled) {
document.getElementById("zoomSlider").disabled = false;
Expand All @@ -185,7 +185,7 @@ export const upload = function (sliderObject, sliderGroupController, drawGraph,
[ "#resetSliders", "#resetSlidersMenu", "#undoReset", "#undoResetMenu" ].forEach(function (selector) {
$(selector).off("click");
});
drawGraph(network, sliders, normalization, grayThreshold, dashedLine, nodeColoring);
drawGraph(network, sliders, normalization, grayThreshold, nodeColoring);
};

var networkErrorDisplayer = function (xhr) {
Expand Down Expand Up @@ -302,31 +302,29 @@ export const upload = function (sliderObject, sliderGroupController, drawGraph,
});

var grayThreshold = false;
var dashedLine = false;

$("#normalization-button").click(function () {
normalization = true;
// displayNetwork(currentNetwork, name, normalization);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, dashedLine, nodeColoring);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, nodeColoring);
});

$("#resetNormalizationButton").click(function () {
document.getElementById("normalization-max").value = "";
// normalization = false;
// displayNetwork(currentNetwork, name, normalization);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, dashedLine, nodeColoring);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, nodeColoring);
});

$("#grayThresholdInput").on("change", function () {
grayThreshold = true;
// displayNetwork(currentNetwork, name, normalization, grayThreshold);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, dashedLine, nodeColoring);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, nodeColoring);
});

$("#dashedGrayLineButton").on("change", function () {
dashedLine = true;
// displayNetwork(currentNetwork, name, normalization, grayThreshold);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, dashedLine, nodeColoring);
drawGraph(currentNetwork, sliders, normalization, grayThreshold, nodeColoring);
});

var annotateLinks = function (network) {
Expand Down
2 changes: 1 addition & 1 deletion web-client/views/upload.jade
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ html
label(id='grayLabel' for='grayThresholdInput', class='info', data-toggle='tooltip', title='Increases/decreases the threshold at which edges appear gray. Edges with normalized weight values below this percentage are shown as gray.') Gray Threshold (0 - 100%):    
span(class='forceVal', id='grayThresholdValue') 5%
<br />
input(id='dashedGrayLineButton', type='checkbox', value='dashedGrayLine' class="lockSliders" onclick='dashedGrayLineUpdate(this)')
input(id='dashedGrayLineButton', type='checkbox', value='dashedGrayLine')
label(for='dashedGrayLineButton' style='font-weight:normal')&nbsp; Show gray edges as dashed
<br />
input(id='grayThresholdInput', class='form-control', type='range', min='0', max='1', value='0.05', step='0.01', oninput='outputUpdate()')
Expand Down

0 comments on commit 78e85af

Please sign in to comment.