From 942602564d67c4b0980e374f1593f79f06d8a329 Mon Sep 17 00:00:00 2001
From: betsy
Date: Tue, 6 Oct 2020 11:21:52 +1000
Subject: [PATCH 1/3] Bring in line with code on RankFlow website
---
vis.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis.js b/vis.js
index cd82fd5..499f01b 100644
--- a/vis.js
+++ b/vis.js
@@ -54,7 +54,7 @@ function startVis(_valname,_w,_h) {
calculateFactors(_valname);
- _barspacing = Math.round((c_width - (_slicecount * _barwidth)) / (_slicecount - 1)) - _rightspacing;
+ _barspacing = Math.round((c_width - _rightspacing) / _slicecount);
_slices = new Object;
_lines = new Object;
From e7edd3c445724b672d51809a7908602226c9cb9e Mon Sep 17 00:00:00 2001
From: betsy
Date: Tue, 6 Oct 2020 15:12:27 +1000
Subject: [PATCH 2/3] Parsing of three columns works on index page
---
index.html | 68 +++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 50 insertions(+), 18 deletions(-)
diff --git a/index.html b/index.html
index 2b7a104..57e650b 100644
--- a/index.html
+++ b/index.html
@@ -40,17 +40,33 @@
var _h = $("#vis_height").val();
var _labels = {};
- var _valname = "uservariable";
- var _it = 2;
-
- var _rbo_p = parseFloat($("#vis_alpha").val());
-
- var _tmpelements = _rows[1].split("\t")
- _singlerow = (isNaN(parseInt(_tmpelements[1]))) ? true:false;
- if(_singlerow == true) {
+
+ var _values = 0;
+ var _tmpelements = _rows[1].split("\t");
+
+ if (isNaN(parseInt(_tmpelements[1]))) {
+ _values = 0;
_makelog = false;
- _it = 1;
+ } else if (isNaN(parseInt(_tmpelements[2]))) {
+ _values = 1;
+ } else {
+ _values = 2;
}
+
+ var _it = _values + 1;
+
+ var _valnames = [];
+ if (_values > 0) {
+ var _tmpelements = _rows[0].split("\t")
+ if (_values >= 1) {
+ _valnames [0] = _tmpelements[1];
+ }
+ if (_values >= 2) {
+ _valnames [1] = _tmpelements[2];
+ }
+ }
+
+ var _rbo_p = parseFloat($("#vis_alpha").val());
// HTML table output
@@ -70,25 +86,41 @@
_labels[j] = _elements[j];
_html += '| ' + _elements[j] + ' | ';
- if(!_singlerow) {
+ if(_values > 0) {
_html += '' + _elements[j+1] + ' | ';
}
+ if(_values > 1) {
+ _html += '' + _elements[j+2] + ' | ';
+ }
} else {
var _tmp = {};
- var _tmpvalue = ($("#vis_ranksize").is(":checked")) ? _rows.length-i:1;
- _tmp[_valname] = (_singlerow) ? _tmpvalue:parseInt(_elements[j+1]);
- if(_makelog == true) {
- var _newvalname = "log(uservariable)";
- _tmp[_newvalname] = Math.round(Math.log(parseInt(_elements[j+1])) * 10);
+ if (_values == 0) {
+ _tmp["value"] = ($("#vis_ranksize").is(":checked")) ? _rows.length-i:1;
}
+ if (_values > 0) {
+ _tmp[_valnames[0]] = parseInt(_elements[j+1]);
+ if (_makelog == true) {
+ _tmp["log("+ _valnames[0] + ")"] = Math.round(Math.log(parseInt(_elements[j+1])) * 10);
+ }
+ }
+ if (_values > 1) {
+ _tmp[_valnames[1]] = parseInt(_elements[j+2]);
+ if (_makelog == true) {
+ _tmp["log("+ _valnames[1] + ")"] = Math.round(Math.log(parseInt(_elements[j+2])) * 10);
+ }
+ }
+
_data[_labels[j]][_elements[j]] = _tmp;
_html += '' + _elements[j] + ' | ';
- if(!_singlerow) {
+ if(_values > 0) {
_html += '' + _elements[j+1] + ' | ';
}
+ if(_values > 1) {
+ _html += '' + _elements[j+2] + ' | ';
+ }
}
}
@@ -154,7 +186,7 @@
_rbdout += '';
$("#vis_rbd").html(_rbdout);
- var _startval = (_makelog) ? _newvalname:_valname;
+ var _startval = (_makelog) ? "log("+ _valnames[0] + ")":_valnames[0];
startVis(_startval,_w,_h);
}
@@ -240,7 +272,7 @@ RankFlow
the logarithm checkbox for better display.
You can either use data that is merely a collection of ranked items (tab separated single columns, example)
- or combinations of items and a value (tab separated list of two columns, example).
+ or combinations of items and one or two values (tab separated list of two or three columns, example).
This tool also calculates the Rank-Biased Distance (RBD) metric to quantify changes from one slice to the next. The higher the RBD value, the more change. The "RBD p" parameter (value is between 0.01 and 0.99) below allows to determine how
"top-weighed" the calculation should be. With a small p, changes at the top of the lists are weighed more strongly, with p approaching 1 all changes are treated the same. Calculations are based on William Webber, Alistair Moffat, and Justin Zobel (2010)
From 594c542b9802bff349ec470b86366cd2b0af2c97 Mon Sep 17 00:00:00 2001
From: betsy
Date: Mon, 12 Oct 2020 12:28:32 +1000
Subject: [PATCH 3/3] Allow third column to be used for colours
---
index.html | 2 +-
vis.js | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/index.html b/index.html
index 57e650b..bbe8a2c 100644
--- a/index.html
+++ b/index.html
@@ -187,7 +187,7 @@
$("#vis_rbd").html(_rbdout);
var _startval = (_makelog) ? "log("+ _valnames[0] + ")":_valnames[0];
- startVis(_startval,_w,_h);
+ startVis(_startval, _valnames[1],_w,_h);
}
diff --git a/vis.js b/vis.js
index 499f01b..f7cd33a 100644
--- a/vis.js
+++ b/vis.js
@@ -1,4 +1,4 @@
-function startVis(_valname,_w,_h) {
+function startVis(_sizevaluename, _colourvaluename,_w,_h) {
// variables to modify
c_width = parseInt(_w);
@@ -18,8 +18,8 @@ function startVis(_valname,_w,_h) {
// do not modify
_topalign = false;
- _colorMetric = _valname;
- _mainVar = _valname;
+ _colorMetric = _colourvaluename;
+ _mainVar = _sizevaluename;
_slicecount = 0;
_bottomspacing = 5;
_topspacing = 15;
@@ -47,12 +47,12 @@ function startVis(_valname,_w,_h) {
}
- createInterface(_valname);
+ createInterface(_mainVar);
_pf = 0; // pixelfactor
_cf = 0; // colorfactor
- calculateFactors(_valname);
+ calculateFactors(_mainVar);
_barspacing = Math.round((c_width - _rightspacing) / _slicecount);