From 7bff2db0dc71bc4c5bf34ea59d8e72e2849305c5 Mon Sep 17 00:00:00 2001 From: Bart Mesuere Date: Sat, 2 Jul 2016 18:21:00 +0200 Subject: [PATCH] extract Node class --- .jshintrc | 2 +- dist/unipept-visualizations.es5.js | 230 +++++++++++++++---------- dist/unipept-visualizations.es5.js.map | 2 +- dist/unipept-visualizations.js | 151 ++++++++-------- dist/unipept-visualizations.min.js | 2 +- src/node.js | 63 +++++++ src/treemap.js | 41 +---- src/treeview.js | 45 ++--- 8 files changed, 304 insertions(+), 232 deletions(-) create mode 100644 src/node.js diff --git a/.jshintrc b/.jshintrc index cb17f3d..a324ef2 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,5 @@ { - "predef": [ "module", "ZeroClipboard", "confirm", "requestAnimFrame", "self", "init_phylogram", "Newick", "indexedDB", "IDBKeyRange", "constructSelectionTree", "constructGenomeTable", "constructPancoreGraph", "constructSimMatrix", "constructMyGenomes", "downloadDataByForm", "d3", "html2canvas", "console", "_gaq", "delay", "stringHash", "logToGoogle", "info", "highlight", "error", "addCopy", "fullScreenApi", "triggerDownloadModal", "getReadableColorFor"], + "predef": [ "univis", "module", "ZeroClipboard", "confirm", "requestAnimFrame", "self", "init_phylogram", "Newick", "indexedDB", "IDBKeyRange", "constructSelectionTree", "constructGenomeTable", "constructPancoreGraph", "constructSimMatrix", "constructMyGenomes", "downloadDataByForm", "d3", "html2canvas", "console", "_gaq", "delay", "stringHash", "logToGoogle", "info", "highlight", "error", "addCopy", "fullScreenApi", "triggerDownloadModal", "getReadableColorFor"], "esversion": 6, diff --git a/dist/unipept-visualizations.es5.js b/dist/unipept-visualizations.es5.js index 18e5b8b..1354a8e 100644 --- a/dist/unipept-visualizations.es5.js +++ b/dist/unipept-visualizations.es5.js @@ -2,15 +2,106 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -/** - * Interactive treemap - */ +/*jshint -W079 */ +var univis = univis || {}; + +univis.Node = function () { + function Node() { + var node = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + _classCallCheck(this, Node); + + this.data = {}; + _extends(this, node); + } + + _createClass(Node, [{ + key: "setRecursiveProperty", + + + // sets a property for a node and all its children + value: function setRecursiveProperty(property, value) { + this[property] = value; + if (this.children) { + this.children.forEach(function (c) { + c.setRecursiveProperty(property, value); + }); + } else if (this._children) { + this._children.forEach(function (c) { + c.setRecursiveProperty(property, value); + }); + } + } + + // Returns true if a node is a leaf + + }, { + key: "isLeaf", + value: function isLeaf() { + return !this.children && !this._children || this.children && this.children.length === 0 || this._children && this._children.length === 0; + } + }, { + key: "getHeight", + value: function getHeight() { + if (this._height === undefined) { + if (this.isLeaf()) { + this._height = 0; + } else { + this._height = d3.max(this.children, function (c) { + return c.getHeight(); + }) + 1; + } + } + return this._height; + } + }, { + key: "getDepth", + value: function getDepth() { + if (this._depth === undefined) { + if (this.parent === undefined) { + this._depth = 0; + } else { + this._depth = this.parent.getDepth() + 1; + } + } + return this._depth; + } + }], [{ + key: "new", + value: function _new() { + var node = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + return new Node(node); + } + }, { + key: "createNode", + value: function createNode(node) { + var construct = arguments.length <= 1 || arguments[1] === undefined ? Node.new : arguments[1]; + + if (node.children) { + node.children = node.children.map(function (n) { + return Node.createNode(n, construct); + }); + } + return construct.call(null, node); + } + }]); + + return Node; +}(); +; /** + * Interactive treemap + */ (function () { var TreeMap = function TreeMap(element, data) { var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; @@ -73,7 +164,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons function init() { settings = _extends({}, DEFAULTS, options); - root = Node.createNode(data); + root = TreemapNode.createNode(data); settings.width = settings.width - MARGIN.right - MARGIN.left; settings.height = settings.height - MARGIN.top - MARGIN.bottom; @@ -244,58 +335,31 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114; } - var Node = function () { - function Node() { - _classCallCheck(this, Node); + var TreemapNode = function (_univis$Node) { + _inherits(TreemapNode, _univis$Node); - this.data = {}; + function TreemapNode() { + _classCallCheck(this, TreemapNode); + + return _possibleConstructorReturn(this, Object.getPrototypeOf(TreemapNode).apply(this, arguments)); } - _createClass(Node, [{ - key: "getHeight", - value: function getHeight() { - if (this._height === undefined) { - if (this.isLeaf()) { - this._height = 0; - } else { - this._height = d3.max(this.children, function (c) { - return c.getHeight(); - }) + 1; - } - } - return this._height; - } - }, { - key: "getDepth", - value: function getDepth() { - if (this._depth === undefined) { - if (this.parent === undefined) { - this._depth = 0; - } else { - this._depth = this.parent.getDepth() + 1; - } - } - return this._depth; + _createClass(TreemapNode, null, [{ + key: "new", + value: function _new() { + var node = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + return new TreemapNode(node); } }, { - key: "isLeaf", - value: function isLeaf() { - return !this.children && !this._children || this.children && this.children.length === 0 || this._children && this._children.length === 0; - } - }], [{ key: "createNode", value: function createNode(node) { - if (node.children) { - node.children = node.children.map(function (n) { - return Node.createNode(n); - }); - } - return _extends(new Node(), node); + return univis.Node.createNode(node, TreemapNode.new); } }]); - return Node; - }(); + return TreemapNode; + }(univis.Node); /*************** Public methods ***************/ /** @@ -455,7 +519,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons svg = d3.select(element).append("svg").attr("version", "1.1").attr("xmlns", "http://www.w3.org/2000/svg").attr("viewBox", "0 0 " + (settings.width + MARGIN.right + MARGIN.left) + " " + (settings.height + MARGIN.top + MARGIN.bottom)).attr("width", settings.width + MARGIN.right + MARGIN.left).attr("height", settings.height + MARGIN.top + MARGIN.bottom).call(zoomListener).append("g").attr("transform", "translate(" + MARGIN.left + "," + MARGIN.top + ")").append("g"); - draw(Node.createNode(data)); + draw(TreeviewNode.createNode(data)); } function initTooltip() { @@ -471,7 +535,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } function draw(data) { - var _this = this; + var _this2 = this; widthScale.domain([0, data.data.count]); @@ -483,7 +547,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons root.setSelected(true); root.children.forEach(function (d, i) { - d.color = d3.functor(settings.colors).call(_this, d, i); + d.color = d3.functor(settings.colors).call(_this2, d, i); d.setRecursiveProperty("color", d.color); }); @@ -526,9 +590,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons if (settings.enableLabels) { nodeEnter.append("text").attr("x", function (d) { - return d.isLeaf() ? -10 : 10; + return d.isLeaf() ? 10 : -10; }).attr("dy", ".35em").attr("text-anchor", function (d) { - return d.isLeaf() ? "end" : "start"; + return d.isLeaf() ? "start" : "end"; }).text(settings.getLabel).style("font", "10px sans-serif").style("fill-opacity", 1e-6); } @@ -740,14 +804,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return d.data.count + " hits"; } - var Node = function () { - function Node() { - _classCallCheck(this, Node); + var TreeviewNode = function (_univis$Node2) { + _inherits(TreeviewNode, _univis$Node2); + + function TreeviewNode() { + var node = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - this.data = {}; + _classCallCheck(this, TreeviewNode); + + var _this3 = _possibleConstructorReturn(this, Object.getPrototypeOf(TreeviewNode).call(this, node)); + + _this3.setCount(); + return _this3; } - _createClass(Node, [{ + _createClass(TreeviewNode, [{ key: "setCount", value: function setCount() { if (settings.countAccessor(this)) { @@ -760,31 +831,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons this.data.count = 0; } } - - // sets a property for a node and all its children - - }, { - key: "setRecursiveProperty", - value: function setRecursiveProperty(property, value) { - this[property] = value; - if (this.children) { - this.children.forEach(function (c) { - c.setRecursiveProperty(property, value); - }); - } else if (this._children) { - this._children.forEach(function (c) { - c.setRecursiveProperty(property, value); - }); - } - } - - // Returns true if a node is a leaf - - }, { - key: "isLeaf", - value: function isLeaf() { - return this.children || this._children; - } }, { key: "setSelected", value: function setSelected(value) { @@ -844,21 +890,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } } }], [{ + key: "new", + value: function _new() { + var node = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + return new TreeviewNode(node); + } + }, { key: "createNode", value: function createNode(node) { - if (node.children) { - node.children = node.children.map(function (n) { - return Node.createNode(n); - }); - } - var obj = _extends(new Node(), node); - obj.setCount(); - return obj; + return univis.Node.createNode(node, TreeviewNode.new); } }]); - return Node; - }(); + return TreeviewNode; + }(univis.Node); /*************** Public methods ***************/ diff --git a/dist/unipept-visualizations.es5.js.map b/dist/unipept-visualizations.es5.js.map index 5ef148f..acfc3ad 100644 --- a/dist/unipept-visualizations.es5.js.map +++ b/dist/unipept-visualizations.es5.js.map @@ -1 +1 @@ -{"version":3,"sources":["unipept-visualizations.js"],"names":[],"mappings":";;;;;;;;;;;;;AAGA,CAAC,YAAY;AACT,QAAI,UAAU,SAAS,OAAT,CAAiB,OAAjB,EAA0B,IAA1B,EAA8C;AAAA,YAAd,OAAc,yDAAJ,EAAI;;AACxD,YAAI,OAAO,EAAX;;AAEA,YAAM,SAAS;AACP,iBAAK,CADE;AAEP,mBAAO,CAFA;AAGP,oBAAQ,CAHD;AAIP,kBAAM;AAJC,SAAf;AAAA,YAMI,WAAW;AACP,oBAAQ,GADD;AAEP,mBAAO,GAFA;;AAIP,uBAAW,iBAJJ;AAKP,oBAAQ,SALD;AAMP,sBAAU;AAAA,uBAAK,EAAE,QAAF,EAAL;AAAA,aANH;;AAQP,2BAAe;AAAA,uBAAK,EAAE,IAAF,CAAO,UAAZ;AAAA,aARR;AASP,4BAAgB,SATT;;AAWP,kCAAsB;AAAA,uBAAK,EAAE,IAAP;AAAA,aAXf;AAYP,uBAAW,SAZJ;AAaP,uBAAW,SAbJ;AAcP,8BAAkB,SAdX;;AAgBP,yBAAa,EAhBN;AAiBP,sBAAU;AAAA,uBAAK,EAAE,IAAP;AAAA,aAjBH;;AAmBP,4BAAgB,IAnBT;AAoBP,wBAAY,UApBL;AAqBP,6BAAiB,eArBV;AAsBP,4BAAgB;AAtBT,SANf;;AA+BA,YAAI,iBAAJ;;AAEA,YAAI,aAAJ;AAAA,YACI,SAAS,CADb;AAAA,YAEI,gBAFJ;AAAA,YAGI,sBAHJ;AAAA,YAII,oBAJJ;AAAA,YAKI,gBALJ;AAAA,YAMI,gBANJ;AAAA,YAOI,mBAPJ;;;;;AAYA,iBAAS,IAAT,GAAgB;AACZ,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,CAAK,QAAL,CAAc,WAAd,GAA4B,QAA5B;AACH,CAviBD","file":"unipept-visualizations.es5.js","sourcesContent":["/**\n * Interactive treemap\n */\n(function () {\n var TreeMap = function TreeMap(element, data, options = {}) {\n let that = {};\n\n const MARGIN = {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n DEFAULTS = {\n height: 300,\n width: 600,\n\n className: 'unipept-treemap',\n levels: undefined,\n getLevel: d => d.getDepth(),\n\n countAccessor: d => d.data.self_count,\n rerootCallback: undefined,\n\n getBreadcrumbTooltip: d => d.name,\n colorRoot: \"#104B7D\",\n colorLeaf: \"#fdffcc\",\n colorBreadcrumbs: \"#FF8F00\",\n\n labelHeight: 10,\n getLabel: d => d.name,\n\n enableTooltips: true,\n getTooltip: getTooltip,\n getTooltipTitle: getTooltipTitle,\n getTooltipText: getTooltipText\n };\n\n let settings;\n\n let root,\n nodeId = 0,\n current,\n treemapLayout,\n breadcrumbs,\n treemap,\n tooltip,\n colorScale;\n\n /**\n * Initializes Treemap\n */\n function init() {\n settings = Object.assign({}, DEFAULTS, options);\n\n root = Node.createNode(data);\n\n settings.width = settings.width - MARGIN.right - MARGIN.left;\n settings.height = settings.height - MARGIN.top - MARGIN.bottom;\n\n settings.levels = settings.levels || root.getHeight();\n\n if (settings.enableTooltips) {\n initTooltip();\n }\n\n initCSS();\n\n // setup the visualisation\n draw(root);\n reroot(root, false);\n }\n\n function initTooltip() {\n tooltip = d3.select(\"body\")\n .append(\"div\")\n .attr(\"id\", element.id + \"-tooltip\")\n .attr(\"class\", \"tip\")\n .style(\"position\", \"absolute\")\n .style(\"z-index\", \"10\")\n .style(\"visibility\", \"hidden\")\n .style(\"background-color\", \"white\")\n .style(\"padding\", \"2px\")\n .style(\"border\", \"1px solid #dddddd\")\n .style(\"border-radius\", \"3px;\");\n }\n\n function initCSS() {\n let elementClass = settings.className;\n $(element).addClass(elementClass);\n $(\"