From 8559bc58b0045b4b2daa7b7e1ace00f1443129e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 17 Mar 2022 16:33:57 +0100 Subject: [PATCH 1/6] the Plot.stack offset option can be a function (for diverging semantic bars following a Likert scale) --- README.md | 1 + src/transforms/stack.js | 1 + test/data/survey.json | 1 + test/output/likertSurvey.html | 121 ++++++++++++++++++++++++++++++++++ test/plots/index.js | 1 + test/plots/likert-survey.js | 42 ++++++++++++ 6 files changed, 167 insertions(+) create mode 100644 test/data/survey.json create mode 100644 test/output/likertSurvey.html create mode 100644 test/plots/likert-survey.js diff --git a/README.md b/README.md index f4bdbad1a6..48351e93f1 100644 --- a/README.md +++ b/README.md @@ -1866,6 +1866,7 @@ After all values have been stacked from zero, an optional **offset** can be appl - *expand* (or *normalize*) - rescale each stack to fill [0, 1] - *center* (or *silhouette*) - align the centers of all stacks - *wiggle* - translate stacks to minimize apparent movement +- a function that receives as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z, and can modify X1 and X2, typically by subtracting the same offset from each of the X1 and X2 values that pertain to a stack. If a given stack has zero total value, the *expand* offset will not adjust the stack’s position. Both the *center* and *wiggle* offsets ensure that the lowest element across stacks starts at zero for better default axes. The *wiggle* offset is recommended for streamgraphs, and if used, changes the default order to *inside-out*; see [Byron & Wattenberg](http://leebyron.com/streamgraph/). diff --git a/src/transforms/stack.js b/src/transforms/stack.js index 6f5ad1c080..ac17bd0154 100644 --- a/src/transforms/stack.js +++ b/src/transforms/stack.js @@ -108,6 +108,7 @@ function stack(x, y = () => 1, ky, {offset, order, reverse}, options) { function maybeOffset(offset) { if (offset == null) return; + if (typeof offset === "function") return offset; switch (`${offset}`.toLowerCase()) { case "expand": case "normalize": return offsetExpand; case "center": case "silhouette": return offsetCenter; diff --git a/test/data/survey.json b/test/data/survey.json new file mode 100644 index 0000000000..9d57c035f5 --- /dev/null +++ b/test/data/survey.json @@ -0,0 +1 @@ +[{"Question":"Q1","ID":0,"Response":"Agree"},{"Question":"Q1","ID":1,"Response":"Agree"},{"Question":"Q1","ID":2,"Response":"Agree"},{"Question":"Q1","ID":3,"Response":"Neutral"},{"Question":"Q1","ID":4,"Response":"Strongly Disagree"},{"Question":"Q1","ID":5,"Response":"Neutral"},{"Question":"Q1","ID":6,"Response":"Strongly Disagree"},{"Question":"Q1","ID":7,"Response":"Strongly Agree"},{"Question":"Q1","ID":8,"Response":"Neutral"},{"Question":"Q1","ID":9,"Response":"Neutral"},{"Question":"Q1","ID":10,"Response":"Neutral"},{"Question":"Q1","ID":11,"Response":"Agree"},{"Question":"Q1","ID":12,"Response":"Strongly Agree"},{"Question":"Q1","ID":13,"Response":"Strongly Agree"},{"Question":"Q1","ID":14,"Response":"Neutral"},{"Question":"Q1","ID":15,"Response":"Strongly Agree"},{"Question":"Q1","ID":16,"Response":"Disagree"},{"Question":"Q1","ID":17,"Response":"Agree"},{"Question":"Q1","ID":18,"Response":"Agree"},{"Question":"Q1","ID":19,"Response":"Neutral"},{"Question":"Q1","ID":20,"Response":"Strongly Agree"},{"Question":"Q1","ID":21,"Response":"Neutral"},{"Question":"Q1","ID":22,"Response":"Strongly Agree"},{"Question":"Q1","ID":23,"Response":"Neutral"},{"Question":"Q1","ID":24,"Response":"Strongly Disagree"},{"Question":"Q1","ID":25,"Response":"Neutral"},{"Question":"Q1","ID":26,"Response":"Strongly Agree"},{"Question":"Q1","ID":27,"Response":"Disagree"},{"Question":"Q1","ID":28,"Response":"Strongly Agree"},{"Question":"Q1","ID":29,"Response":"Agree"},{"Question":"Q1","ID":30,"Response":"Neutral"},{"Question":"Q1","ID":31,"Response":"Neutral"},{"Question":"Q1","ID":32,"Response":"Strongly Agree"},{"Question":"Q1","ID":33,"Response":"Strongly Agree"},{"Question":"Q1","ID":34,"Response":"Agree"},{"Question":"Q1","ID":35,"Response":"Disagree"},{"Question":"Q1","ID":36,"Response":"Disagree"},{"Question":"Q1","ID":37,"Response":"Neutral"},{"Question":"Q1","ID":38,"Response":"Neutral"},{"Question":"Q1","ID":39,"Response":"Agree"},{"Question":"Q1","ID":40,"Response":"Strongly Agree"},{"Question":"Q1","ID":41,"Response":"Disagree"},{"Question":"Q1","ID":42,"Response":"Neutral"},{"Question":"Q1","ID":43,"Response":"Neutral"},{"Question":"Q1","ID":44,"Response":"Neutral"},{"Question":"Q1","ID":45,"Response":"Neutral"},{"Question":"Q1","ID":46,"Response":"Neutral"},{"Question":"Q1","ID":47,"Response":"Strongly Disagree"},{"Question":"Q1","ID":48,"Response":"Disagree"},{"Question":"Q1","ID":49,"Response":"Strongly Disagree"},{"Question":"Q1","ID":50,"Response":"Agree"},{"Question":"Q1","ID":51,"Response":"Disagree"},{"Question":"Q1","ID":52,"Response":"Neutral"},{"Question":"Q1","ID":53,"Response":"Neutral"},{"Question":"Q1","ID":54,"Response":"Disagree"},{"Question":"Q1","ID":55,"Response":"Neutral"},{"Question":"Q1","ID":56,"Response":"Strongly Disagree"},{"Question":"Q1","ID":57,"Response":"Strongly Agree"},{"Question":"Q1","ID":58,"Response":"Disagree"},{"Question":"Q1","ID":59,"Response":"Neutral"},{"Question":"Q1","ID":60,"Response":"Strongly Agree"},{"Question":"Q1","ID":61,"Response":"Neutral"},{"Question":"Q1","ID":62,"Response":"Strongly Agree"},{"Question":"Q1","ID":63,"Response":"Disagree"},{"Question":"Q1","ID":64,"Response":"Neutral"},{"Question":"Q1","ID":65,"Response":"Neutral"},{"Question":"Q1","ID":66,"Response":"Strongly Agree"},{"Question":"Q1","ID":67,"Response":"Neutral"},{"Question":"Q1","ID":68,"Response":"Neutral"},{"Question":"Q1","ID":69,"Response":"Agree"},{"Question":"Q1","ID":70,"Response":"Neutral"},{"Question":"Q1","ID":71,"Response":"Neutral"},{"Question":"Q1","ID":72,"Response":"Neutral"},{"Question":"Q1","ID":73,"Response":"Strongly Agree"},{"Question":"Q1","ID":74,"Response":"Agree"},{"Question":"Q1","ID":75,"Response":"Neutral"},{"Question":"Q1","ID":76,"Response":"Disagree"},{"Question":"Q1","ID":77,"Response":"Agree"},{"Question":"Q1","ID":78,"Response":"Disagree"},{"Question":"Q1","ID":79,"Response":"Strongly Agree"},{"Question":"Q1","ID":80,"Response":"Strongly Disagree"},{"Question":"Q1","ID":81,"Response":"Agree"},{"Question":"Q1","ID":82,"Response":"Agree"},{"Question":"Q1","ID":83,"Response":"Agree"},{"Question":"Q1","ID":84,"Response":"Disagree"},{"Question":"Q1","ID":85,"Response":"Strongly Agree"},{"Question":"Q1","ID":86,"Response":"Neutral"},{"Question":"Q1","ID":87,"Response":"Disagree"},{"Question":"Q1","ID":88,"Response":"Strongly Disagree"},{"Question":"Q1","ID":89,"Response":"Strongly Disagree"},{"Question":"Q1","ID":90,"Response":"Agree"},{"Question":"Q1","ID":91,"Response":"Neutral"},{"Question":"Q1","ID":92,"Response":"Neutral"},{"Question":"Q1","ID":93,"Response":"Strongly Agree"},{"Question":"Q1","ID":94,"Response":"Neutral"},{"Question":"Q1","ID":95,"Response":"Strongly Agree"},{"Question":"Q1","ID":96,"Response":"Neutral"},{"Question":"Q1","ID":97,"Response":"Strongly Agree"},{"Question":"Q1","ID":98,"Response":"Strongly Disagree"},{"Question":"Q1","ID":99,"Response":"Disagree"},{"Question":"Q1","ID":100,"Response":"Agree"},{"Question":"Q2","ID":0,"Response":"Neutral"},{"Question":"Q2","ID":1,"Response":"Agree"},{"Question":"Q2","ID":2,"Response":"Agree"},{"Question":"Q2","ID":3,"Response":"Agree"},{"Question":"Q2","ID":4,"Response":"Neutral"},{"Question":"Q2","ID":5,"Response":"Neutral"},{"Question":"Q2","ID":6,"Response":"Neutral"},{"Question":"Q2","ID":7,"Response":"Neutral"},{"Question":"Q2","ID":8,"Response":"Agree"},{"Question":"Q2","ID":9,"Response":"Neutral"},{"Question":"Q2","ID":10,"Response":"Strongly Disagree"},{"Question":"Q2","ID":11,"Response":"Agree"},{"Question":"Q2","ID":12,"Response":"Strongly Agree"},{"Question":"Q2","ID":13,"Response":"Agree"},{"Question":"Q2","ID":14,"Response":"Neutral"},{"Question":"Q2","ID":15,"Response":"Disagree"},{"Question":"Q2","ID":16,"Response":"Neutral"},{"Question":"Q2","ID":17,"Response":"Neutral"},{"Question":"Q2","ID":18,"Response":"Agree"},{"Question":"Q2","ID":19,"Response":"Strongly Agree"},{"Question":"Q2","ID":20,"Response":"Strongly Agree"},{"Question":"Q2","ID":21,"Response":"Agree"},{"Question":"Q2","ID":22,"Response":"Strongly Agree"},{"Question":"Q2","ID":23,"Response":"Neutral"},{"Question":"Q2","ID":24,"Response":"Strongly Disagree"},{"Question":"Q2","ID":25,"Response":"Neutral"},{"Question":"Q2","ID":26,"Response":"Strongly Disagree"},{"Question":"Q2","ID":27,"Response":"Disagree"},{"Question":"Q2","ID":28,"Response":"Neutral"},{"Question":"Q2","ID":29,"Response":"Neutral"},{"Question":"Q2","ID":30,"Response":"Agree"},{"Question":"Q2","ID":31,"Response":"Agree"},{"Question":"Q2","ID":32,"Response":"Agree"},{"Question":"Q2","ID":33,"Response":"Strongly Disagree"},{"Question":"Q2","ID":34,"Response":"Strongly Agree"},{"Question":"Q2","ID":35,"Response":"Agree"},{"Question":"Q2","ID":36,"Response":"Strongly Disagree"},{"Question":"Q2","ID":37,"Response":"Strongly Agree"},{"Question":"Q2","ID":38,"Response":"Neutral"},{"Question":"Q2","ID":39,"Response":"Strongly Agree"},{"Question":"Q2","ID":40,"Response":"Disagree"},{"Question":"Q2","ID":41,"Response":"Agree"},{"Question":"Q2","ID":42,"Response":"Strongly Disagree"},{"Question":"Q2","ID":43,"Response":"Strongly Disagree"},{"Question":"Q2","ID":44,"Response":"Agree"},{"Question":"Q2","ID":45,"Response":"Strongly Agree"},{"Question":"Q2","ID":46,"Response":"Strongly Agree"},{"Question":"Q2","ID":47,"Response":"Neutral"},{"Question":"Q2","ID":48,"Response":"Neutral"},{"Question":"Q2","ID":49,"Response":"Neutral"},{"Question":"Q2","ID":50,"Response":"Strongly Disagree"},{"Question":"Q2","ID":51,"Response":"Strongly Disagree"},{"Question":"Q2","ID":52,"Response":"Agree"},{"Question":"Q2","ID":53,"Response":"Agree"},{"Question":"Q2","ID":54,"Response":"Neutral"},{"Question":"Q2","ID":55,"Response":"Neutral"},{"Question":"Q2","ID":56,"Response":"Agree"},{"Question":"Q2","ID":57,"Response":"Strongly Disagree"},{"Question":"Q2","ID":58,"Response":"Strongly Disagree"},{"Question":"Q2","ID":59,"Response":"Neutral"},{"Question":"Q2","ID":60,"Response":"Strongly Agree"},{"Question":"Q2","ID":61,"Response":"Agree"},{"Question":"Q2","ID":62,"Response":"Strongly Disagree"},{"Question":"Q2","ID":63,"Response":"Agree"},{"Question":"Q2","ID":64,"Response":"Agree"},{"Question":"Q2","ID":65,"Response":"Agree"},{"Question":"Q2","ID":66,"Response":"Agree"},{"Question":"Q2","ID":67,"Response":"Neutral"},{"Question":"Q2","ID":68,"Response":"Neutral"},{"Question":"Q2","ID":69,"Response":"Strongly Disagree"},{"Question":"Q2","ID":70,"Response":"Disagree"},{"Question":"Q2","ID":71,"Response":"Strongly Disagree"},{"Question":"Q2","ID":72,"Response":"Strongly Disagree"},{"Question":"Q2","ID":73,"Response":"Strongly Disagree"},{"Question":"Q2","ID":74,"Response":"Strongly Disagree"},{"Question":"Q2","ID":75,"Response":"Strongly Disagree"},{"Question":"Q2","ID":76,"Response":"Neutral"},{"Question":"Q2","ID":77,"Response":"Strongly Agree"},{"Question":"Q2","ID":78,"Response":"Neutral"},{"Question":"Q2","ID":79,"Response":"Strongly Disagree"},{"Question":"Q2","ID":80,"Response":"Agree"},{"Question":"Q2","ID":81,"Response":"Agree"},{"Question":"Q2","ID":82,"Response":"Strongly Agree"},{"Question":"Q2","ID":83,"Response":"Agree"},{"Question":"Q2","ID":84,"Response":"Strongly Disagree"},{"Question":"Q2","ID":85,"Response":"Disagree"},{"Question":"Q2","ID":86,"Response":"Strongly Disagree"},{"Question":"Q2","ID":87,"Response":"Agree"},{"Question":"Q2","ID":88,"Response":"Neutral"},{"Question":"Q2","ID":89,"Response":"Strongly Disagree"},{"Question":"Q2","ID":90,"Response":"Neutral"},{"Question":"Q2","ID":91,"Response":"Agree"},{"Question":"Q2","ID":92,"Response":"Strongly Disagree"},{"Question":"Q2","ID":93,"Response":"Neutral"},{"Question":"Q2","ID":94,"Response":"Neutral"},{"Question":"Q3","ID":0,"Response":"Neutral"},{"Question":"Q3","ID":1,"Response":"Agree"},{"Question":"Q3","ID":2,"Response":"Disagree"},{"Question":"Q3","ID":3,"Response":"Agree"},{"Question":"Q3","ID":4,"Response":"Neutral"},{"Question":"Q3","ID":5,"Response":"Agree"},{"Question":"Q3","ID":6,"Response":"Neutral"},{"Question":"Q3","ID":7,"Response":"Agree"},{"Question":"Q3","ID":8,"Response":"Agree"},{"Question":"Q3","ID":9,"Response":"Neutral"},{"Question":"Q3","ID":10,"Response":"Neutral"},{"Question":"Q3","ID":11,"Response":"Neutral"},{"Question":"Q3","ID":12,"Response":"Neutral"},{"Question":"Q3","ID":13,"Response":"Neutral"},{"Question":"Q3","ID":14,"Response":"Strongly Disagree"},{"Question":"Q3","ID":15,"Response":"Strongly Agree"},{"Question":"Q3","ID":16,"Response":"Neutral"},{"Question":"Q3","ID":17,"Response":"Neutral"},{"Question":"Q3","ID":18,"Response":"Strongly Agree"},{"Question":"Q3","ID":19,"Response":"Neutral"},{"Question":"Q3","ID":20,"Response":"Agree"},{"Question":"Q3","ID":21,"Response":"Neutral"},{"Question":"Q3","ID":22,"Response":"Disagree"},{"Question":"Q3","ID":23,"Response":"Neutral"},{"Question":"Q3","ID":24,"Response":"Neutral"},{"Question":"Q3","ID":25,"Response":"Strongly Disagree"},{"Question":"Q3","ID":26,"Response":"Strongly Disagree"},{"Question":"Q3","ID":27,"Response":"Agree"},{"Question":"Q3","ID":28,"Response":"Disagree"},{"Question":"Q3","ID":29,"Response":"Agree"},{"Question":"Q3","ID":30,"Response":"Neutral"},{"Question":"Q3","ID":31,"Response":"Neutral"},{"Question":"Q3","ID":32,"Response":"Agree"},{"Question":"Q3","ID":33,"Response":"Neutral"},{"Question":"Q3","ID":34,"Response":"Strongly Agree"},{"Question":"Q3","ID":35,"Response":"Neutral"},{"Question":"Q3","ID":36,"Response":"Strongly Disagree"},{"Question":"Q3","ID":37,"Response":"Strongly Agree"},{"Question":"Q3","ID":38,"Response":"Neutral"},{"Question":"Q3","ID":39,"Response":"Disagree"},{"Question":"Q3","ID":40,"Response":"Neutral"},{"Question":"Q3","ID":41,"Response":"Neutral"},{"Question":"Q3","ID":42,"Response":"Agree"},{"Question":"Q3","ID":43,"Response":"Neutral"},{"Question":"Q3","ID":44,"Response":"Neutral"},{"Question":"Q3","ID":45,"Response":"Neutral"},{"Question":"Q3","ID":46,"Response":"Agree"},{"Question":"Q3","ID":47,"Response":"Agree"},{"Question":"Q3","ID":48,"Response":"Strongly Agree"},{"Question":"Q3","ID":49,"Response":"Strongly Agree"},{"Question":"Q3","ID":50,"Response":"Agree"},{"Question":"Q3","ID":51,"Response":"Neutral"},{"Question":"Q3","ID":52,"Response":"Neutral"},{"Question":"Q3","ID":53,"Response":"Neutral"},{"Question":"Q3","ID":54,"Response":"Disagree"},{"Question":"Q3","ID":55,"Response":"Agree"},{"Question":"Q3","ID":56,"Response":"Neutral"},{"Question":"Q3","ID":57,"Response":"Neutral"},{"Question":"Q3","ID":58,"Response":"Strongly Disagree"},{"Question":"Q3","ID":59,"Response":"Agree"},{"Question":"Q3","ID":60,"Response":"Strongly Disagree"},{"Question":"Q3","ID":61,"Response":"Disagree"},{"Question":"Q3","ID":62,"Response":"Neutral"},{"Question":"Q3","ID":63,"Response":"Agree"},{"Question":"Q3","ID":64,"Response":"Neutral"},{"Question":"Q3","ID":65,"Response":"Neutral"},{"Question":"Q3","ID":66,"Response":"Neutral"},{"Question":"Q3","ID":67,"Response":"Disagree"},{"Question":"Q3","ID":68,"Response":"Neutral"},{"Question":"Q3","ID":69,"Response":"Strongly Agree"},{"Question":"Q3","ID":70,"Response":"Neutral"},{"Question":"Q3","ID":71,"Response":"Strongly Disagree"},{"Question":"Q3","ID":72,"Response":"Neutral"},{"Question":"Q3","ID":73,"Response":"Neutral"},{"Question":"Q3","ID":74,"Response":"Neutral"},{"Question":"Q3","ID":75,"Response":"Agree"},{"Question":"Q3","ID":76,"Response":"Neutral"},{"Question":"Q3","ID":77,"Response":"Agree"},{"Question":"Q3","ID":78,"Response":"Strongly Agree"},{"Question":"Q3","ID":79,"Response":"Strongly Agree"},{"Question":"Q3","ID":80,"Response":"Agree"},{"Question":"Q3","ID":81,"Response":"Neutral"},{"Question":"Q3","ID":82,"Response":"Strongly Agree"},{"Question":"Q3","ID":83,"Response":"Neutral"},{"Question":"Q3","ID":84,"Response":"Strongly Agree"},{"Question":"Q3","ID":85,"Response":"Agree"},{"Question":"Q3","ID":86,"Response":"Neutral"},{"Question":"Q3","ID":87,"Response":"Neutral"},{"Question":"Q3","ID":88,"Response":"Strongly Agree"},{"Question":"Q3","ID":89,"Response":"Agree"},{"Question":"Q3","ID":90,"Response":"Neutral"},{"Question":"Q3","ID":91,"Response":"Neutral"},{"Question":"Q3","ID":92,"Response":"Neutral"},{"Question":"Q3","ID":93,"Response":"Neutral"},{"Question":"Q3","ID":94,"Response":"Neutral"},{"Question":"Q3","ID":95,"Response":"Agree"},{"Question":"Q3","ID":96,"Response":"Neutral"},{"Question":"Q3","ID":97,"Response":"Strongly Agree"},{"Question":"Q3","ID":98,"Response":"Strongly Agree"},{"Question":"Q3","ID":99,"Response":"Strongly Agree"},{"Question":"Q3","ID":100,"Response":"Strongly Disagree"},{"Question":"Q3","ID":101,"Response":"Strongly Agree"},{"Question":"Q3","ID":102,"Response":"Strongly Agree"},{"Question":"Q4","ID":0,"Response":"Neutral"},{"Question":"Q4","ID":1,"Response":"Disagree"},{"Question":"Q4","ID":2,"Response":"Disagree"},{"Question":"Q4","ID":3,"Response":"Neutral"},{"Question":"Q4","ID":4,"Response":"Strongly Agree"},{"Question":"Q4","ID":5,"Response":"Disagree"},{"Question":"Q4","ID":6,"Response":"Disagree"},{"Question":"Q4","ID":7,"Response":"Disagree"},{"Question":"Q4","ID":8,"Response":"Neutral"},{"Question":"Q4","ID":9,"Response":"Disagree"},{"Question":"Q4","ID":10,"Response":"Disagree"},{"Question":"Q4","ID":11,"Response":"Neutral"},{"Question":"Q4","ID":12,"Response":"Neutral"},{"Question":"Q4","ID":13,"Response":"Disagree"},{"Question":"Q4","ID":14,"Response":"Neutral"},{"Question":"Q4","ID":15,"Response":"Disagree"},{"Question":"Q4","ID":16,"Response":"Neutral"},{"Question":"Q4","ID":17,"Response":"Disagree"},{"Question":"Q4","ID":18,"Response":"Neutral"},{"Question":"Q4","ID":19,"Response":"Disagree"},{"Question":"Q4","ID":20,"Response":"Neutral"},{"Question":"Q4","ID":21,"Response":"Disagree"},{"Question":"Q4","ID":22,"Response":"Strongly Disagree"},{"Question":"Q4","ID":23,"Response":"Disagree"},{"Question":"Q4","ID":24,"Response":"Strongly Agree"},{"Question":"Q4","ID":25,"Response":"Neutral"},{"Question":"Q4","ID":26,"Response":"Strongly Agree"},{"Question":"Q4","ID":27,"Response":"Strongly Agree"},{"Question":"Q4","ID":28,"Response":"Strongly Agree"},{"Question":"Q4","ID":29,"Response":"Strongly Agree"},{"Question":"Q4","ID":30,"Response":"Disagree"},{"Question":"Q4","ID":31,"Response":"Agree"},{"Question":"Q4","ID":32,"Response":"Neutral"},{"Question":"Q4","ID":33,"Response":"Neutral"},{"Question":"Q4","ID":34,"Response":"Disagree"},{"Question":"Q4","ID":35,"Response":"Disagree"},{"Question":"Q4","ID":36,"Response":"Neutral"},{"Question":"Q4","ID":37,"Response":"Disagree"},{"Question":"Q4","ID":38,"Response":"Disagree"},{"Question":"Q4","ID":39,"Response":"Disagree"},{"Question":"Q4","ID":40,"Response":"Agree"},{"Question":"Q4","ID":41,"Response":"Disagree"},{"Question":"Q4","ID":42,"Response":"Disagree"},{"Question":"Q4","ID":43,"Response":"Disagree"},{"Question":"Q4","ID":44,"Response":"Strongly Agree"},{"Question":"Q4","ID":45,"Response":"Strongly Agree"},{"Question":"Q4","ID":46,"Response":"Disagree"},{"Question":"Q4","ID":47,"Response":"Disagree"},{"Question":"Q4","ID":48,"Response":"Disagree"},{"Question":"Q4","ID":49,"Response":"Disagree"},{"Question":"Q4","ID":50,"Response":"Disagree"},{"Question":"Q4","ID":51,"Response":"Disagree"},{"Question":"Q4","ID":52,"Response":"Disagree"},{"Question":"Q4","ID":53,"Response":"Neutral"},{"Question":"Q4","ID":54,"Response":"Disagree"},{"Question":"Q4","ID":55,"Response":"Strongly Disagree"},{"Question":"Q4","ID":56,"Response":"Disagree"},{"Question":"Q4","ID":57,"Response":"Disagree"},{"Question":"Q4","ID":58,"Response":"Disagree"},{"Question":"Q4","ID":59,"Response":"Strongly Disagree"},{"Question":"Q4","ID":60,"Response":"Neutral"},{"Question":"Q4","ID":61,"Response":"Disagree"},{"Question":"Q4","ID":62,"Response":"Strongly Disagree"},{"Question":"Q4","ID":63,"Response":"Strongly Agree"},{"Question":"Q4","ID":64,"Response":"Strongly Agree"},{"Question":"Q4","ID":65,"Response":"Neutral"},{"Question":"Q4","ID":66,"Response":"Strongly Agree"},{"Question":"Q4","ID":67,"Response":"Disagree"},{"Question":"Q4","ID":68,"Response":"Disagree"},{"Question":"Q4","ID":69,"Response":"Disagree"},{"Question":"Q4","ID":70,"Response":"Agree"},{"Question":"Q4","ID":71,"Response":"Strongly Agree"},{"Question":"Q4","ID":72,"Response":"Strongly Agree"},{"Question":"Q4","ID":73,"Response":"Strongly Disagree"},{"Question":"Q4","ID":74,"Response":"Disagree"},{"Question":"Q4","ID":75,"Response":"Neutral"},{"Question":"Q4","ID":76,"Response":"Agree"},{"Question":"Q4","ID":77,"Response":"Disagree"},{"Question":"Q4","ID":78,"Response":"Neutral"},{"Question":"Q4","ID":79,"Response":"Disagree"},{"Question":"Q4","ID":80,"Response":"Disagree"},{"Question":"Q4","ID":81,"Response":"Disagree"},{"Question":"Q4","ID":82,"Response":"Strongly Agree"},{"Question":"Q4","ID":83,"Response":"Strongly Disagree"},{"Question":"Q4","ID":84,"Response":"Strongly Agree"},{"Question":"Q4","ID":85,"Response":"Disagree"},{"Question":"Q4","ID":86,"Response":"Strongly Agree"},{"Question":"Q4","ID":87,"Response":"Disagree"},{"Question":"Q4","ID":88,"Response":"Neutral"},{"Question":"Q4","ID":89,"Response":"Neutral"},{"Question":"Q4","ID":90,"Response":"Disagree"},{"Question":"Q4","ID":91,"Response":"Disagree"},{"Question":"Q4","ID":92,"Response":"Disagree"},{"Question":"Q4","ID":93,"Response":"Strongly Agree"},{"Question":"Q4","ID":94,"Response":"Agree"},{"Question":"Q4","ID":95,"Response":"Neutral"},{"Question":"Q4","ID":96,"Response":"Disagree"},{"Question":"Q4","ID":97,"Response":"Disagree"},{"Question":"Q4","ID":98,"Response":"Disagree"},{"Question":"Q4","ID":99,"Response":"Disagree"},{"Question":"Q5","ID":0,"Response":"Disagree"},{"Question":"Q5","ID":1,"Response":"Neutral"},{"Question":"Q5","ID":2,"Response":"Strongly Agree"},{"Question":"Q5","ID":3,"Response":"Strongly Agree"},{"Question":"Q5","ID":4,"Response":"Neutral"},{"Question":"Q5","ID":5,"Response":"Strongly Disagree"},{"Question":"Q5","ID":6,"Response":"Strongly Agree"},{"Question":"Q5","ID":7,"Response":"Strongly Agree"},{"Question":"Q5","ID":8,"Response":"Neutral"},{"Question":"Q5","ID":9,"Response":"Strongly Disagree"},{"Question":"Q5","ID":10,"Response":"Agree"},{"Question":"Q5","ID":11,"Response":"Agree"},{"Question":"Q5","ID":12,"Response":"Strongly Disagree"},{"Question":"Q5","ID":13,"Response":"Strongly Disagree"},{"Question":"Q5","ID":14,"Response":"Strongly Disagree"},{"Question":"Q5","ID":15,"Response":"Disagree"},{"Question":"Q5","ID":16,"Response":"Neutral"},{"Question":"Q5","ID":17,"Response":"Strongly Disagree"},{"Question":"Q5","ID":18,"Response":"Neutral"},{"Question":"Q5","ID":19,"Response":"Neutral"},{"Question":"Q5","ID":20,"Response":"Strongly Agree"},{"Question":"Q5","ID":21,"Response":"Disagree"},{"Question":"Q5","ID":22,"Response":"Agree"},{"Question":"Q5","ID":23,"Response":"Strongly Agree"},{"Question":"Q5","ID":24,"Response":"Strongly Agree"},{"Question":"Q5","ID":25,"Response":"Strongly Agree"},{"Question":"Q5","ID":26,"Response":"Strongly Agree"},{"Question":"Q5","ID":27,"Response":"Neutral"},{"Question":"Q5","ID":28,"Response":"Disagree"},{"Question":"Q5","ID":29,"Response":"Strongly Agree"},{"Question":"Q5","ID":30,"Response":"Neutral"},{"Question":"Q5","ID":31,"Response":"Strongly Agree"},{"Question":"Q5","ID":32,"Response":"Strongly Agree"},{"Question":"Q5","ID":33,"Response":"Agree"},{"Question":"Q5","ID":34,"Response":"Strongly Agree"},{"Question":"Q5","ID":35,"Response":"Strongly Agree"},{"Question":"Q5","ID":36,"Response":"Agree"},{"Question":"Q5","ID":37,"Response":"Strongly Agree"},{"Question":"Q5","ID":38,"Response":"Disagree"},{"Question":"Q5","ID":39,"Response":"Strongly Agree"},{"Question":"Q5","ID":40,"Response":"Strongly Agree"},{"Question":"Q5","ID":41,"Response":"Agree"},{"Question":"Q5","ID":42,"Response":"Strongly Agree"},{"Question":"Q5","ID":43,"Response":"Neutral"},{"Question":"Q5","ID":44,"Response":"Agree"},{"Question":"Q5","ID":45,"Response":"Agree"},{"Question":"Q5","ID":46,"Response":"Strongly Agree"},{"Question":"Q5","ID":47,"Response":"Agree"},{"Question":"Q5","ID":48,"Response":"Agree"},{"Question":"Q5","ID":49,"Response":"Strongly Agree"},{"Question":"Q5","ID":50,"Response":"Strongly Agree"},{"Question":"Q5","ID":51,"Response":"Disagree"},{"Question":"Q5","ID":52,"Response":"Neutral"},{"Question":"Q5","ID":53,"Response":"Neutral"},{"Question":"Q5","ID":54,"Response":"Strongly Agree"},{"Question":"Q5","ID":55,"Response":"Disagree"},{"Question":"Q5","ID":56,"Response":"Neutral"},{"Question":"Q5","ID":57,"Response":"Neutral"},{"Question":"Q5","ID":58,"Response":"Strongly Disagree"},{"Question":"Q5","ID":59,"Response":"Disagree"},{"Question":"Q5","ID":60,"Response":"Strongly Agree"},{"Question":"Q5","ID":61,"Response":"Strongly Agree"},{"Question":"Q5","ID":62,"Response":"Strongly Agree"},{"Question":"Q5","ID":63,"Response":"Strongly Agree"},{"Question":"Q5","ID":64,"Response":"Strongly Agree"},{"Question":"Q5","ID":65,"Response":"Strongly Agree"},{"Question":"Q5","ID":66,"Response":"Strongly Disagree"},{"Question":"Q5","ID":67,"Response":"Strongly Agree"},{"Question":"Q5","ID":68,"Response":"Strongly Agree"},{"Question":"Q5","ID":69,"Response":"Agree"},{"Question":"Q5","ID":70,"Response":"Strongly Agree"},{"Question":"Q5","ID":71,"Response":"Agree"},{"Question":"Q5","ID":72,"Response":"Strongly Agree"},{"Question":"Q5","ID":73,"Response":"Agree"},{"Question":"Q5","ID":74,"Response":"Strongly Agree"},{"Question":"Q5","ID":75,"Response":"Agree"},{"Question":"Q5","ID":76,"Response":"Strongly Agree"},{"Question":"Q5","ID":77,"Response":"Neutral"},{"Question":"Q5","ID":78,"Response":"Neutral"},{"Question":"Q5","ID":79,"Response":"Disagree"},{"Question":"Q5","ID":80,"Response":"Strongly Disagree"},{"Question":"Q5","ID":81,"Response":"Agree"},{"Question":"Q5","ID":82,"Response":"Neutral"},{"Question":"Q5","ID":83,"Response":"Strongly Agree"},{"Question":"Q5","ID":84,"Response":"Strongly Agree"},{"Question":"Q5","ID":85,"Response":"Agree"},{"Question":"Q5","ID":86,"Response":"Strongly Disagree"},{"Question":"Q5","ID":87,"Response":"Neutral"},{"Question":"Q5","ID":88,"Response":"Strongly Agree"},{"Question":"Q5","ID":89,"Response":"Strongly Agree"},{"Question":"Q5","ID":90,"Response":"Agree"},{"Question":"Q5","ID":91,"Response":"Disagree"},{"Question":"Q5","ID":92,"Response":"Neutral"},{"Question":"Q5","ID":93,"Response":"Neutral"},{"Question":"Q5","ID":94,"Response":"Neutral"},{"Question":"Q5","ID":95,"Response":"Strongly Disagree"},{"Question":"Q5","ID":96,"Response":"Disagree"},{"Question":"Q5","ID":97,"Response":"Neutral"},{"Question":"Q5","ID":98,"Response":"Strongly Agree"},{"Question":"Q5","ID":99,"Response":"Strongly Agree"},{"Question":"Q5","ID":100,"Response":"Disagree"}] \ No newline at end of file diff --git a/test/output/likertSurvey.html b/test/output/likertSurvey.html new file mode 100644 index 0000000000..51b4b1b634 --- /dev/null +++ b/test/output/likertSurvey.html @@ -0,0 +1,121 @@ +
+
+ Strongly DisagreeDisagreeNeutralAgreeStrongly Agree +
+ + + + Q1 + + + Q2 + + + Q3 + + + Q4 + + + Q5 + Question + + + + 60 + + + 40 + + + 20 + + + 0 + + + 20 + + + 40 + + + 60 + # of answers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/test/plots/index.js b/test/plots/index.js index 8c147c5c04..5f08b36a12 100644 --- a/test/plots/index.js +++ b/test/plots/index.js @@ -77,6 +77,7 @@ export {default as letterFrequencyColumn} from "./letter-frequency-column.js"; export {default as letterFrequencyDot} from "./letter-frequency-dot.js"; export {default as letterFrequencyLollipop} from "./letter-frequency-lollipop.js"; export {default as letterFrequencyWheel} from "./letter-frequency-wheel.js"; +export {default as likertSurvey} from "./likert-survey.js"; export {default as logDegenerate} from "./log-degenerate.js"; export {default as metroInequality} from "./metro-inequality.js"; export {default as metroInequalityChange} from "./metro-inequality-change.js"; diff --git a/test/plots/likert-survey.js b/test/plots/likert-survey.js new file mode 100644 index 0000000000..b89a039660 --- /dev/null +++ b/test/plots/likert-survey.js @@ -0,0 +1,42 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +export default async function() { + const data = await d3.json("data/survey.json"); + const values = new Map([ + ["Strongly Disagree", -1], + ["Disagree", -1], + ["Neutral", 0], + ["Agree", 1], + ["Strongly Agree", 1] + ]); + const order = [...values.keys()]; + return Plot.plot({ + x: { tickFormat: Math.abs, label: "# of answers" }, + y: { tickSize: 0 }, + color: { legend: true, domain: order, scheme: "RdBu" }, + marks: [ + Plot.barX( + data, + Plot.groupY( + { x: "count" }, + { + y: "Question", + fill: "Response", + order, + offset: (facetstacks, X1, X2, Z) => { + for (const S of facetstacks) { + for (const I of S) { + const offset = + d3.sum(I, (i) => (X2[i] - X1[i]) * (1 - values.get(Z[i]))) / 2; + for (const i of I) (X1[i] -= offset), (X2[i] -= offset); + } + } + } + } + ) + ), + Plot.ruleX([0]) + ] + }); +} From 3e59fd8b6c8d5dc2c3da067c31bb69386c88b965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 17 Mar 2022 17:15:46 +0100 Subject: [PATCH 2/6] readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48351e93f1..47d0cf9272 100644 --- a/README.md +++ b/README.md @@ -1866,10 +1866,12 @@ After all values have been stacked from zero, an optional **offset** can be appl - *expand* (or *normalize*) - rescale each stack to fill [0, 1] - *center* (or *silhouette*) - align the centers of all stacks - *wiggle* - translate stacks to minimize apparent movement -- a function that receives as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z, and can modify X1 and X2, typically by subtracting the same offset from each of the X1 and X2 values that pertain to a stack. +- a function to be passed an index and arrays of values If a given stack has zero total value, the *expand* offset will not adjust the stack’s position. Both the *center* and *wiggle* offsets ensure that the lowest element across stacks starts at zero for better default axes. The *wiggle* offset is recommended for streamgraphs, and if used, changes the default order to *inside-out*; see [Byron & Wattenberg](http://leebyron.com/streamgraph/). +If the offset is specified as a function, it will receive as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z. It can then change the values in X1 and X2, typically by subtracting a common offset from each of the X1 and X2 values that pertain to a stack. + In addition to the **y1** and **y2** output channels, Plot.stackY computes a **y** output channel that represents the midpoint of **y1** and **y2**. Plot.stackX does the same for **x**. This can be used to position a label or a dot in the center of a stacked layer. The **x** and **y** output channels are lazy: they are only computed if needed by a downstream mark or transform. If two arguments are passed to the stack transform functions below, the stack-specific options (**offset**, **order**, and **reverse**) are pulled exclusively from the first *options* argument, while any channels (*e.g.*, **x**, **y**, and **z**) are pulled from second *options* argument. Options from the second argument that are not consumed by the stack transform will be passed through. Using two arguments is sometimes necessary is disambiguate the option recipient when chaining transforms. From ee29e76c663dd3ec6591ec9de0af8b1aec713afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 17 Mar 2022 22:54:50 +0100 Subject: [PATCH 3/6] clearer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47d0cf9272..2c612798ba 100644 --- a/README.md +++ b/README.md @@ -1870,7 +1870,7 @@ After all values have been stacked from zero, an optional **offset** can be appl If a given stack has zero total value, the *expand* offset will not adjust the stack’s position. Both the *center* and *wiggle* offsets ensure that the lowest element across stacks starts at zero for better default axes. The *wiggle* offset is recommended for streamgraphs, and if used, changes the default order to *inside-out*; see [Byron & Wattenberg](http://leebyron.com/streamgraph/). -If the offset is specified as a function, it will receive as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z. It can then change the values in X1 and X2, typically by subtracting a common offset from each of the X1 and X2 values that pertain to a stack. +If the offset is specified as a function, it will receive as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z. It can then change the values in X1 and X2, typically by subtracting a common offset for each of the indices that pertain to the same stack. In addition to the **y1** and **y2** output channels, Plot.stackY computes a **y** output channel that represents the midpoint of **y1** and **y2**. Plot.stackX does the same for **x**. This can be used to position a label or a dot in the center of a stacked layer. The **x** and **y** output channels are lazy: they are only computed if needed by a downstream mark or transform. From 5e9e341e25bca4a6f88a2770c5f7ca8718add8bf Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Sat, 19 Mar 2022 09:57:50 -0700 Subject: [PATCH 4/6] Likert helper; update README --- README.md | 7 ++-- test/output/likertSurvey.html | 4 +-- test/plots/likert-survey.js | 60 ++++++++++++++++++++--------------- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 2c612798ba..43d9ebd103 100644 --- a/README.md +++ b/README.md @@ -1854,9 +1854,10 @@ The following **order** methods are supported: - *sum* - order series by their total value - *appearance* - order series by the position of their maximum value - *inside-out* - order the earliest-appearing series on the inside +- a named field or function of data - order data by priority - an array of *z* values -The **reverse** option reverses the effective order. For the *value* order, Plot.stackY uses the *y*-value while Plot.stackX uses the *x*-value. For the *appearance* order, Plot.stackY uses the *x*-position of the maximum *y*-value while Plot.stackX uses the *y*-position of the maximum *x*-value. If an array of *z* values are specified, they should enumerate the *z* values for all series in the desired order; this array is typically hard-coded or computed with [d3.groupSort](https://github.com/d3/d3-array/blob/main/README.md#groupSort). Note that the input order (null) and *value* order can produce crossing paths: unlike the other order methods, they do not guarantee a consistent series order across stacks. +The **reverse** option reverses the effective order. For the *value* order, Plot.stackY uses the *y*-value while Plot.stackX uses the *x*-value. For the *appearance* order, Plot.stackY uses the *x*-position of the maximum *y*-value while Plot.stackX uses the *y*-position of the maximum *x*-value. If an array of *z* values are specified, they should enumerate the *z* values for all series in the desired order; this array is typically hard-coded or computed with [d3.groupSort](https://github.com/d3/d3-array/blob/main/README.md#groupSort). Note that the input order (null) and *value* order can produce crossing paths: they do not guarantee a consistent series order across stacks. The stack transform supports diverging stacks: negative values are stacked below zero while positive values are stacked above zero. For Plot.stackY, the **y1** channel contains the value of lesser magnitude (closer to zero) while the **y2** channel contains the value of greater magnitude (farther from zero); the difference between the two corresponds to the input **y** channel value. For Plot.stackX, the same is true, except for **x1**, **x2**, and **x** respectively. @@ -1866,11 +1867,11 @@ After all values have been stacked from zero, an optional **offset** can be appl - *expand* (or *normalize*) - rescale each stack to fill [0, 1] - *center* (or *silhouette*) - align the centers of all stacks - *wiggle* - translate stacks to minimize apparent movement -- a function to be passed an index and arrays of values +- a function to be passed a nested index, and start, end, and *z* values If a given stack has zero total value, the *expand* offset will not adjust the stack’s position. Both the *center* and *wiggle* offsets ensure that the lowest element across stacks starts at zero for better default axes. The *wiggle* offset is recommended for streamgraphs, and if used, changes the default order to *inside-out*; see [Byron & Wattenberg](http://leebyron.com/streamgraph/). -If the offset is specified as a function, it will receive as arguments a nested index of stacks, the X1 and X2 arrays (resp. Y1 and Y2 for stackY), and Z. It can then change the values in X1 and X2, typically by subtracting a common offset for each of the indices that pertain to the same stack. +If the offset is specified as a function, it will receive four arguments: an index of stacks nested by facet and then stack, an array of start values, an array of end values, and an array of *z* values. For stackX, the start and end values correspond to *x1* and *x2*, while for stackY, the start and end values correspond to *y1* and *y2*. The offset function is then responsible for mutating the arrays of start and end values, such as by subtracting a common offset for each of the indices that pertain to the same stack. In addition to the **y1** and **y2** output channels, Plot.stackY computes a **y** output channel that represents the midpoint of **y1** and **y2**. Plot.stackX does the same for **x**. This can be used to position a label or a dot in the center of a stacked layer. The **x** and **y** output channels are lazy: they are only computed if needed by a downstream mark or transform. diff --git a/test/output/likertSurvey.html b/test/output/likertSurvey.html index 51b4b1b634..1ab359c01f 100644 --- a/test/output/likertSurvey.html +++ b/test/output/likertSurvey.html @@ -64,7 +64,7 @@ Q5 Question - + 60 @@ -85,7 +85,7 @@ 60 - # of answers + ← more disagree · Number of responses · more agree → diff --git a/test/plots/likert-survey.js b/test/plots/likert-survey.js index b89a039660..41f27a65c6 100644 --- a/test/plots/likert-survey.js +++ b/test/plots/likert-survey.js @@ -1,41 +1,49 @@ import * as Plot from "@observablehq/plot"; import * as d3 from "d3"; +function Likert(responses) { + const map = new Map(responses); + return { + order: Array.from(map.keys()), + offset(facetstacks, X1, X2, Z) { + for (const stacks of facetstacks) { + for (const stack of stacks) { + const k = d3.sum(stack, i => (X2[i] - X1[i]) * (1 - map.get(Z[i]))) / 2; + for (const i of stack) { + X1[i] -= k; + X2[i] -= k; + } + } + } + } + }; +} + export default async function() { - const data = await d3.json("data/survey.json"); - const values = new Map([ + const survey = await d3.json("data/survey.json"); + const {order, offset} = Likert([ ["Strongly Disagree", -1], ["Disagree", -1], ["Neutral", 0], ["Agree", 1], ["Strongly Agree", 1] ]); - const order = [...values.keys()]; return Plot.plot({ - x: { tickFormat: Math.abs, label: "# of answers" }, - y: { tickSize: 0 }, - color: { legend: true, domain: order, scheme: "RdBu" }, + x: { + tickFormat: Math.abs, + label: "← more disagree · Number of responses · more agree →", + labelAnchor: "center" + }, + y: { + tickSize: 0 + }, + color: { + legend: true, + domain: order, + scheme: "RdBu" + }, marks: [ - Plot.barX( - data, - Plot.groupY( - { x: "count" }, - { - y: "Question", - fill: "Response", - order, - offset: (facetstacks, X1, X2, Z) => { - for (const S of facetstacks) { - for (const I of S) { - const offset = - d3.sum(I, (i) => (X2[i] - X1[i]) * (1 - values.get(Z[i]))) / 2; - for (const i of I) (X1[i] -= offset), (X2[i] -= offset); - } - } - } - } - ) - ), + Plot.barX(survey, Plot.groupY({x: "count"}, {y: "Question", fill: "Response", order, offset})), Plot.ruleX([0]) ] }); From 8bba2b0a0082914e9503e45f83e01a0ae38707cb Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Sat, 19 Mar 2022 09:59:44 -0700 Subject: [PATCH 5/6] switch to CSV --- test/data/survey.csv | 501 ++++++++++++++++++++++++++++++++++++ test/data/survey.json | 1 - test/plots/likert-survey.js | 2 +- 3 files changed, 502 insertions(+), 2 deletions(-) create mode 100644 test/data/survey.csv delete mode 100644 test/data/survey.json diff --git a/test/data/survey.csv b/test/data/survey.csv new file mode 100644 index 0000000000..657424e241 --- /dev/null +++ b/test/data/survey.csv @@ -0,0 +1,501 @@ +Question,ID,Response +Q1,0,Agree +Q1,1,Agree +Q1,2,Agree +Q1,3,Neutral +Q1,4,Strongly Disagree +Q1,5,Neutral +Q1,6,Strongly Disagree +Q1,7,Strongly Agree +Q1,8,Neutral +Q1,9,Neutral +Q1,10,Neutral +Q1,11,Agree +Q1,12,Strongly Agree +Q1,13,Strongly Agree +Q1,14,Neutral +Q1,15,Strongly Agree +Q1,16,Disagree +Q1,17,Agree +Q1,18,Agree +Q1,19,Neutral +Q1,20,Strongly Agree +Q1,21,Neutral +Q1,22,Strongly Agree +Q1,23,Neutral +Q1,24,Strongly Disagree +Q1,25,Neutral +Q1,26,Strongly Agree +Q1,27,Disagree +Q1,28,Strongly Agree +Q1,29,Agree +Q1,30,Neutral +Q1,31,Neutral +Q1,32,Strongly Agree +Q1,33,Strongly Agree +Q1,34,Agree +Q1,35,Disagree +Q1,36,Disagree +Q1,37,Neutral +Q1,38,Neutral +Q1,39,Agree +Q1,40,Strongly Agree +Q1,41,Disagree +Q1,42,Neutral +Q1,43,Neutral +Q1,44,Neutral +Q1,45,Neutral +Q1,46,Neutral +Q1,47,Strongly Disagree +Q1,48,Disagree +Q1,49,Strongly Disagree +Q1,50,Agree +Q1,51,Disagree +Q1,52,Neutral +Q1,53,Neutral +Q1,54,Disagree +Q1,55,Neutral +Q1,56,Strongly Disagree +Q1,57,Strongly Agree +Q1,58,Disagree +Q1,59,Neutral +Q1,60,Strongly Agree +Q1,61,Neutral +Q1,62,Strongly Agree +Q1,63,Disagree +Q1,64,Neutral +Q1,65,Neutral +Q1,66,Strongly Agree +Q1,67,Neutral +Q1,68,Neutral +Q1,69,Agree +Q1,70,Neutral +Q1,71,Neutral +Q1,72,Neutral +Q1,73,Strongly Agree +Q1,74,Agree +Q1,75,Neutral +Q1,76,Disagree +Q1,77,Agree +Q1,78,Disagree +Q1,79,Strongly Agree +Q1,80,Strongly Disagree +Q1,81,Agree +Q1,82,Agree +Q1,83,Agree +Q1,84,Disagree +Q1,85,Strongly Agree +Q1,86,Neutral +Q1,87,Disagree +Q1,88,Strongly Disagree +Q1,89,Strongly Disagree +Q1,90,Agree +Q1,91,Neutral +Q1,92,Neutral +Q1,93,Strongly Agree +Q1,94,Neutral +Q1,95,Strongly Agree +Q1,96,Neutral +Q1,97,Strongly Agree +Q1,98,Strongly Disagree +Q1,99,Disagree +Q1,100,Agree +Q2,0,Neutral +Q2,1,Agree +Q2,2,Agree +Q2,3,Agree +Q2,4,Neutral +Q2,5,Neutral +Q2,6,Neutral +Q2,7,Neutral +Q2,8,Agree +Q2,9,Neutral +Q2,10,Strongly Disagree +Q2,11,Agree +Q2,12,Strongly Agree +Q2,13,Agree +Q2,14,Neutral +Q2,15,Disagree +Q2,16,Neutral +Q2,17,Neutral +Q2,18,Agree +Q2,19,Strongly Agree +Q2,20,Strongly Agree +Q2,21,Agree +Q2,22,Strongly Agree +Q2,23,Neutral +Q2,24,Strongly Disagree +Q2,25,Neutral +Q2,26,Strongly Disagree +Q2,27,Disagree +Q2,28,Neutral +Q2,29,Neutral +Q2,30,Agree +Q2,31,Agree +Q2,32,Agree +Q2,33,Strongly Disagree +Q2,34,Strongly Agree +Q2,35,Agree +Q2,36,Strongly Disagree +Q2,37,Strongly Agree +Q2,38,Neutral +Q2,39,Strongly Agree +Q2,40,Disagree +Q2,41,Agree +Q2,42,Strongly Disagree +Q2,43,Strongly Disagree +Q2,44,Agree +Q2,45,Strongly Agree +Q2,46,Strongly Agree +Q2,47,Neutral +Q2,48,Neutral +Q2,49,Neutral +Q2,50,Strongly Disagree +Q2,51,Strongly Disagree +Q2,52,Agree +Q2,53,Agree +Q2,54,Neutral +Q2,55,Neutral +Q2,56,Agree +Q2,57,Strongly Disagree +Q2,58,Strongly Disagree +Q2,59,Neutral +Q2,60,Strongly Agree +Q2,61,Agree +Q2,62,Strongly Disagree +Q2,63,Agree +Q2,64,Agree +Q2,65,Agree +Q2,66,Agree +Q2,67,Neutral +Q2,68,Neutral +Q2,69,Strongly Disagree +Q2,70,Disagree +Q2,71,Strongly Disagree +Q2,72,Strongly Disagree +Q2,73,Strongly Disagree +Q2,74,Strongly Disagree +Q2,75,Strongly Disagree +Q2,76,Neutral +Q2,77,Strongly Agree +Q2,78,Neutral +Q2,79,Strongly Disagree +Q2,80,Agree +Q2,81,Agree +Q2,82,Strongly Agree +Q2,83,Agree +Q2,84,Strongly Disagree +Q2,85,Disagree +Q2,86,Strongly Disagree +Q2,87,Agree +Q2,88,Neutral +Q2,89,Strongly Disagree +Q2,90,Neutral +Q2,91,Agree +Q2,92,Strongly Disagree +Q2,93,Neutral +Q2,94,Neutral +Q3,0,Neutral +Q3,1,Agree +Q3,2,Disagree +Q3,3,Agree +Q3,4,Neutral +Q3,5,Agree +Q3,6,Neutral +Q3,7,Agree +Q3,8,Agree +Q3,9,Neutral +Q3,10,Neutral +Q3,11,Neutral +Q3,12,Neutral +Q3,13,Neutral +Q3,14,Strongly Disagree +Q3,15,Strongly Agree +Q3,16,Neutral +Q3,17,Neutral +Q3,18,Strongly Agree +Q3,19,Neutral +Q3,20,Agree +Q3,21,Neutral +Q3,22,Disagree +Q3,23,Neutral +Q3,24,Neutral +Q3,25,Strongly Disagree +Q3,26,Strongly Disagree +Q3,27,Agree +Q3,28,Disagree +Q3,29,Agree +Q3,30,Neutral +Q3,31,Neutral +Q3,32,Agree +Q3,33,Neutral +Q3,34,Strongly Agree +Q3,35,Neutral +Q3,36,Strongly Disagree +Q3,37,Strongly Agree +Q3,38,Neutral +Q3,39,Disagree +Q3,40,Neutral +Q3,41,Neutral +Q3,42,Agree +Q3,43,Neutral +Q3,44,Neutral +Q3,45,Neutral +Q3,46,Agree +Q3,47,Agree +Q3,48,Strongly Agree +Q3,49,Strongly Agree +Q3,50,Agree +Q3,51,Neutral +Q3,52,Neutral +Q3,53,Neutral +Q3,54,Disagree +Q3,55,Agree +Q3,56,Neutral +Q3,57,Neutral +Q3,58,Strongly Disagree +Q3,59,Agree +Q3,60,Strongly Disagree +Q3,61,Disagree +Q3,62,Neutral +Q3,63,Agree +Q3,64,Neutral +Q3,65,Neutral +Q3,66,Neutral +Q3,67,Disagree +Q3,68,Neutral +Q3,69,Strongly Agree +Q3,70,Neutral +Q3,71,Strongly Disagree +Q3,72,Neutral +Q3,73,Neutral +Q3,74,Neutral +Q3,75,Agree +Q3,76,Neutral +Q3,77,Agree +Q3,78,Strongly Agree +Q3,79,Strongly Agree +Q3,80,Agree +Q3,81,Neutral +Q3,82,Strongly Agree +Q3,83,Neutral +Q3,84,Strongly Agree +Q3,85,Agree +Q3,86,Neutral +Q3,87,Neutral +Q3,88,Strongly Agree +Q3,89,Agree +Q3,90,Neutral +Q3,91,Neutral +Q3,92,Neutral +Q3,93,Neutral +Q3,94,Neutral +Q3,95,Agree +Q3,96,Neutral +Q3,97,Strongly Agree +Q3,98,Strongly Agree +Q3,99,Strongly Agree +Q3,100,Strongly Disagree +Q3,101,Strongly Agree +Q3,102,Strongly Agree +Q4,0,Neutral +Q4,1,Disagree +Q4,2,Disagree +Q4,3,Neutral +Q4,4,Strongly Agree +Q4,5,Disagree +Q4,6,Disagree +Q4,7,Disagree +Q4,8,Neutral +Q4,9,Disagree +Q4,10,Disagree +Q4,11,Neutral +Q4,12,Neutral +Q4,13,Disagree +Q4,14,Neutral +Q4,15,Disagree +Q4,16,Neutral +Q4,17,Disagree +Q4,18,Neutral +Q4,19,Disagree +Q4,20,Neutral +Q4,21,Disagree +Q4,22,Strongly Disagree +Q4,23,Disagree +Q4,24,Strongly Agree +Q4,25,Neutral +Q4,26,Strongly Agree +Q4,27,Strongly Agree +Q4,28,Strongly Agree +Q4,29,Strongly Agree +Q4,30,Disagree +Q4,31,Agree +Q4,32,Neutral +Q4,33,Neutral +Q4,34,Disagree +Q4,35,Disagree +Q4,36,Neutral +Q4,37,Disagree +Q4,38,Disagree +Q4,39,Disagree +Q4,40,Agree +Q4,41,Disagree +Q4,42,Disagree +Q4,43,Disagree +Q4,44,Strongly Agree +Q4,45,Strongly Agree +Q4,46,Disagree +Q4,47,Disagree +Q4,48,Disagree +Q4,49,Disagree +Q4,50,Disagree +Q4,51,Disagree +Q4,52,Disagree +Q4,53,Neutral +Q4,54,Disagree +Q4,55,Strongly Disagree +Q4,56,Disagree +Q4,57,Disagree +Q4,58,Disagree +Q4,59,Strongly Disagree +Q4,60,Neutral +Q4,61,Disagree +Q4,62,Strongly Disagree +Q4,63,Strongly Agree +Q4,64,Strongly Agree +Q4,65,Neutral +Q4,66,Strongly Agree +Q4,67,Disagree +Q4,68,Disagree +Q4,69,Disagree +Q4,70,Agree +Q4,71,Strongly Agree +Q4,72,Strongly Agree +Q4,73,Strongly Disagree +Q4,74,Disagree +Q4,75,Neutral +Q4,76,Agree +Q4,77,Disagree +Q4,78,Neutral +Q4,79,Disagree +Q4,80,Disagree +Q4,81,Disagree +Q4,82,Strongly Agree +Q4,83,Strongly Disagree +Q4,84,Strongly Agree +Q4,85,Disagree +Q4,86,Strongly Agree +Q4,87,Disagree +Q4,88,Neutral +Q4,89,Neutral +Q4,90,Disagree +Q4,91,Disagree +Q4,92,Disagree +Q4,93,Strongly Agree +Q4,94,Agree +Q4,95,Neutral +Q4,96,Disagree +Q4,97,Disagree +Q4,98,Disagree +Q4,99,Disagree +Q5,0,Disagree +Q5,1,Neutral +Q5,2,Strongly Agree +Q5,3,Strongly Agree +Q5,4,Neutral +Q5,5,Strongly Disagree +Q5,6,Strongly Agree +Q5,7,Strongly Agree +Q5,8,Neutral +Q5,9,Strongly Disagree +Q5,10,Agree +Q5,11,Agree +Q5,12,Strongly Disagree +Q5,13,Strongly Disagree +Q5,14,Strongly Disagree +Q5,15,Disagree +Q5,16,Neutral +Q5,17,Strongly Disagree +Q5,18,Neutral +Q5,19,Neutral +Q5,20,Strongly Agree +Q5,21,Disagree +Q5,22,Agree +Q5,23,Strongly Agree +Q5,24,Strongly Agree +Q5,25,Strongly Agree +Q5,26,Strongly Agree +Q5,27,Neutral +Q5,28,Disagree +Q5,29,Strongly Agree +Q5,30,Neutral +Q5,31,Strongly Agree +Q5,32,Strongly Agree +Q5,33,Agree +Q5,34,Strongly Agree +Q5,35,Strongly Agree +Q5,36,Agree +Q5,37,Strongly Agree +Q5,38,Disagree +Q5,39,Strongly Agree +Q5,40,Strongly Agree +Q5,41,Agree +Q5,42,Strongly Agree +Q5,43,Neutral +Q5,44,Agree +Q5,45,Agree +Q5,46,Strongly Agree +Q5,47,Agree +Q5,48,Agree +Q5,49,Strongly Agree +Q5,50,Strongly Agree +Q5,51,Disagree +Q5,52,Neutral +Q5,53,Neutral +Q5,54,Strongly Agree +Q5,55,Disagree +Q5,56,Neutral +Q5,57,Neutral +Q5,58,Strongly Disagree +Q5,59,Disagree +Q5,60,Strongly Agree +Q5,61,Strongly Agree +Q5,62,Strongly Agree +Q5,63,Strongly Agree +Q5,64,Strongly Agree +Q5,65,Strongly Agree +Q5,66,Strongly Disagree +Q5,67,Strongly Agree +Q5,68,Strongly Agree +Q5,69,Agree +Q5,70,Strongly Agree +Q5,71,Agree +Q5,72,Strongly Agree +Q5,73,Agree +Q5,74,Strongly Agree +Q5,75,Agree +Q5,76,Strongly Agree +Q5,77,Neutral +Q5,78,Neutral +Q5,79,Disagree +Q5,80,Strongly Disagree +Q5,81,Agree +Q5,82,Neutral +Q5,83,Strongly Agree +Q5,84,Strongly Agree +Q5,85,Agree +Q5,86,Strongly Disagree +Q5,87,Neutral +Q5,88,Strongly Agree +Q5,89,Strongly Agree +Q5,90,Agree +Q5,91,Disagree +Q5,92,Neutral +Q5,93,Neutral +Q5,94,Neutral +Q5,95,Strongly Disagree +Q5,96,Disagree +Q5,97,Neutral +Q5,98,Strongly Agree +Q5,99,Strongly Agree +Q5,100,Disagree diff --git a/test/data/survey.json b/test/data/survey.json deleted file mode 100644 index 9d57c035f5..0000000000 --- a/test/data/survey.json +++ /dev/null @@ -1 +0,0 @@ -[{"Question":"Q1","ID":0,"Response":"Agree"},{"Question":"Q1","ID":1,"Response":"Agree"},{"Question":"Q1","ID":2,"Response":"Agree"},{"Question":"Q1","ID":3,"Response":"Neutral"},{"Question":"Q1","ID":4,"Response":"Strongly Disagree"},{"Question":"Q1","ID":5,"Response":"Neutral"},{"Question":"Q1","ID":6,"Response":"Strongly Disagree"},{"Question":"Q1","ID":7,"Response":"Strongly Agree"},{"Question":"Q1","ID":8,"Response":"Neutral"},{"Question":"Q1","ID":9,"Response":"Neutral"},{"Question":"Q1","ID":10,"Response":"Neutral"},{"Question":"Q1","ID":11,"Response":"Agree"},{"Question":"Q1","ID":12,"Response":"Strongly Agree"},{"Question":"Q1","ID":13,"Response":"Strongly Agree"},{"Question":"Q1","ID":14,"Response":"Neutral"},{"Question":"Q1","ID":15,"Response":"Strongly Agree"},{"Question":"Q1","ID":16,"Response":"Disagree"},{"Question":"Q1","ID":17,"Response":"Agree"},{"Question":"Q1","ID":18,"Response":"Agree"},{"Question":"Q1","ID":19,"Response":"Neutral"},{"Question":"Q1","ID":20,"Response":"Strongly Agree"},{"Question":"Q1","ID":21,"Response":"Neutral"},{"Question":"Q1","ID":22,"Response":"Strongly Agree"},{"Question":"Q1","ID":23,"Response":"Neutral"},{"Question":"Q1","ID":24,"Response":"Strongly Disagree"},{"Question":"Q1","ID":25,"Response":"Neutral"},{"Question":"Q1","ID":26,"Response":"Strongly Agree"},{"Question":"Q1","ID":27,"Response":"Disagree"},{"Question":"Q1","ID":28,"Response":"Strongly Agree"},{"Question":"Q1","ID":29,"Response":"Agree"},{"Question":"Q1","ID":30,"Response":"Neutral"},{"Question":"Q1","ID":31,"Response":"Neutral"},{"Question":"Q1","ID":32,"Response":"Strongly Agree"},{"Question":"Q1","ID":33,"Response":"Strongly Agree"},{"Question":"Q1","ID":34,"Response":"Agree"},{"Question":"Q1","ID":35,"Response":"Disagree"},{"Question":"Q1","ID":36,"Response":"Disagree"},{"Question":"Q1","ID":37,"Response":"Neutral"},{"Question":"Q1","ID":38,"Response":"Neutral"},{"Question":"Q1","ID":39,"Response":"Agree"},{"Question":"Q1","ID":40,"Response":"Strongly Agree"},{"Question":"Q1","ID":41,"Response":"Disagree"},{"Question":"Q1","ID":42,"Response":"Neutral"},{"Question":"Q1","ID":43,"Response":"Neutral"},{"Question":"Q1","ID":44,"Response":"Neutral"},{"Question":"Q1","ID":45,"Response":"Neutral"},{"Question":"Q1","ID":46,"Response":"Neutral"},{"Question":"Q1","ID":47,"Response":"Strongly Disagree"},{"Question":"Q1","ID":48,"Response":"Disagree"},{"Question":"Q1","ID":49,"Response":"Strongly Disagree"},{"Question":"Q1","ID":50,"Response":"Agree"},{"Question":"Q1","ID":51,"Response":"Disagree"},{"Question":"Q1","ID":52,"Response":"Neutral"},{"Question":"Q1","ID":53,"Response":"Neutral"},{"Question":"Q1","ID":54,"Response":"Disagree"},{"Question":"Q1","ID":55,"Response":"Neutral"},{"Question":"Q1","ID":56,"Response":"Strongly Disagree"},{"Question":"Q1","ID":57,"Response":"Strongly Agree"},{"Question":"Q1","ID":58,"Response":"Disagree"},{"Question":"Q1","ID":59,"Response":"Neutral"},{"Question":"Q1","ID":60,"Response":"Strongly Agree"},{"Question":"Q1","ID":61,"Response":"Neutral"},{"Question":"Q1","ID":62,"Response":"Strongly Agree"},{"Question":"Q1","ID":63,"Response":"Disagree"},{"Question":"Q1","ID":64,"Response":"Neutral"},{"Question":"Q1","ID":65,"Response":"Neutral"},{"Question":"Q1","ID":66,"Response":"Strongly Agree"},{"Question":"Q1","ID":67,"Response":"Neutral"},{"Question":"Q1","ID":68,"Response":"Neutral"},{"Question":"Q1","ID":69,"Response":"Agree"},{"Question":"Q1","ID":70,"Response":"Neutral"},{"Question":"Q1","ID":71,"Response":"Neutral"},{"Question":"Q1","ID":72,"Response":"Neutral"},{"Question":"Q1","ID":73,"Response":"Strongly Agree"},{"Question":"Q1","ID":74,"Response":"Agree"},{"Question":"Q1","ID":75,"Response":"Neutral"},{"Question":"Q1","ID":76,"Response":"Disagree"},{"Question":"Q1","ID":77,"Response":"Agree"},{"Question":"Q1","ID":78,"Response":"Disagree"},{"Question":"Q1","ID":79,"Response":"Strongly Agree"},{"Question":"Q1","ID":80,"Response":"Strongly Disagree"},{"Question":"Q1","ID":81,"Response":"Agree"},{"Question":"Q1","ID":82,"Response":"Agree"},{"Question":"Q1","ID":83,"Response":"Agree"},{"Question":"Q1","ID":84,"Response":"Disagree"},{"Question":"Q1","ID":85,"Response":"Strongly Agree"},{"Question":"Q1","ID":86,"Response":"Neutral"},{"Question":"Q1","ID":87,"Response":"Disagree"},{"Question":"Q1","ID":88,"Response":"Strongly Disagree"},{"Question":"Q1","ID":89,"Response":"Strongly Disagree"},{"Question":"Q1","ID":90,"Response":"Agree"},{"Question":"Q1","ID":91,"Response":"Neutral"},{"Question":"Q1","ID":92,"Response":"Neutral"},{"Question":"Q1","ID":93,"Response":"Strongly Agree"},{"Question":"Q1","ID":94,"Response":"Neutral"},{"Question":"Q1","ID":95,"Response":"Strongly Agree"},{"Question":"Q1","ID":96,"Response":"Neutral"},{"Question":"Q1","ID":97,"Response":"Strongly Agree"},{"Question":"Q1","ID":98,"Response":"Strongly Disagree"},{"Question":"Q1","ID":99,"Response":"Disagree"},{"Question":"Q1","ID":100,"Response":"Agree"},{"Question":"Q2","ID":0,"Response":"Neutral"},{"Question":"Q2","ID":1,"Response":"Agree"},{"Question":"Q2","ID":2,"Response":"Agree"},{"Question":"Q2","ID":3,"Response":"Agree"},{"Question":"Q2","ID":4,"Response":"Neutral"},{"Question":"Q2","ID":5,"Response":"Neutral"},{"Question":"Q2","ID":6,"Response":"Neutral"},{"Question":"Q2","ID":7,"Response":"Neutral"},{"Question":"Q2","ID":8,"Response":"Agree"},{"Question":"Q2","ID":9,"Response":"Neutral"},{"Question":"Q2","ID":10,"Response":"Strongly Disagree"},{"Question":"Q2","ID":11,"Response":"Agree"},{"Question":"Q2","ID":12,"Response":"Strongly Agree"},{"Question":"Q2","ID":13,"Response":"Agree"},{"Question":"Q2","ID":14,"Response":"Neutral"},{"Question":"Q2","ID":15,"Response":"Disagree"},{"Question":"Q2","ID":16,"Response":"Neutral"},{"Question":"Q2","ID":17,"Response":"Neutral"},{"Question":"Q2","ID":18,"Response":"Agree"},{"Question":"Q2","ID":19,"Response":"Strongly Agree"},{"Question":"Q2","ID":20,"Response":"Strongly Agree"},{"Question":"Q2","ID":21,"Response":"Agree"},{"Question":"Q2","ID":22,"Response":"Strongly Agree"},{"Question":"Q2","ID":23,"Response":"Neutral"},{"Question":"Q2","ID":24,"Response":"Strongly Disagree"},{"Question":"Q2","ID":25,"Response":"Neutral"},{"Question":"Q2","ID":26,"Response":"Strongly Disagree"},{"Question":"Q2","ID":27,"Response":"Disagree"},{"Question":"Q2","ID":28,"Response":"Neutral"},{"Question":"Q2","ID":29,"Response":"Neutral"},{"Question":"Q2","ID":30,"Response":"Agree"},{"Question":"Q2","ID":31,"Response":"Agree"},{"Question":"Q2","ID":32,"Response":"Agree"},{"Question":"Q2","ID":33,"Response":"Strongly Disagree"},{"Question":"Q2","ID":34,"Response":"Strongly Agree"},{"Question":"Q2","ID":35,"Response":"Agree"},{"Question":"Q2","ID":36,"Response":"Strongly Disagree"},{"Question":"Q2","ID":37,"Response":"Strongly Agree"},{"Question":"Q2","ID":38,"Response":"Neutral"},{"Question":"Q2","ID":39,"Response":"Strongly Agree"},{"Question":"Q2","ID":40,"Response":"Disagree"},{"Question":"Q2","ID":41,"Response":"Agree"},{"Question":"Q2","ID":42,"Response":"Strongly Disagree"},{"Question":"Q2","ID":43,"Response":"Strongly Disagree"},{"Question":"Q2","ID":44,"Response":"Agree"},{"Question":"Q2","ID":45,"Response":"Strongly Agree"},{"Question":"Q2","ID":46,"Response":"Strongly Agree"},{"Question":"Q2","ID":47,"Response":"Neutral"},{"Question":"Q2","ID":48,"Response":"Neutral"},{"Question":"Q2","ID":49,"Response":"Neutral"},{"Question":"Q2","ID":50,"Response":"Strongly Disagree"},{"Question":"Q2","ID":51,"Response":"Strongly Disagree"},{"Question":"Q2","ID":52,"Response":"Agree"},{"Question":"Q2","ID":53,"Response":"Agree"},{"Question":"Q2","ID":54,"Response":"Neutral"},{"Question":"Q2","ID":55,"Response":"Neutral"},{"Question":"Q2","ID":56,"Response":"Agree"},{"Question":"Q2","ID":57,"Response":"Strongly Disagree"},{"Question":"Q2","ID":58,"Response":"Strongly Disagree"},{"Question":"Q2","ID":59,"Response":"Neutral"},{"Question":"Q2","ID":60,"Response":"Strongly Agree"},{"Question":"Q2","ID":61,"Response":"Agree"},{"Question":"Q2","ID":62,"Response":"Strongly Disagree"},{"Question":"Q2","ID":63,"Response":"Agree"},{"Question":"Q2","ID":64,"Response":"Agree"},{"Question":"Q2","ID":65,"Response":"Agree"},{"Question":"Q2","ID":66,"Response":"Agree"},{"Question":"Q2","ID":67,"Response":"Neutral"},{"Question":"Q2","ID":68,"Response":"Neutral"},{"Question":"Q2","ID":69,"Response":"Strongly Disagree"},{"Question":"Q2","ID":70,"Response":"Disagree"},{"Question":"Q2","ID":71,"Response":"Strongly Disagree"},{"Question":"Q2","ID":72,"Response":"Strongly Disagree"},{"Question":"Q2","ID":73,"Response":"Strongly Disagree"},{"Question":"Q2","ID":74,"Response":"Strongly Disagree"},{"Question":"Q2","ID":75,"Response":"Strongly Disagree"},{"Question":"Q2","ID":76,"Response":"Neutral"},{"Question":"Q2","ID":77,"Response":"Strongly Agree"},{"Question":"Q2","ID":78,"Response":"Neutral"},{"Question":"Q2","ID":79,"Response":"Strongly Disagree"},{"Question":"Q2","ID":80,"Response":"Agree"},{"Question":"Q2","ID":81,"Response":"Agree"},{"Question":"Q2","ID":82,"Response":"Strongly Agree"},{"Question":"Q2","ID":83,"Response":"Agree"},{"Question":"Q2","ID":84,"Response":"Strongly Disagree"},{"Question":"Q2","ID":85,"Response":"Disagree"},{"Question":"Q2","ID":86,"Response":"Strongly Disagree"},{"Question":"Q2","ID":87,"Response":"Agree"},{"Question":"Q2","ID":88,"Response":"Neutral"},{"Question":"Q2","ID":89,"Response":"Strongly Disagree"},{"Question":"Q2","ID":90,"Response":"Neutral"},{"Question":"Q2","ID":91,"Response":"Agree"},{"Question":"Q2","ID":92,"Response":"Strongly Disagree"},{"Question":"Q2","ID":93,"Response":"Neutral"},{"Question":"Q2","ID":94,"Response":"Neutral"},{"Question":"Q3","ID":0,"Response":"Neutral"},{"Question":"Q3","ID":1,"Response":"Agree"},{"Question":"Q3","ID":2,"Response":"Disagree"},{"Question":"Q3","ID":3,"Response":"Agree"},{"Question":"Q3","ID":4,"Response":"Neutral"},{"Question":"Q3","ID":5,"Response":"Agree"},{"Question":"Q3","ID":6,"Response":"Neutral"},{"Question":"Q3","ID":7,"Response":"Agree"},{"Question":"Q3","ID":8,"Response":"Agree"},{"Question":"Q3","ID":9,"Response":"Neutral"},{"Question":"Q3","ID":10,"Response":"Neutral"},{"Question":"Q3","ID":11,"Response":"Neutral"},{"Question":"Q3","ID":12,"Response":"Neutral"},{"Question":"Q3","ID":13,"Response":"Neutral"},{"Question":"Q3","ID":14,"Response":"Strongly Disagree"},{"Question":"Q3","ID":15,"Response":"Strongly Agree"},{"Question":"Q3","ID":16,"Response":"Neutral"},{"Question":"Q3","ID":17,"Response":"Neutral"},{"Question":"Q3","ID":18,"Response":"Strongly Agree"},{"Question":"Q3","ID":19,"Response":"Neutral"},{"Question":"Q3","ID":20,"Response":"Agree"},{"Question":"Q3","ID":21,"Response":"Neutral"},{"Question":"Q3","ID":22,"Response":"Disagree"},{"Question":"Q3","ID":23,"Response":"Neutral"},{"Question":"Q3","ID":24,"Response":"Neutral"},{"Question":"Q3","ID":25,"Response":"Strongly Disagree"},{"Question":"Q3","ID":26,"Response":"Strongly Disagree"},{"Question":"Q3","ID":27,"Response":"Agree"},{"Question":"Q3","ID":28,"Response":"Disagree"},{"Question":"Q3","ID":29,"Response":"Agree"},{"Question":"Q3","ID":30,"Response":"Neutral"},{"Question":"Q3","ID":31,"Response":"Neutral"},{"Question":"Q3","ID":32,"Response":"Agree"},{"Question":"Q3","ID":33,"Response":"Neutral"},{"Question":"Q3","ID":34,"Response":"Strongly Agree"},{"Question":"Q3","ID":35,"Response":"Neutral"},{"Question":"Q3","ID":36,"Response":"Strongly Disagree"},{"Question":"Q3","ID":37,"Response":"Strongly Agree"},{"Question":"Q3","ID":38,"Response":"Neutral"},{"Question":"Q3","ID":39,"Response":"Disagree"},{"Question":"Q3","ID":40,"Response":"Neutral"},{"Question":"Q3","ID":41,"Response":"Neutral"},{"Question":"Q3","ID":42,"Response":"Agree"},{"Question":"Q3","ID":43,"Response":"Neutral"},{"Question":"Q3","ID":44,"Response":"Neutral"},{"Question":"Q3","ID":45,"Response":"Neutral"},{"Question":"Q3","ID":46,"Response":"Agree"},{"Question":"Q3","ID":47,"Response":"Agree"},{"Question":"Q3","ID":48,"Response":"Strongly Agree"},{"Question":"Q3","ID":49,"Response":"Strongly Agree"},{"Question":"Q3","ID":50,"Response":"Agree"},{"Question":"Q3","ID":51,"Response":"Neutral"},{"Question":"Q3","ID":52,"Response":"Neutral"},{"Question":"Q3","ID":53,"Response":"Neutral"},{"Question":"Q3","ID":54,"Response":"Disagree"},{"Question":"Q3","ID":55,"Response":"Agree"},{"Question":"Q3","ID":56,"Response":"Neutral"},{"Question":"Q3","ID":57,"Response":"Neutral"},{"Question":"Q3","ID":58,"Response":"Strongly Disagree"},{"Question":"Q3","ID":59,"Response":"Agree"},{"Question":"Q3","ID":60,"Response":"Strongly Disagree"},{"Question":"Q3","ID":61,"Response":"Disagree"},{"Question":"Q3","ID":62,"Response":"Neutral"},{"Question":"Q3","ID":63,"Response":"Agree"},{"Question":"Q3","ID":64,"Response":"Neutral"},{"Question":"Q3","ID":65,"Response":"Neutral"},{"Question":"Q3","ID":66,"Response":"Neutral"},{"Question":"Q3","ID":67,"Response":"Disagree"},{"Question":"Q3","ID":68,"Response":"Neutral"},{"Question":"Q3","ID":69,"Response":"Strongly Agree"},{"Question":"Q3","ID":70,"Response":"Neutral"},{"Question":"Q3","ID":71,"Response":"Strongly Disagree"},{"Question":"Q3","ID":72,"Response":"Neutral"},{"Question":"Q3","ID":73,"Response":"Neutral"},{"Question":"Q3","ID":74,"Response":"Neutral"},{"Question":"Q3","ID":75,"Response":"Agree"},{"Question":"Q3","ID":76,"Response":"Neutral"},{"Question":"Q3","ID":77,"Response":"Agree"},{"Question":"Q3","ID":78,"Response":"Strongly Agree"},{"Question":"Q3","ID":79,"Response":"Strongly Agree"},{"Question":"Q3","ID":80,"Response":"Agree"},{"Question":"Q3","ID":81,"Response":"Neutral"},{"Question":"Q3","ID":82,"Response":"Strongly Agree"},{"Question":"Q3","ID":83,"Response":"Neutral"},{"Question":"Q3","ID":84,"Response":"Strongly Agree"},{"Question":"Q3","ID":85,"Response":"Agree"},{"Question":"Q3","ID":86,"Response":"Neutral"},{"Question":"Q3","ID":87,"Response":"Neutral"},{"Question":"Q3","ID":88,"Response":"Strongly Agree"},{"Question":"Q3","ID":89,"Response":"Agree"},{"Question":"Q3","ID":90,"Response":"Neutral"},{"Question":"Q3","ID":91,"Response":"Neutral"},{"Question":"Q3","ID":92,"Response":"Neutral"},{"Question":"Q3","ID":93,"Response":"Neutral"},{"Question":"Q3","ID":94,"Response":"Neutral"},{"Question":"Q3","ID":95,"Response":"Agree"},{"Question":"Q3","ID":96,"Response":"Neutral"},{"Question":"Q3","ID":97,"Response":"Strongly Agree"},{"Question":"Q3","ID":98,"Response":"Strongly Agree"},{"Question":"Q3","ID":99,"Response":"Strongly Agree"},{"Question":"Q3","ID":100,"Response":"Strongly Disagree"},{"Question":"Q3","ID":101,"Response":"Strongly Agree"},{"Question":"Q3","ID":102,"Response":"Strongly Agree"},{"Question":"Q4","ID":0,"Response":"Neutral"},{"Question":"Q4","ID":1,"Response":"Disagree"},{"Question":"Q4","ID":2,"Response":"Disagree"},{"Question":"Q4","ID":3,"Response":"Neutral"},{"Question":"Q4","ID":4,"Response":"Strongly Agree"},{"Question":"Q4","ID":5,"Response":"Disagree"},{"Question":"Q4","ID":6,"Response":"Disagree"},{"Question":"Q4","ID":7,"Response":"Disagree"},{"Question":"Q4","ID":8,"Response":"Neutral"},{"Question":"Q4","ID":9,"Response":"Disagree"},{"Question":"Q4","ID":10,"Response":"Disagree"},{"Question":"Q4","ID":11,"Response":"Neutral"},{"Question":"Q4","ID":12,"Response":"Neutral"},{"Question":"Q4","ID":13,"Response":"Disagree"},{"Question":"Q4","ID":14,"Response":"Neutral"},{"Question":"Q4","ID":15,"Response":"Disagree"},{"Question":"Q4","ID":16,"Response":"Neutral"},{"Question":"Q4","ID":17,"Response":"Disagree"},{"Question":"Q4","ID":18,"Response":"Neutral"},{"Question":"Q4","ID":19,"Response":"Disagree"},{"Question":"Q4","ID":20,"Response":"Neutral"},{"Question":"Q4","ID":21,"Response":"Disagree"},{"Question":"Q4","ID":22,"Response":"Strongly Disagree"},{"Question":"Q4","ID":23,"Response":"Disagree"},{"Question":"Q4","ID":24,"Response":"Strongly Agree"},{"Question":"Q4","ID":25,"Response":"Neutral"},{"Question":"Q4","ID":26,"Response":"Strongly Agree"},{"Question":"Q4","ID":27,"Response":"Strongly Agree"},{"Question":"Q4","ID":28,"Response":"Strongly Agree"},{"Question":"Q4","ID":29,"Response":"Strongly Agree"},{"Question":"Q4","ID":30,"Response":"Disagree"},{"Question":"Q4","ID":31,"Response":"Agree"},{"Question":"Q4","ID":32,"Response":"Neutral"},{"Question":"Q4","ID":33,"Response":"Neutral"},{"Question":"Q4","ID":34,"Response":"Disagree"},{"Question":"Q4","ID":35,"Response":"Disagree"},{"Question":"Q4","ID":36,"Response":"Neutral"},{"Question":"Q4","ID":37,"Response":"Disagree"},{"Question":"Q4","ID":38,"Response":"Disagree"},{"Question":"Q4","ID":39,"Response":"Disagree"},{"Question":"Q4","ID":40,"Response":"Agree"},{"Question":"Q4","ID":41,"Response":"Disagree"},{"Question":"Q4","ID":42,"Response":"Disagree"},{"Question":"Q4","ID":43,"Response":"Disagree"},{"Question":"Q4","ID":44,"Response":"Strongly Agree"},{"Question":"Q4","ID":45,"Response":"Strongly Agree"},{"Question":"Q4","ID":46,"Response":"Disagree"},{"Question":"Q4","ID":47,"Response":"Disagree"},{"Question":"Q4","ID":48,"Response":"Disagree"},{"Question":"Q4","ID":49,"Response":"Disagree"},{"Question":"Q4","ID":50,"Response":"Disagree"},{"Question":"Q4","ID":51,"Response":"Disagree"},{"Question":"Q4","ID":52,"Response":"Disagree"},{"Question":"Q4","ID":53,"Response":"Neutral"},{"Question":"Q4","ID":54,"Response":"Disagree"},{"Question":"Q4","ID":55,"Response":"Strongly Disagree"},{"Question":"Q4","ID":56,"Response":"Disagree"},{"Question":"Q4","ID":57,"Response":"Disagree"},{"Question":"Q4","ID":58,"Response":"Disagree"},{"Question":"Q4","ID":59,"Response":"Strongly Disagree"},{"Question":"Q4","ID":60,"Response":"Neutral"},{"Question":"Q4","ID":61,"Response":"Disagree"},{"Question":"Q4","ID":62,"Response":"Strongly Disagree"},{"Question":"Q4","ID":63,"Response":"Strongly Agree"},{"Question":"Q4","ID":64,"Response":"Strongly Agree"},{"Question":"Q4","ID":65,"Response":"Neutral"},{"Question":"Q4","ID":66,"Response":"Strongly Agree"},{"Question":"Q4","ID":67,"Response":"Disagree"},{"Question":"Q4","ID":68,"Response":"Disagree"},{"Question":"Q4","ID":69,"Response":"Disagree"},{"Question":"Q4","ID":70,"Response":"Agree"},{"Question":"Q4","ID":71,"Response":"Strongly Agree"},{"Question":"Q4","ID":72,"Response":"Strongly Agree"},{"Question":"Q4","ID":73,"Response":"Strongly Disagree"},{"Question":"Q4","ID":74,"Response":"Disagree"},{"Question":"Q4","ID":75,"Response":"Neutral"},{"Question":"Q4","ID":76,"Response":"Agree"},{"Question":"Q4","ID":77,"Response":"Disagree"},{"Question":"Q4","ID":78,"Response":"Neutral"},{"Question":"Q4","ID":79,"Response":"Disagree"},{"Question":"Q4","ID":80,"Response":"Disagree"},{"Question":"Q4","ID":81,"Response":"Disagree"},{"Question":"Q4","ID":82,"Response":"Strongly Agree"},{"Question":"Q4","ID":83,"Response":"Strongly Disagree"},{"Question":"Q4","ID":84,"Response":"Strongly Agree"},{"Question":"Q4","ID":85,"Response":"Disagree"},{"Question":"Q4","ID":86,"Response":"Strongly Agree"},{"Question":"Q4","ID":87,"Response":"Disagree"},{"Question":"Q4","ID":88,"Response":"Neutral"},{"Question":"Q4","ID":89,"Response":"Neutral"},{"Question":"Q4","ID":90,"Response":"Disagree"},{"Question":"Q4","ID":91,"Response":"Disagree"},{"Question":"Q4","ID":92,"Response":"Disagree"},{"Question":"Q4","ID":93,"Response":"Strongly Agree"},{"Question":"Q4","ID":94,"Response":"Agree"},{"Question":"Q4","ID":95,"Response":"Neutral"},{"Question":"Q4","ID":96,"Response":"Disagree"},{"Question":"Q4","ID":97,"Response":"Disagree"},{"Question":"Q4","ID":98,"Response":"Disagree"},{"Question":"Q4","ID":99,"Response":"Disagree"},{"Question":"Q5","ID":0,"Response":"Disagree"},{"Question":"Q5","ID":1,"Response":"Neutral"},{"Question":"Q5","ID":2,"Response":"Strongly Agree"},{"Question":"Q5","ID":3,"Response":"Strongly Agree"},{"Question":"Q5","ID":4,"Response":"Neutral"},{"Question":"Q5","ID":5,"Response":"Strongly Disagree"},{"Question":"Q5","ID":6,"Response":"Strongly Agree"},{"Question":"Q5","ID":7,"Response":"Strongly Agree"},{"Question":"Q5","ID":8,"Response":"Neutral"},{"Question":"Q5","ID":9,"Response":"Strongly Disagree"},{"Question":"Q5","ID":10,"Response":"Agree"},{"Question":"Q5","ID":11,"Response":"Agree"},{"Question":"Q5","ID":12,"Response":"Strongly Disagree"},{"Question":"Q5","ID":13,"Response":"Strongly Disagree"},{"Question":"Q5","ID":14,"Response":"Strongly Disagree"},{"Question":"Q5","ID":15,"Response":"Disagree"},{"Question":"Q5","ID":16,"Response":"Neutral"},{"Question":"Q5","ID":17,"Response":"Strongly Disagree"},{"Question":"Q5","ID":18,"Response":"Neutral"},{"Question":"Q5","ID":19,"Response":"Neutral"},{"Question":"Q5","ID":20,"Response":"Strongly Agree"},{"Question":"Q5","ID":21,"Response":"Disagree"},{"Question":"Q5","ID":22,"Response":"Agree"},{"Question":"Q5","ID":23,"Response":"Strongly Agree"},{"Question":"Q5","ID":24,"Response":"Strongly Agree"},{"Question":"Q5","ID":25,"Response":"Strongly Agree"},{"Question":"Q5","ID":26,"Response":"Strongly Agree"},{"Question":"Q5","ID":27,"Response":"Neutral"},{"Question":"Q5","ID":28,"Response":"Disagree"},{"Question":"Q5","ID":29,"Response":"Strongly Agree"},{"Question":"Q5","ID":30,"Response":"Neutral"},{"Question":"Q5","ID":31,"Response":"Strongly Agree"},{"Question":"Q5","ID":32,"Response":"Strongly Agree"},{"Question":"Q5","ID":33,"Response":"Agree"},{"Question":"Q5","ID":34,"Response":"Strongly Agree"},{"Question":"Q5","ID":35,"Response":"Strongly Agree"},{"Question":"Q5","ID":36,"Response":"Agree"},{"Question":"Q5","ID":37,"Response":"Strongly Agree"},{"Question":"Q5","ID":38,"Response":"Disagree"},{"Question":"Q5","ID":39,"Response":"Strongly Agree"},{"Question":"Q5","ID":40,"Response":"Strongly Agree"},{"Question":"Q5","ID":41,"Response":"Agree"},{"Question":"Q5","ID":42,"Response":"Strongly Agree"},{"Question":"Q5","ID":43,"Response":"Neutral"},{"Question":"Q5","ID":44,"Response":"Agree"},{"Question":"Q5","ID":45,"Response":"Agree"},{"Question":"Q5","ID":46,"Response":"Strongly Agree"},{"Question":"Q5","ID":47,"Response":"Agree"},{"Question":"Q5","ID":48,"Response":"Agree"},{"Question":"Q5","ID":49,"Response":"Strongly Agree"},{"Question":"Q5","ID":50,"Response":"Strongly Agree"},{"Question":"Q5","ID":51,"Response":"Disagree"},{"Question":"Q5","ID":52,"Response":"Neutral"},{"Question":"Q5","ID":53,"Response":"Neutral"},{"Question":"Q5","ID":54,"Response":"Strongly Agree"},{"Question":"Q5","ID":55,"Response":"Disagree"},{"Question":"Q5","ID":56,"Response":"Neutral"},{"Question":"Q5","ID":57,"Response":"Neutral"},{"Question":"Q5","ID":58,"Response":"Strongly Disagree"},{"Question":"Q5","ID":59,"Response":"Disagree"},{"Question":"Q5","ID":60,"Response":"Strongly Agree"},{"Question":"Q5","ID":61,"Response":"Strongly Agree"},{"Question":"Q5","ID":62,"Response":"Strongly Agree"},{"Question":"Q5","ID":63,"Response":"Strongly Agree"},{"Question":"Q5","ID":64,"Response":"Strongly Agree"},{"Question":"Q5","ID":65,"Response":"Strongly Agree"},{"Question":"Q5","ID":66,"Response":"Strongly Disagree"},{"Question":"Q5","ID":67,"Response":"Strongly Agree"},{"Question":"Q5","ID":68,"Response":"Strongly Agree"},{"Question":"Q5","ID":69,"Response":"Agree"},{"Question":"Q5","ID":70,"Response":"Strongly Agree"},{"Question":"Q5","ID":71,"Response":"Agree"},{"Question":"Q5","ID":72,"Response":"Strongly Agree"},{"Question":"Q5","ID":73,"Response":"Agree"},{"Question":"Q5","ID":74,"Response":"Strongly Agree"},{"Question":"Q5","ID":75,"Response":"Agree"},{"Question":"Q5","ID":76,"Response":"Strongly Agree"},{"Question":"Q5","ID":77,"Response":"Neutral"},{"Question":"Q5","ID":78,"Response":"Neutral"},{"Question":"Q5","ID":79,"Response":"Disagree"},{"Question":"Q5","ID":80,"Response":"Strongly Disagree"},{"Question":"Q5","ID":81,"Response":"Agree"},{"Question":"Q5","ID":82,"Response":"Neutral"},{"Question":"Q5","ID":83,"Response":"Strongly Agree"},{"Question":"Q5","ID":84,"Response":"Strongly Agree"},{"Question":"Q5","ID":85,"Response":"Agree"},{"Question":"Q5","ID":86,"Response":"Strongly Disagree"},{"Question":"Q5","ID":87,"Response":"Neutral"},{"Question":"Q5","ID":88,"Response":"Strongly Agree"},{"Question":"Q5","ID":89,"Response":"Strongly Agree"},{"Question":"Q5","ID":90,"Response":"Agree"},{"Question":"Q5","ID":91,"Response":"Disagree"},{"Question":"Q5","ID":92,"Response":"Neutral"},{"Question":"Q5","ID":93,"Response":"Neutral"},{"Question":"Q5","ID":94,"Response":"Neutral"},{"Question":"Q5","ID":95,"Response":"Strongly Disagree"},{"Question":"Q5","ID":96,"Response":"Disagree"},{"Question":"Q5","ID":97,"Response":"Neutral"},{"Question":"Q5","ID":98,"Response":"Strongly Agree"},{"Question":"Q5","ID":99,"Response":"Strongly Agree"},{"Question":"Q5","ID":100,"Response":"Disagree"}] \ No newline at end of file diff --git a/test/plots/likert-survey.js b/test/plots/likert-survey.js index 41f27a65c6..2c9a4794b4 100644 --- a/test/plots/likert-survey.js +++ b/test/plots/likert-survey.js @@ -20,7 +20,7 @@ function Likert(responses) { } export default async function() { - const survey = await d3.json("data/survey.json"); + const survey = await d3.csv("data/survey.csv"); const {order, offset} = Likert([ ["Strongly Disagree", -1], ["Disagree", -1], From 8cee30a970e01ef19697bf54853fdaa7823ba3e6 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Sat, 19 Mar 2022 10:03:48 -0700 Subject: [PATCH 6/6] dataset attribution --- test/data/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/data/README.md b/test/data/README.md index 42e2b43e69..21b6ad9cec 100644 --- a/test/data/README.md +++ b/test/data/README.md @@ -94,6 +94,10 @@ https://www.ncdc.noaa.gov/ IMDb/Todd W. Schneider https://data.world/data-society/the-simpsons-by-the-data +## survey.csv +Eitan Lees +https://talk.observablehq.com/t/diverging-stacked-bar-chart-in-plot/6028 + ## traffic.csv Moritz Klack https://observablehq.com/@moklick