@hpcc-js/tree
Advanced tools
Comparing version 0.0.44 to 0.0.45
@@ -1,107 +0,95 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
import * as tslib_1 from "tslib"; | ||
import { ITree } from "@hpcc-js/api"; | ||
import { SVGWidget } from "@hpcc-js/common"; | ||
import { hierarchy as d3Hierarchy, pack as d3Pack } from "d3-hierarchy"; | ||
import { interpolateZoom as d3InterpolateZoom } from "d3-interpolate"; | ||
import { event as d3Event } from "d3-selection"; | ||
import "d3-transition"; | ||
import "../src/CirclePacking.css"; | ||
var CirclePacking = /** @class */ (function (_super) { | ||
tslib_1.__extends(CirclePacking, _super); | ||
function CirclePacking() { | ||
var _this = _super.call(this) || this; | ||
ITree.call(_this); | ||
return _this; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "@hpcc-js/api", "@hpcc-js/common", "d3-hierarchy", "d3-interpolate", "d3-selection", "d3-transition", "../src/CirclePacking.css"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_1 = require("@hpcc-js/api"); | ||
var common_1 = require("@hpcc-js/common"); | ||
var d3_hierarchy_1 = require("d3-hierarchy"); | ||
var d3_interpolate_1 = require("d3-interpolate"); | ||
var d3_selection_1 = require("d3-selection"); | ||
require("d3-transition"); | ||
require("../src/CirclePacking.css"); | ||
var CirclePacking = /** @class */ (function (_super) { | ||
tslib_1.__extends(CirclePacking, _super); | ||
function CirclePacking() { | ||
var _this = _super.call(this) || this; | ||
api_1.ITree.call(_this); | ||
return _this; | ||
CirclePacking.prototype.enter = function (_domNode, element) { | ||
this.diameter = Math.min(this.width(), this.height()); | ||
this.pack = d3Pack() | ||
.size([this.diameter - 4, this.diameter - 4]) | ||
.padding(1.5); | ||
this.svg = element | ||
.append("g") | ||
.attr("transform", "rotate(30)"); | ||
}; | ||
CirclePacking.prototype.update = function (_domNode, _element) { | ||
var context = this; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
} | ||
CirclePacking.prototype.enter = function (_domNode, element) { | ||
this.diameter = Math.min(this.width(), this.height()); | ||
this.pack = d3_hierarchy_1.pack() | ||
.size([this.diameter - 4, this.diameter - 4]) | ||
.padding(1.5); | ||
this.svg = element | ||
.append("g") | ||
.attr("transform", "rotate(30)"); | ||
}; | ||
CirclePacking.prototype.update = function (_domNode, _element) { | ||
var context = this; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
this.svg.selectAll("circle").remove(); | ||
this.svg.selectAll("text").remove(); | ||
var root = d3Hierarchy(this.data()) | ||
.sum(function () { | ||
return 1; | ||
}).sort(function (a, b) { | ||
return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0; | ||
}); | ||
this._focus = root; | ||
this.pack(root); | ||
this.circle = this.svg.selectAll("circle").data(root.descendants()) | ||
.enter().append("circle") | ||
.attr("class", function (d) { return d.parent ? d.children ? "node" : "node leaf" : "node root"; }) | ||
.style("fill", function (d) { return context._palette(d.data.label); }) | ||
.on("click", function (d) { context.click(d.data, null, null); }) | ||
.on("dblclick", function (d) { | ||
if (this._focus !== d) { | ||
context.zoom(d); | ||
} | ||
this.svg.selectAll("circle").remove(); | ||
this.svg.selectAll("text").remove(); | ||
var root = d3_hierarchy_1.hierarchy(this.data()) | ||
.sum(function () { | ||
return 1; | ||
}).sort(function (a, b) { | ||
return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : 0; | ||
}); | ||
this._focus = root; | ||
this.pack(root); | ||
this.circle = this.svg.selectAll("circle").data(root.descendants()) | ||
.enter().append("circle") | ||
.attr("class", function (d) { return d.parent ? d.children ? "node" : "node leaf" : "node root"; }) | ||
.style("fill", function (d) { return context._palette(d.data.label); }) | ||
.on("click", function (d) { context.click(d.data, null, null); }) | ||
.on("dblclick", function (d) { | ||
if (this._focus !== d) { | ||
context.zoom(d); | ||
} | ||
d3_selection_1.event.stopPropagation(); | ||
}); | ||
this.circle.append("title").text(function (d) { return d.data.label; }); | ||
this.svg.selectAll("text").data(root.descendants()) | ||
.enter().append("text") | ||
.attr("class", "label") | ||
.style("fill-opacity", function (d) { return d.parent === root ? 1 : 0; }) | ||
.style("display", function (d) { return d.parent === root ? null : "none"; }) | ||
.text(function (d) { return d.data.label; }); | ||
this._node = this.svg.selectAll("circle,text"); | ||
this.zoomTo([root.x, root.y, root.r * 2]); | ||
}; | ||
CirclePacking.prototype.zoom = function (newFocus) { | ||
this._focus = newFocus; | ||
var context = this; | ||
var transition = this.svg.transition() | ||
.duration(d3_selection_1.event.altKey ? 7500 : 750) | ||
.tween("zoom", function () { | ||
var i = d3_interpolate_1.interpolateZoom(context.view, [context._focus.x, context._focus.y, context._focus.r * 2]); | ||
return function (t) { context.zoomTo(i(t)); }; | ||
}); | ||
function showText(d) { | ||
return (d === context._focus && !d.children) || d.parent === context._focus; | ||
} | ||
transition.selectAll("text") | ||
.filter(function (d) { return showText(d) || this.style.display === "inline"; }) | ||
.style("fill-opacity", function (d) { return showText(d) ? 1 : 0; }) | ||
.on("start", function (d) { if (showText(d)) | ||
this.style.display = "inline"; }) | ||
.on("end", function (d) { if (!showText(d)) | ||
this.style.display = "none"; }); | ||
}; | ||
CirclePacking.prototype.zoomTo = function (v) { | ||
var k = this.diameter / v[2]; | ||
this.view = v; | ||
this._node.attr("transform", function (d) { return "translate(" + (d.x - v[0]) * k + "," + (d.y - v[1]) * k + ")"; }); | ||
this.circle.attr("r", function (d) { return d.r * k; }); | ||
}; | ||
return CirclePacking; | ||
}(common_1.SVGWidget)); | ||
exports.CirclePacking = CirclePacking; | ||
CirclePacking.prototype._class += " tree_CirclePacking"; | ||
CirclePacking.prototype.implements(api_1.ITree.prototype); | ||
CirclePacking.prototype.publish("paletteID", "default", "set", "Palette ID", CirclePacking.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
CirclePacking.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
}); | ||
d3Event.stopPropagation(); | ||
}); | ||
this.circle.append("title").text(function (d) { return d.data.label; }); | ||
this.svg.selectAll("text").data(root.descendants()) | ||
.enter().append("text") | ||
.attr("class", "label") | ||
.style("fill-opacity", function (d) { return d.parent === root ? 1 : 0; }) | ||
.style("display", function (d) { return d.parent === root ? null : "none"; }) | ||
.text(function (d) { return d.data.label; }); | ||
this._node = this.svg.selectAll("circle,text"); | ||
this.zoomTo([root.x, root.y, root.r * 2]); | ||
}; | ||
CirclePacking.prototype.zoom = function (newFocus) { | ||
this._focus = newFocus; | ||
var context = this; | ||
var transition = this.svg.transition() | ||
.duration(d3Event.altKey ? 7500 : 750) | ||
.tween("zoom", function () { | ||
var i = d3InterpolateZoom(context.view, [context._focus.x, context._focus.y, context._focus.r * 2]); | ||
return function (t) { context.zoomTo(i(t)); }; | ||
}); | ||
function showText(d) { | ||
return (d === context._focus && !d.children) || d.parent === context._focus; | ||
} | ||
transition.selectAll("text") | ||
.filter(function (d) { return showText(d) || this.style.display === "inline"; }) | ||
.style("fill-opacity", function (d) { return showText(d) ? 1 : 0; }) | ||
.on("start", function (d) { if (showText(d)) | ||
this.style.display = "inline"; }) | ||
.on("end", function (d) { if (!showText(d)) | ||
this.style.display = "none"; }); | ||
}; | ||
CirclePacking.prototype.zoomTo = function (v) { | ||
var k = this.diameter / v[2]; | ||
this.view = v; | ||
this._node.attr("transform", function (d) { return "translate(" + (d.x - v[0]) * k + "," + (d.y - v[1]) * k + ")"; }); | ||
this.circle.attr("r", function (d) { return d.r * k; }); | ||
}; | ||
return CirclePacking; | ||
}(SVGWidget)); | ||
export { CirclePacking }; | ||
CirclePacking.prototype._class += " tree_CirclePacking"; | ||
CirclePacking.prototype.implements(ITree.prototype); | ||
CirclePacking.prototype.publish("paletteID", "default", "set", "Palette ID", CirclePacking.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
CirclePacking.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
//# sourceMappingURL=CirclePacking.js.map |
@@ -1,234 +0,222 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
import * as tslib_1 from "tslib"; | ||
import { ITree } from "@hpcc-js/api"; | ||
import { PropertyExt, SVGZoomWidget, Utility } from "@hpcc-js/common"; | ||
import { cluster as d3Cluster, hierarchy as d3Hierarchy, tree as d3Tree } from "d3-hierarchy"; | ||
import { select as d3Select } from "d3-selection"; | ||
import "../src/Dendrogram.css"; | ||
var DendrogramColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(DendrogramColumn, _super); | ||
function DendrogramColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "@hpcc-js/api", "@hpcc-js/common", "d3-hierarchy", "d3-selection", "../src/Dendrogram.css"], factory); | ||
return DendrogramColumn; | ||
}(PropertyExt)); | ||
export { DendrogramColumn }; | ||
DendrogramColumn.prototype._class += " tree_Dendrogram.DendrogramColumn"; | ||
DendrogramColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Dendrogram = /** @class */ (function (_super) { | ||
tslib_1.__extends(Dendrogram, _super); | ||
function Dendrogram() { | ||
var _this = _super.call(this) || this; | ||
ITree.call(_this); | ||
Utility.SimpleSelectionMixin.call(_this); | ||
_this._drawStartPos = "origin"; | ||
_this._d3LayoutCluster = d3Cluster(); | ||
_this._d3LayoutTree = d3Tree(); | ||
return _this; | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_1 = require("@hpcc-js/api"); | ||
var common_1 = require("@hpcc-js/common"); | ||
var d3_hierarchy_1 = require("d3-hierarchy"); | ||
var d3_selection_1 = require("d3-selection"); | ||
require("../src/Dendrogram.css"); | ||
var DendrogramColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(DendrogramColumn, _super); | ||
function DendrogramColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
Dendrogram.prototype.dendrogramData = function () { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
} | ||
return DendrogramColumn; | ||
}(common_1.PropertyExt)); | ||
exports.DendrogramColumn = DendrogramColumn; | ||
DendrogramColumn.prototype._class += " tree_Dendrogram.DendrogramColumn"; | ||
DendrogramColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Dendrogram = /** @class */ (function (_super) { | ||
tslib_1.__extends(Dendrogram, _super); | ||
function Dendrogram() { | ||
var _this = _super.call(this) || this; | ||
api_1.ITree.call(_this); | ||
common_1.Utility.SimpleSelectionMixin.call(_this); | ||
_this._drawStartPos = "origin"; | ||
_this._d3LayoutCluster = d3_hierarchy_1.cluster(); | ||
_this._d3LayoutTree = d3_hierarchy_1.tree(); | ||
return _this; | ||
var view = this._db.rollupView(this.mappings().map(function (mapping) { return mapping.column(); })); | ||
var retVal = { | ||
key: "root", | ||
values: view.entries() | ||
}; | ||
return formatData(retVal); | ||
function formatData(node) { | ||
return { | ||
label: node.key, | ||
children: node.values.filter(function (value) { return !(value instanceof Array); }).map(function (value) { return formatData(value); }), | ||
origRows: node.values | ||
}; | ||
} | ||
Dendrogram.prototype.dendrogramData = function () { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
}; | ||
Dendrogram.prototype.enter = function (domNode, element) { | ||
_super.prototype.enter.call(this, domNode, element); | ||
this._renderElement | ||
.attr("opacity", 0) | ||
.transition().duration(500) | ||
.attr("opacity", 1); | ||
this._selection.widgetElement(this._renderElement); | ||
}; | ||
Dendrogram.prototype.update = function (domNode, element) { | ||
_super.prototype.update.call(this, domNode, element); | ||
var context = this; | ||
var isVertical = this.orientation() === "vertical"; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
} | ||
this._d3Layout = this.dendrogram() ? this._d3LayoutCluster : this._d3LayoutTree; | ||
if (this.radial()) { | ||
this._d3Layout | ||
.size([360, this.separation() * 2]); | ||
this._d3Layout.separation(function separation(a, b) { | ||
return (a.parent === b.parent ? 1 : 2) / a.depth; | ||
}); | ||
} | ||
else { | ||
this._d3Layout.nodeSize([14, this.separation()]); | ||
this._d3Layout.separation(function separation(a, b) { | ||
return a.parent === b.parent ? 1 : 2; | ||
}); | ||
} | ||
var data = this.dendrogramData(); | ||
var root = d3Hierarchy(data); | ||
this._d3Layout(root); | ||
var dataNodes = root.descendants(); | ||
var links = root.descendants().slice(1); | ||
// Lines --- | ||
function linkVertical(d) { | ||
return "M" + d.parent.x + "," + d.parent.y | ||
+ "C" + d.parent.x + "," + (d.parent.y + d.y) / 2 | ||
+ " " + d.x + "," + (d.parent.y + d.y) / 2 | ||
+ " " + d.x + "," + d.y; | ||
} | ||
function linkHorizontal(d) { | ||
return "M" + d.y + "," + d.x | ||
+ "C" + (d.y + d.parent.y) / 2 + "," + d.x | ||
+ " " + (d.y + d.parent.y) / 2 + "," + d.parent.x | ||
+ " " + d.parent.y + "," + d.parent.x; | ||
} | ||
function diagonal(d) { | ||
return isVertical ? linkVertical(d) : linkHorizontal(d); | ||
} | ||
function project(x, y) { | ||
var angle = (x - 90) / 180 * Math.PI; | ||
var radius = y; | ||
return [radius * Math.cos(angle), radius * Math.sin(angle)]; | ||
} | ||
function radialDiagonal(d) { | ||
return "M" + project(d.x, d.y) | ||
+ "C" + project(d.x, (d.y + d.parent.y) / 2) | ||
+ " " + project(d.parent.x, (d.y + d.parent.y) / 2) | ||
+ " " + project(d.parent.x, d.parent.y); | ||
} | ||
var transitionDuration = this._renderCount ? 500 : 0; | ||
var lines = this._renderElement.selectAll(".link").data(links); | ||
lines.enter().append("path") | ||
.attr("class", "link") | ||
.attr("d", this.radial() ? radialDiagonal : diagonal); | ||
lines.transition().duration(transitionDuration) | ||
.attr("d", this.radial() ? radialDiagonal : diagonal); | ||
lines.exit().remove(); | ||
// Nodes --- | ||
var textOffsetX = this.circleRadius() + 2; | ||
function nodeTransform(d) { | ||
if (context.radial()) { | ||
return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; | ||
} | ||
var view = this._db.rollupView(this.mappings().map(function (mapping) { return mapping.column(); })); | ||
var retVal = { | ||
key: "root", | ||
values: view.entries() | ||
}; | ||
return formatData(retVal); | ||
function formatData(node) { | ||
return { | ||
label: node.key, | ||
children: node.values.filter(function (value) { return !(value instanceof Array); }).map(function (value) { return formatData(value); }), | ||
origRows: node.values | ||
}; | ||
return context.orientation() === "horizontal" ? "translate(" + d.y + "," + d.x + ")" : "translate(" + d.x + "," + d.y + ")"; | ||
} | ||
var nodes = this._renderElement.selectAll(".node").data(dataNodes); | ||
nodes.transition().duration(transitionDuration) | ||
.attr("transform", nodeTransform); | ||
var enterNodes = nodes.enter().append("g") | ||
.attr("class", "node") | ||
.attr("transform", nodeTransform) | ||
.call(this._selection.enter.bind(this._selection)) | ||
.on("click", function (d) { | ||
var tmp = d; | ||
while (tmp.children) { | ||
tmp = tmp.children[0]; | ||
} | ||
}; | ||
Dendrogram.prototype.enter = function (domNode, element) { | ||
_super.prototype.enter.call(this, domNode, element); | ||
this._renderElement | ||
.attr("opacity", 0) | ||
.transition().duration(500) | ||
.attr("opacity", 1); | ||
this._selection.widgetElement(this._renderElement); | ||
}; | ||
Dendrogram.prototype.update = function (domNode, element) { | ||
_super.prototype.update.call(this, domNode, element); | ||
var context = this; | ||
var isVertical = this.orientation() === "vertical"; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
if (d.depth > 0) { | ||
context.click(context.rowToObj(tmp.origRows[0]), context.mappings()[d.depth - 1].column(), true); | ||
} | ||
this._d3Layout = this.dendrogram() ? this._d3LayoutCluster : this._d3LayoutTree; | ||
if (this.radial()) { | ||
this._d3Layout | ||
.size([360, this.separation() * 2]); | ||
this._d3Layout.separation(function separation(a, b) { | ||
return (a.parent === b.parent ? 1 : 2) / a.depth; | ||
}); | ||
}) | ||
.on("dblclick", function (d) { | ||
var tmp = d; | ||
while (tmp.children) { | ||
tmp = tmp.children[0]; | ||
} | ||
else { | ||
this._d3Layout.nodeSize([14, this.separation()]); | ||
this._d3Layout.separation(function separation(a, b) { | ||
return a.parent === b.parent ? 1 : 2; | ||
}); | ||
if (d.depth > 0) { | ||
context.dblclick(context.rowToObj(tmp.origRows[0]), context.mappings()[d.depth - 1].column(), true); | ||
} | ||
var data = this.dendrogramData(); | ||
var root = d3_hierarchy_1.hierarchy(data); | ||
this._d3Layout(root); | ||
var dataNodes = root.descendants(); | ||
var links = root.descendants().slice(1); | ||
// Lines --- | ||
function linkVertical(d) { | ||
return "M" + d.parent.x + "," + d.parent.y | ||
+ "C" + d.parent.x + "," + (d.parent.y + d.y) / 2 | ||
+ " " + d.x + "," + (d.parent.y + d.y) / 2 | ||
+ " " + d.x + "," + d.y; | ||
}) | ||
.each(function () { | ||
var e = d3Select(this); | ||
e.append("circle"); | ||
e.append("text"); | ||
}); | ||
enterNodes.merge(nodes).select("circle") | ||
.attr("r", this.circleRadius()) | ||
.style("fill", function (d) { return context._palette(d.data.label); }) | ||
.append("title") | ||
.text(function (d) { return d.data.label; }); | ||
enterNodes.merge(nodes).select("text") | ||
.attr("dx", function (d) { | ||
if (context.radial()) { | ||
if (d.children) { | ||
return d.x < 180 ? -textOffsetX : textOffsetX; | ||
} | ||
else { | ||
return d.x < 180 ? textOffsetX : -textOffsetX; | ||
} | ||
} | ||
function linkHorizontal(d) { | ||
return "M" + d.y + "," + d.x | ||
+ "C" + (d.y + d.parent.y) / 2 + "," + d.x | ||
+ " " + (d.y + d.parent.y) / 2 + "," + d.parent.x | ||
+ " " + d.parent.y + "," + d.parent.x; | ||
else if (isVertical) { | ||
return d.children ? textOffsetX : -textOffsetX; | ||
} | ||
function diagonal(d) { | ||
return isVertical ? linkVertical(d) : linkHorizontal(d); | ||
return d.children ? -textOffsetX : textOffsetX; | ||
}) | ||
.attr("dy", "0.25em") | ||
.style("text-anchor", function (d) { | ||
if (context.radial()) { | ||
if (d.children) { | ||
return d.x < 180 ? "end" : "start"; | ||
} | ||
else { | ||
return d.x < 180 ? "start" : "end"; | ||
} | ||
} | ||
function project(x, y) { | ||
var angle = (x - 90) / 180 * Math.PI; | ||
var radius = y; | ||
return [radius * Math.cos(angle), radius * Math.sin(angle)]; | ||
else if (isVertical) { | ||
return d.children ? "start" : "end"; | ||
} | ||
function radialDiagonal(d) { | ||
return "M" + project(d.x, d.y) | ||
+ "C" + project(d.x, (d.y + d.parent.y) / 2) | ||
+ " " + project(d.parent.x, (d.y + d.parent.y) / 2) | ||
+ " " + project(d.parent.x, d.parent.y); | ||
return d.children ? "end" : "start"; | ||
}) | ||
.attr("transform", function (d) { | ||
if (context.radial()) { | ||
return d.x < 180 ? null : "rotate(180)"; | ||
} | ||
var transitionDuration = this._renderCount ? 500 : 0; | ||
var lines = this._renderElement.selectAll(".link").data(links); | ||
lines.enter().append("path") | ||
.attr("class", "link") | ||
.attr("d", this.radial() ? radialDiagonal : diagonal); | ||
lines.transition().duration(transitionDuration) | ||
.attr("d", this.radial() ? radialDiagonal : diagonal); | ||
lines.exit().remove(); | ||
// Nodes --- | ||
var textOffsetX = this.circleRadius() + 2; | ||
function nodeTransform(d) { | ||
if (context.radial()) { | ||
return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; | ||
} | ||
return context.orientation() === "horizontal" ? "translate(" + d.y + "," + d.x + ")" : "translate(" + d.x + "," + d.y + ")"; | ||
else if (isVertical) { | ||
return "rotate(-66)"; | ||
} | ||
var nodes = this._renderElement.selectAll(".node").data(dataNodes); | ||
nodes.transition().duration(transitionDuration) | ||
.attr("transform", nodeTransform); | ||
var enterNodes = nodes.enter().append("g") | ||
.attr("class", "node") | ||
.attr("transform", nodeTransform) | ||
.call(this._selection.enter.bind(this._selection)) | ||
.on("click", function (d) { | ||
var tmp = d; | ||
while (tmp.children) { | ||
tmp = tmp.children[0]; | ||
} | ||
if (d.depth > 0) { | ||
context.click(context.rowToObj(tmp.origRows[0]), context.mappings()[d.depth - 1].column(), true); | ||
} | ||
}) | ||
.on("dblclick", function (d) { | ||
var tmp = d; | ||
while (tmp.children) { | ||
tmp = tmp.children[0]; | ||
} | ||
if (d.depth > 0) { | ||
context.dblclick(context.rowToObj(tmp.origRows[0]), context.mappings()[d.depth - 1].column(), true); | ||
} | ||
}) | ||
.each(function () { | ||
var e = d3_selection_1.select(this); | ||
e.append("circle"); | ||
e.append("text"); | ||
}); | ||
enterNodes.merge(nodes).select("circle") | ||
.attr("r", this.circleRadius()) | ||
.style("fill", function (d) { return context._palette(d.data.label); }) | ||
.append("title") | ||
.text(function (d) { return d.data.label; }); | ||
enterNodes.merge(nodes).select("text") | ||
.attr("dx", function (d) { | ||
if (context.radial()) { | ||
if (d.children) { | ||
return d.x < 180 ? -textOffsetX : textOffsetX; | ||
} | ||
else { | ||
return d.x < 180 ? textOffsetX : -textOffsetX; | ||
} | ||
} | ||
else if (isVertical) { | ||
return d.children ? textOffsetX : -textOffsetX; | ||
} | ||
return d.children ? -textOffsetX : textOffsetX; | ||
}) | ||
.attr("dy", "0.25em") | ||
.style("text-anchor", function (d) { | ||
if (context.radial()) { | ||
if (d.children) { | ||
return d.x < 180 ? "end" : "start"; | ||
} | ||
else { | ||
return d.x < 180 ? "start" : "end"; | ||
} | ||
} | ||
else if (isVertical) { | ||
return d.children ? "start" : "end"; | ||
} | ||
return d.children ? "end" : "start"; | ||
}) | ||
.attr("transform", function (d) { | ||
if (context.radial()) { | ||
return d.x < 180 ? null : "rotate(180)"; | ||
} | ||
else if (isVertical) { | ||
return "rotate(-66)"; | ||
} | ||
return null; | ||
}) | ||
.text(function (d) { return d.data.label; }); | ||
nodes.exit().remove(); | ||
if (!this._renderCount) { | ||
context.zoomToFit(); | ||
} | ||
}; | ||
return Dendrogram; | ||
}(common_1.SVGZoomWidget)); | ||
exports.Dendrogram = Dendrogram; | ||
Dendrogram.prototype._class += " tree_Dendrogram"; | ||
Dendrogram.prototype.implements(api_1.ITree.prototype); | ||
Dendrogram.prototype.mixin(common_1.Utility.SimpleSelectionMixin); | ||
Dendrogram.prototype.Column = DendrogramColumn; | ||
Dendrogram.prototype.publish("paletteID", "default", "set", "Palette ID", Dendrogram.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
Dendrogram.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
Dendrogram.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: DendrogramColumn }); | ||
Dendrogram.prototype.publish("circleRadius", 4.5, "number", "Text offset from circle"); | ||
Dendrogram.prototype.publish("separation", 240, "number", "Leaf Separation"); | ||
Dendrogram.prototype.publish("dendrogram", true, "boolean", "Dendrogram"); | ||
Dendrogram.prototype.publish("radial", false, "boolean", "Radial"); | ||
Dendrogram.prototype.publish("orientation", "horizontal", "set", "Orientation", ["horizontal", "vertical"], { tags: ["Private"], disable: function (w) { return w.radial(); } }); | ||
}); | ||
return null; | ||
}) | ||
.text(function (d) { return d.data.label; }); | ||
nodes.exit().remove(); | ||
if (!this._renderCount) { | ||
context.zoomToFit(); | ||
} | ||
}; | ||
return Dendrogram; | ||
}(SVGZoomWidget)); | ||
export { Dendrogram }; | ||
Dendrogram.prototype._class += " tree_Dendrogram"; | ||
Dendrogram.prototype.implements(ITree.prototype); | ||
Dendrogram.prototype.mixin(Utility.SimpleSelectionMixin); | ||
Dendrogram.prototype.Column = DendrogramColumn; | ||
Dendrogram.prototype.publish("paletteID", "default", "set", "Palette ID", Dendrogram.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
Dendrogram.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
Dendrogram.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: DendrogramColumn }); | ||
Dendrogram.prototype.publish("circleRadius", 4.5, "number", "Text offset from circle"); | ||
Dendrogram.prototype.publish("separation", 240, "number", "Leaf Separation"); | ||
Dendrogram.prototype.publish("dendrogram", true, "boolean", "Dendrogram"); | ||
Dendrogram.prototype.publish("radial", false, "boolean", "Radial"); | ||
Dendrogram.prototype.publish("orientation", "horizontal", "set", "Orientation", ["horizontal", "vertical"], { tags: ["Private"], disable: function (w) { return w.radial(); } }); | ||
//# sourceMappingURL=Dendrogram.js.map |
@@ -1,239 +0,227 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
import * as tslib_1 from "tslib"; | ||
import { ITree } from "@hpcc-js/api"; | ||
import { PropertyExt, SVGZoomWidget, Utility } from "@hpcc-js/common"; | ||
import { hierarchy as d3Hierarchy, tree as d3Tree } from "d3-hierarchy"; | ||
import { select as d3Select } from "d3-selection"; | ||
import "../src/Indented.css"; | ||
var IndentedColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(IndentedColumn, _super); | ||
function IndentedColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "@hpcc-js/api", "@hpcc-js/common", "d3-hierarchy", "d3-selection", "../src/Indented.css"], factory); | ||
return IndentedColumn; | ||
}(PropertyExt)); | ||
export { IndentedColumn }; | ||
IndentedColumn.prototype._class += " tree_Dendrogram.IndentedColumn"; | ||
IndentedColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Indented = /** @class */ (function (_super) { | ||
tslib_1.__extends(Indented, _super); | ||
function Indented() { | ||
var _this = _super.call(this) || this; | ||
_this._collapsed = {}; | ||
ITree.call(_this); | ||
Utility.SimpleSelectionMixin.call(_this); | ||
_this._drawStartPos = "origin"; | ||
_this._d3Tree = d3Tree(); | ||
return _this; | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_1 = require("@hpcc-js/api"); | ||
var common_1 = require("@hpcc-js/common"); | ||
var d3_hierarchy_1 = require("d3-hierarchy"); | ||
var d3_selection_1 = require("d3-selection"); | ||
require("../src/Indented.css"); | ||
var IndentedColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(IndentedColumn, _super); | ||
function IndentedColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
Indented.prototype.xmlToData = function (xml, id) { | ||
if (id === void 0) { id = ""; } | ||
if (DOMParser) { | ||
var parser = new DOMParser(); | ||
var doc = parser.parseFromString(xml, "text/xml"); | ||
return xmlToJson(doc, id).children[0]; | ||
} | ||
return IndentedColumn; | ||
}(common_1.PropertyExt)); | ||
exports.IndentedColumn = IndentedColumn; | ||
IndentedColumn.prototype._class += " tree_Dendrogram.IndentedColumn"; | ||
IndentedColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Indented = /** @class */ (function (_super) { | ||
tslib_1.__extends(Indented, _super); | ||
function Indented() { | ||
var _this = _super.call(this) || this; | ||
_this._collapsed = {}; | ||
api_1.ITree.call(_this); | ||
common_1.Utility.SimpleSelectionMixin.call(_this); | ||
_this._drawStartPos = "origin"; | ||
_this._d3Tree = d3_hierarchy_1.tree(); | ||
return _this; | ||
return []; | ||
}; | ||
Indented.prototype.xml = function (_) { | ||
if (!arguments.length) | ||
return this._xml; | ||
this._xml = _; | ||
this.data(this.xmlToData(this._xml)); | ||
return this; | ||
}; | ||
Indented.prototype.IndentedData = function () { | ||
if (this.xmlColumn_exists()) { | ||
var cellIdx_1 = this.columns().indexOf(this.xmlColumn()); | ||
var retVal = { | ||
label: this.xmlColumn(), | ||
children: this.data().map(function (row, idx) { | ||
return this.xmlToData(row[cellIdx_1], "[" + idx + "]"); | ||
}, this) | ||
}; | ||
return retVal.children.length === 1 ? retVal.children[0] : retVal; | ||
} | ||
Indented.prototype.xmlToData = function (xml, id) { | ||
if (id === void 0) { id = ""; } | ||
if (DOMParser) { | ||
var parser = new DOMParser(); | ||
var doc = parser.parseFromString(xml, "text/xml"); | ||
return xmlToJson(doc, id).children[0]; | ||
else { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
} | ||
return []; | ||
}; | ||
Indented.prototype.xml = function (_) { | ||
if (!arguments.length) | ||
return this._xml; | ||
this._xml = _; | ||
this.data(this.xmlToData(this._xml)); | ||
return this; | ||
}; | ||
Indented.prototype.IndentedData = function () { | ||
if (this.xmlColumn_exists()) { | ||
var cellIdx_1 = this.columns().indexOf(this.xmlColumn()); | ||
var view = this._db.rollupView(this.mappings().map(function (mapping) { return mapping.column(); })); | ||
var root = { | ||
key: "root", | ||
values: view.entries() | ||
}; | ||
return formatData(root); | ||
} | ||
function formatData(node) { | ||
if (node.values instanceof Array) { | ||
var children = node.values.filter(function (value) { | ||
return !(value instanceof Array); | ||
}).map(function (value) { | ||
return formatData(value); | ||
}); | ||
var retVal = { | ||
label: this.xmlColumn(), | ||
children: this.data().map(function (row, idx) { | ||
return this.xmlToData(row[cellIdx_1], "[" + idx + "]"); | ||
}, this) | ||
label: node.key | ||
}; | ||
return retVal.children.length === 1 ? retVal.children[0] : retVal; | ||
} | ||
else { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
if (children.length) { | ||
retVal.children = children; | ||
} | ||
var view = this._db.rollupView(this.mappings().map(function (mapping) { return mapping.column(); })); | ||
var root = { | ||
key: "root", | ||
values: view.entries() | ||
}; | ||
return formatData(root); | ||
} | ||
function formatData(node) { | ||
if (node.values instanceof Array) { | ||
var children = node.values.filter(function (value) { | ||
return !(value instanceof Array); | ||
}).map(function (value) { | ||
return formatData(value); | ||
}); | ||
var retVal = { | ||
label: node.key | ||
}; | ||
if (children.length) { | ||
retVal.children = children; | ||
} | ||
else { | ||
retVal.size = 22; | ||
} | ||
return retVal; | ||
else { | ||
retVal.size = 22; | ||
} | ||
return { | ||
label: node.key, | ||
size: node.values.aggregate, | ||
origRows: node.values | ||
}; | ||
return retVal; | ||
} | ||
}; | ||
Indented.prototype.enter = function (domNode, element) { | ||
_super.prototype.enter.call(this, domNode, element); | ||
this._svgLinks = this._renderElement.append("g"); | ||
this._svgNodes = this._renderElement.append("g"); | ||
this._selection.widgetElement(this._svgNodes); | ||
}; | ||
Indented.prototype.update = function (domNode, _element) { | ||
var _this = this; | ||
_super.prototype.update.call(this, domNode, _element); | ||
var context = this; | ||
this._d3Tree | ||
.nodeSize([0, this.barHeight()]); | ||
var dataChecksum = this._db.dataChecksum(); | ||
if (this._prevDataChecksum !== dataChecksum) { | ||
this._treeData = this.IndentedData(); | ||
this._prevDataChecksum = dataChecksum; | ||
return { | ||
label: node.key, | ||
size: node.values.aggregate, | ||
origRows: node.values | ||
}; | ||
} | ||
}; | ||
Indented.prototype.enter = function (domNode, element) { | ||
_super.prototype.enter.call(this, domNode, element); | ||
this._svgLinks = this._renderElement.append("g"); | ||
this._svgNodes = this._renderElement.append("g"); | ||
this._selection.widgetElement(this._svgNodes); | ||
}; | ||
Indented.prototype.update = function (domNode, _element) { | ||
var _this = this; | ||
_super.prototype.update.call(this, domNode, _element); | ||
var context = this; | ||
this._d3Tree | ||
.nodeSize([0, this.barHeight()]); | ||
var dataChecksum = this._db.dataChecksum(); | ||
if (this._prevDataChecksum !== dataChecksum) { | ||
this._treeData = this.IndentedData(); | ||
this._prevDataChecksum = dataChecksum; | ||
} | ||
function getID(d) { | ||
return (d.parent ? getID(d.parent) + "." : "") + d.data.label; | ||
} | ||
var root = d3Hierarchy(this.data()) | ||
.sum(function (d) { | ||
return d.size || 50; | ||
}).each(function (d) { | ||
if (_this._collapsed[getID(d)]) { | ||
delete (d.children); | ||
} | ||
function getID(d) { | ||
return (d.parent ? getID(d.parent) + "." : "") + d.data.label; | ||
} | ||
var root = d3_hierarchy_1.hierarchy(this.data()) | ||
.sum(function (d) { | ||
return d.size || 50; | ||
}).each(function (d) { | ||
if (_this._collapsed[getID(d)]) { | ||
delete (d.children); | ||
}); | ||
var dataNodes = this._d3Tree(root).descendants(); | ||
var links = this._d3Tree(root).descendants().slice(1); | ||
var nodeIdx = 0; | ||
root.eachBefore(function (n) { | ||
n.x = nodeIdx * context.barHeight(); | ||
++nodeIdx; | ||
}); | ||
var boxSize = this.barHeight() - 4; | ||
var transitionDuration = this._renderCount ? 500 : 0; | ||
// Lines --- | ||
var lines = this._svgLinks.selectAll(".link").data(links, function (d) { return getID(d); }); | ||
lines.enter().append("path") | ||
.attr("class", "link") | ||
.attr("d", elbow); | ||
lines.transition().duration(transitionDuration) | ||
.attr("d", elbow); | ||
lines.exit().remove(); | ||
function elbow(d) { | ||
return "M" + d.parent.y + "," + d.parent.x | ||
+ "V" + d.x + ", H" + d.y; | ||
} | ||
// Nodes --- | ||
var nodes = this._svgNodes.selectAll(".node").data(dataNodes, function (d) { return getID(d); }); | ||
nodes.transition().duration(transitionDuration) | ||
.attr("transform", function (d) { return "translate(" + d.y + "," + d.x + ")"; }); | ||
var enterNodes = nodes.enter().append("g") | ||
.attr("class", "node") | ||
.attr("transform", function (d) { return "translate(" + d.y + "," + d.x + ")"; }) | ||
.call(this._selection.enter.bind(this._selection)) | ||
.each(function () { | ||
var element = d3Select(this); | ||
element.append("rect") | ||
.attr("height", boxSize) | ||
.attr("width", boxSize) | ||
.on("click", function (d) { | ||
if (context._collapsed[getID(d)]) { | ||
delete context._collapsed[getID(d)]; | ||
} | ||
else if (d.children) { | ||
context._collapsed[getID(d)] = true; | ||
} | ||
context.lazyRender(); | ||
}); | ||
var dataNodes = this._d3Tree(root).descendants(); | ||
var links = this._d3Tree(root).descendants().slice(1); | ||
var nodeIdx = 0; | ||
root.eachBefore(function (n) { | ||
n.x = nodeIdx * context.barHeight(); | ||
++nodeIdx; | ||
}); | ||
var boxSize = this.barHeight() - 4; | ||
var transitionDuration = this._renderCount ? 500 : 0; | ||
// Lines --- | ||
var lines = this._svgLinks.selectAll(".link").data(links, function (d) { return getID(d); }); | ||
lines.enter().append("path") | ||
.attr("class", "link") | ||
.attr("d", elbow); | ||
lines.transition().duration(transitionDuration) | ||
.attr("d", elbow); | ||
lines.exit().remove(); | ||
function elbow(d) { | ||
return "M" + d.parent.y + "," + d.parent.x | ||
+ "V" + d.x + ", H" + d.y; | ||
} | ||
// Nodes --- | ||
var nodes = this._svgNodes.selectAll(".node").data(dataNodes, function (d) { return getID(d); }); | ||
nodes.transition().duration(transitionDuration) | ||
.attr("transform", function (d) { return "translate(" + d.y + "," + d.x + ")"; }); | ||
var enterNodes = nodes.enter().append("g") | ||
.attr("class", "node") | ||
.attr("transform", function (d) { return "translate(" + d.y + "," + d.x + ")"; }) | ||
.call(this._selection.enter.bind(this._selection)) | ||
.each(function () { | ||
var element = d3_selection_1.select(this); | ||
element.append("rect") | ||
.attr("height", boxSize) | ||
.attr("width", boxSize) | ||
.on("click", function (d) { | ||
if (context._collapsed[getID(d)]) { | ||
delete context._collapsed[getID(d)]; | ||
} | ||
else if (d.children) { | ||
context._collapsed[getID(d)] = true; | ||
} | ||
context.lazyRender(); | ||
}); | ||
element.append("text"); | ||
}) | ||
.style("opacity", 0); | ||
enterNodes.transition() | ||
.style("opacity", 1); | ||
enterNodes.merge(nodes).select("rect") | ||
.attr("x", -boxSize / 2) | ||
.attr("y", -boxSize / 2) | ||
.style("fill", color); | ||
enterNodes.merge(nodes).select("text") | ||
.attr("dx", boxSize / 2 + 4 + "px") | ||
.attr("dy", "0.33em") | ||
.text(function (d) { return d.data.label; }); | ||
nodes.exit().transition() | ||
.style("opacity", 0) | ||
.remove(); | ||
if (!this._renderCount) { | ||
context.zoomToFit(); | ||
} | ||
function color(d) { | ||
return context._collapsed[getID(d)] ? "#3182bd" : d.children ? "#c6dbef" : "#fd8d3c"; | ||
} | ||
}; | ||
return Indented; | ||
}(common_1.SVGZoomWidget)); | ||
exports.Indented = Indented; | ||
Indented.prototype._class += " tree_Indented"; | ||
Indented.prototype.implements(api_1.ITree.prototype); | ||
Indented.prototype.mixin(common_1.Utility.SimpleSelectionMixin); | ||
Indented.prototype.Column = IndentedColumn; | ||
Indented.prototype.publish("xmlColumn", null, "set", "Field", function () { return this.columns(); }, { optional: true }); | ||
Indented.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: IndentedColumn, disable: function (w) { return w.xmlColumn_exists(); } }); | ||
Indented.prototype.publish("barHeight", 16, "number", "Bar height"); | ||
function xmlToJson(xml, id) { | ||
if (id === void 0) { id = ""; } | ||
var retVal = { | ||
id: id, | ||
label: "", | ||
attributes: {}, | ||
children: [] | ||
}; | ||
retVal.label = xml.nodeName; | ||
if (xml.nodeType === 1) { | ||
if (xml.attributes.length > 0) { | ||
for (var j = 0; j < xml.attributes.length; j++) { | ||
var attribute = xml.attributes.item(j); | ||
retVal.attributes[attribute.nodeName] = attribute.nodeValue; | ||
} | ||
} | ||
element.append("text"); | ||
}) | ||
.style("opacity", 0); | ||
enterNodes.transition() | ||
.style("opacity", 1); | ||
enterNodes.merge(nodes).select("rect") | ||
.attr("x", -boxSize / 2) | ||
.attr("y", -boxSize / 2) | ||
.style("fill", color); | ||
enterNodes.merge(nodes).select("text") | ||
.attr("dx", boxSize / 2 + 4 + "px") | ||
.attr("dy", "0.33em") | ||
.text(function (d) { return d.data.label; }); | ||
nodes.exit().transition() | ||
.style("opacity", 0) | ||
.remove(); | ||
if (!this._renderCount) { | ||
context.zoomToFit(); | ||
} | ||
else if (xml.nodeType === 3) { | ||
retVal.label = xml.nodeValue; | ||
function color(d) { | ||
return context._collapsed[getID(d)] ? "#3182bd" : d.children ? "#c6dbef" : "#fd8d3c"; | ||
} | ||
if (xml.hasChildNodes()) { | ||
for (var i = 0; i < xml.childNodes.length; i++) { | ||
var item = xml.childNodes.item(i); | ||
var child = xmlToJson(item, id + "[" + retVal.children.length + "]"); | ||
retVal.children.push(child); | ||
}; | ||
return Indented; | ||
}(SVGZoomWidget)); | ||
export { Indented }; | ||
Indented.prototype._class += " tree_Indented"; | ||
Indented.prototype.implements(ITree.prototype); | ||
Indented.prototype.mixin(Utility.SimpleSelectionMixin); | ||
Indented.prototype.Column = IndentedColumn; | ||
Indented.prototype.publish("xmlColumn", null, "set", "Field", function () { return this.columns(); }, { optional: true }); | ||
Indented.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: IndentedColumn, disable: function (w) { return w.xmlColumn_exists(); } }); | ||
Indented.prototype.publish("barHeight", 16, "number", "Bar height"); | ||
function xmlToJson(xml, id) { | ||
if (id === void 0) { id = ""; } | ||
var retVal = { | ||
id: id, | ||
label: "", | ||
attributes: {}, | ||
children: [] | ||
}; | ||
retVal.label = xml.nodeName; | ||
if (xml.nodeType === 1) { | ||
if (xml.attributes.length > 0) { | ||
for (var j = 0; j < xml.attributes.length; j++) { | ||
var attribute = xml.attributes.item(j); | ||
retVal.attributes[attribute.nodeName] = attribute.nodeValue; | ||
} | ||
} | ||
return retVal; | ||
} | ||
}); | ||
else if (xml.nodeType === 3) { | ||
retVal.label = xml.nodeValue; | ||
} | ||
if (xml.hasChildNodes()) { | ||
for (var i = 0; i < xml.childNodes.length; i++) { | ||
var item = xml.childNodes.item(i); | ||
var child = xmlToJson(item, id + "[" + retVal.children.length + "]"); | ||
retVal.children.push(child); | ||
} | ||
} | ||
return retVal; | ||
} | ||
//# sourceMappingURL=Indented.js.map |
@@ -1,19 +0,6 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "./CirclePacking", "./Dendrogram", "./Indented", "./SunburstPartition", "./Treemap"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./CirclePacking"), exports); | ||
tslib_1.__exportStar(require("./Dendrogram"), exports); | ||
tslib_1.__exportStar(require("./Indented"), exports); | ||
tslib_1.__exportStar(require("./SunburstPartition"), exports); | ||
tslib_1.__exportStar(require("./Treemap"), exports); | ||
}); | ||
export * from "./CirclePacking"; | ||
export * from "./Dendrogram"; | ||
export * from "./Indented"; | ||
export * from "./SunburstPartition"; | ||
export * from "./Treemap"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,125 +0,113 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
import * as tslib_1 from "tslib"; | ||
import { ITree } from "@hpcc-js/api"; | ||
import { SVGWidget } from "@hpcc-js/common"; | ||
import { hierarchy as d3Hierarchy, partition as d3Parition } from "d3-hierarchy"; | ||
import { interpolate as d3Interpolate } from "d3-interpolate"; | ||
import { scaleLinear as d3ScaleLinear, scaleSqrt as d3ScaleSqrt } from "d3-scale"; | ||
import { event as d3Event, select as d3Select } from "d3-selection"; | ||
import { arc as d3Arc } from "d3-shape"; | ||
import "../src/SunburstPartition.css"; | ||
var SunburstPartition = /** @class */ (function (_super) { | ||
tslib_1.__extends(SunburstPartition, _super); | ||
function SunburstPartition() { | ||
var _this = _super.call(this) || this; | ||
ITree.call(_this); | ||
return _this; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "@hpcc-js/api", "@hpcc-js/common", "d3-hierarchy", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "../src/SunburstPartition.css"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_1 = require("@hpcc-js/api"); | ||
var common_1 = require("@hpcc-js/common"); | ||
var d3_hierarchy_1 = require("d3-hierarchy"); | ||
var d3_interpolate_1 = require("d3-interpolate"); | ||
var d3_scale_1 = require("d3-scale"); | ||
var d3_selection_1 = require("d3-selection"); | ||
var d3_shape_1 = require("d3-shape"); | ||
require("../src/SunburstPartition.css"); | ||
var SunburstPartition = /** @class */ (function (_super) { | ||
tslib_1.__extends(SunburstPartition, _super); | ||
function SunburstPartition() { | ||
var _this = _super.call(this) || this; | ||
api_1.ITree.call(_this); | ||
return _this; | ||
SunburstPartition.prototype.data = function (_) { | ||
var retVal = SVGWidget.prototype.data.apply(this, arguments); | ||
if (arguments.length) { | ||
this._resetRoot = true; | ||
} | ||
SunburstPartition.prototype.data = function (_) { | ||
var retVal = common_1.SVGWidget.prototype.data.apply(this, arguments); | ||
if (arguments.length) { | ||
this._resetRoot = true; | ||
return retVal; | ||
}; | ||
SunburstPartition.prototype.enter = function (_domNode, element) { | ||
var context = this; | ||
this.radius = Math.min(this.width(), this.height()) / 2; | ||
this._xScale = d3ScaleLinear() | ||
.range([0, 2 * Math.PI]); | ||
this._yScale = d3ScaleSqrt() | ||
.range([0, this.radius]); | ||
this.partition = d3Parition(); | ||
this.arc = d3Arc() | ||
.startAngle(function (d) { | ||
return Math.max(0, Math.min(2 * Math.PI, context._xScale(d.x0))); | ||
}) | ||
.endAngle(function (d) { | ||
return Math.max(0, Math.min(2 * Math.PI, context._xScale(d.x1))); | ||
}) | ||
.innerRadius(function (d) { | ||
return Math.max(0, context._yScale(d.y0)); | ||
}) | ||
.outerRadius(function (d) { | ||
return Math.max(0, context._yScale(d.y1)); | ||
}); | ||
this.svg = element.append("g"); | ||
}; | ||
SunburstPartition.prototype.update = function (_domNode, _element) { | ||
var context = this; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
} | ||
this.radius = Math.min(this.width(), this.height()) / 2; | ||
this._yScale.range([0, this.radius]); | ||
var root = d3Hierarchy(this.data()) | ||
.sum(function (d) { | ||
return d.size !== undefined ? d.size : 1; | ||
}); | ||
var paths = this.svg.selectAll("path").data(this.partition(root).descendants(), function (d, i) { | ||
return d.data.label !== undefined ? d.data.label : i; | ||
}); | ||
paths.enter().append("path") | ||
.on("click", function (d) { context.click(d.data, null, null); }) | ||
.on("dblclick", function (d) { | ||
if (d3Event) { | ||
d3Event.stopPropagation(); | ||
} | ||
return retVal; | ||
}; | ||
SunburstPartition.prototype.enter = function (_domNode, element) { | ||
var context = this; | ||
this.radius = Math.min(this.width(), this.height()) / 2; | ||
this._xScale = d3_scale_1.scaleLinear() | ||
.range([0, 2 * Math.PI]); | ||
this._yScale = d3_scale_1.scaleSqrt() | ||
.range([0, this.radius]); | ||
this.partition = d3_hierarchy_1.partition(); | ||
this.arc = d3_shape_1.arc() | ||
.startAngle(function (d) { | ||
return Math.max(0, Math.min(2 * Math.PI, context._xScale(d.x0))); | ||
}) | ||
.endAngle(function (d) { | ||
return Math.max(0, Math.min(2 * Math.PI, context._xScale(d.x1))); | ||
}) | ||
.innerRadius(function (d) { | ||
return Math.max(0, context._yScale(d.y0)); | ||
}) | ||
.outerRadius(function (d) { | ||
return Math.max(0, context._yScale(d.y1)); | ||
}); | ||
this.svg = element.append("g"); | ||
}; | ||
SunburstPartition.prototype.update = function (_domNode, _element) { | ||
var context = this; | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
} | ||
this.radius = Math.min(this.width(), this.height()) / 2; | ||
this._yScale.range([0, this.radius]); | ||
var root = d3_hierarchy_1.hierarchy(this.data()) | ||
.sum(function (d) { | ||
return d.size !== undefined ? d.size : 1; | ||
}); | ||
var paths = this.svg.selectAll("path").data(this.partition(root).descendants(), function (d, i) { | ||
return d.data.label !== undefined ? d.data.label : i; | ||
}); | ||
paths.enter().append("path") | ||
.on("click", function (d) { context.click(d.data, null, null); }) | ||
.on("dblclick", function (d) { | ||
if (d3_selection_1.event) { | ||
d3_selection_1.event.stopPropagation(); | ||
} | ||
context.zoomTo(d); | ||
}) | ||
.each(function () { | ||
var element = d3_selection_1.select(this); | ||
element | ||
.append("title"); | ||
}) | ||
.merge(paths) | ||
.attr("d", this.arc) | ||
.style("fill", function (d) { | ||
return d.data.__viz_fill ? d.data.__viz_fill : context._palette(d.data.label); | ||
}) | ||
.style("stroke", function (d) { | ||
return d.value > 16 ? "white" : "none"; | ||
}) | ||
.select("title") | ||
.text(function (d) { | ||
return d.data.label; | ||
}); | ||
paths.exit().remove(); | ||
if (this._resetRoot) { | ||
this._resetRoot = false; | ||
this.zoomTo(root); | ||
} | ||
}; | ||
SunburstPartition.prototype.zoomTo = function (d) { | ||
var context = this; | ||
this.svg.transition() | ||
.duration(750) | ||
.tween("scale", function () { | ||
var xd = d3_interpolate_1.interpolate(context._xScale.domain(), [d.x0, d.x1]); | ||
var yd = d3_interpolate_1.interpolate(context._yScale.domain(), [d.y0, 1]); | ||
var yr = d3_interpolate_1.interpolate(context._yScale.range(), [d.y0 ? 20 : 0, context.radius]); | ||
return function (t) { context._xScale.domain(xd(t)); context._yScale.domain(yd(t)).range(yr(t)); }; | ||
}) | ||
.selectAll("path") | ||
.attrTween("d", function (d2) { return function () { return context.arc(d2); }; }); | ||
}; | ||
return SunburstPartition; | ||
}(common_1.SVGWidget)); | ||
exports.SunburstPartition = SunburstPartition; | ||
SunburstPartition.prototype._class += " tree_SunburstPartition"; | ||
SunburstPartition.prototype.implements(api_1.ITree.prototype); | ||
SunburstPartition.prototype.publish("paletteID", "default", "set", "Palette ID", SunburstPartition.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
SunburstPartition.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
}); | ||
context.zoomTo(d); | ||
}) | ||
.each(function () { | ||
var element = d3Select(this); | ||
element | ||
.append("title"); | ||
}) | ||
.merge(paths) | ||
.attr("d", this.arc) | ||
.style("fill", function (d) { | ||
return d.data.__viz_fill ? d.data.__viz_fill : context._palette(d.data.label); | ||
}) | ||
.style("stroke", function (d) { | ||
return d.value > 16 ? "white" : "none"; | ||
}) | ||
.select("title") | ||
.text(function (d) { | ||
return d.data.label; | ||
}); | ||
paths.exit().remove(); | ||
if (this._resetRoot) { | ||
this._resetRoot = false; | ||
this.zoomTo(root); | ||
} | ||
}; | ||
SunburstPartition.prototype.zoomTo = function (d) { | ||
var context = this; | ||
this.svg.transition() | ||
.duration(750) | ||
.tween("scale", function () { | ||
var xd = d3Interpolate(context._xScale.domain(), [d.x0, d.x1]); | ||
var yd = d3Interpolate(context._yScale.domain(), [d.y0, 1]); | ||
var yr = d3Interpolate(context._yScale.range(), [d.y0 ? 20 : 0, context.radius]); | ||
return function (t) { context._xScale.domain(xd(t)); context._yScale.domain(yd(t)).range(yr(t)); }; | ||
}) | ||
.selectAll("path") | ||
.attrTween("d", function (d2) { return function () { return context.arc(d2); }; }); | ||
}; | ||
return SunburstPartition; | ||
}(SVGWidget)); | ||
export { SunburstPartition }; | ||
SunburstPartition.prototype._class += " tree_SunburstPartition"; | ||
SunburstPartition.prototype.implements(ITree.prototype); | ||
SunburstPartition.prototype.publish("paletteID", "default", "set", "Palette ID", SunburstPartition.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
SunburstPartition.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
//# sourceMappingURL=SunburstPartition.js.map |
@@ -1,169 +0,157 @@ | ||
(function (factory) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
var v = factory(require, exports); | ||
if (v !== undefined) module.exports = v; | ||
import * as tslib_1 from "tslib"; | ||
import { ITree } from "@hpcc-js/api"; | ||
import { HTMLWidget, PropertyExt, Utility } from "@hpcc-js/common"; | ||
import { hierarchy as d3Hierarchy, treemap as d3Treemap } from "d3-hierarchy"; | ||
import "../src/Treemap.css"; | ||
var TreemapColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(TreemapColumn, _super); | ||
function TreemapColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
} | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "tslib", "@hpcc-js/api", "@hpcc-js/common", "d3-hierarchy", "../src/Treemap.css"], factory); | ||
return TreemapColumn; | ||
}(PropertyExt)); | ||
export { TreemapColumn }; | ||
TreemapColumn.prototype._class += " tree_Dendrogram.TreemapColumn"; | ||
TreemapColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Treemap = /** @class */ (function (_super) { | ||
tslib_1.__extends(Treemap, _super); | ||
function Treemap() { | ||
var _this = _super.call(this) || this; | ||
ITree.call(_this); | ||
Utility.SimpleSelectionMixin.call(_this); | ||
return _this; | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_1 = require("@hpcc-js/api"); | ||
var common_1 = require("@hpcc-js/common"); | ||
var d3_hierarchy_1 = require("d3-hierarchy"); | ||
require("../src/Treemap.css"); | ||
var TreemapColumn = /** @class */ (function (_super) { | ||
tslib_1.__extends(TreemapColumn, _super); | ||
function TreemapColumn(owner) { | ||
var _this = _super.call(this) || this; | ||
_this._owner = owner; | ||
return _this; | ||
Treemap.prototype.treemapData = function () { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
} | ||
return TreemapColumn; | ||
}(common_1.PropertyExt)); | ||
exports.TreemapColumn = TreemapColumn; | ||
TreemapColumn.prototype._class += " tree_Dendrogram.TreemapColumn"; | ||
TreemapColumn.prototype.publish("column", null, "set", "Field", function () { return this._owner ? this._owner.columns() : []; }, { optional: true }); | ||
// === | ||
var Treemap = /** @class */ (function (_super) { | ||
tslib_1.__extends(Treemap, _super); | ||
function Treemap() { | ||
var _this = _super.call(this) || this; | ||
api_1.ITree.call(_this); | ||
common_1.Utility.SimpleSelectionMixin.call(_this); | ||
return _this; | ||
} | ||
Treemap.prototype.treemapData = function () { | ||
if (!this.mappings().filter(function (mapping) { return mapping.column(); }).length) { | ||
return this.data(); | ||
var view = this._db.aggregateView(this.mappings().map(function (mapping) { return mapping.column(); }), this.aggrType(), this.aggrColumn()); | ||
var retVal = { | ||
key: "root", | ||
values: view.entries() | ||
}; | ||
return formatData(retVal); | ||
function formatData(node) { | ||
if (node.values instanceof Array) { | ||
var children = node.values.filter(function (value) { | ||
return !(value instanceof Array); | ||
}).map(function (value) { | ||
return formatData(value); | ||
}); | ||
var retVal2 = { | ||
label: node.key | ||
}; | ||
if (children.length) { | ||
retVal2.children = children; | ||
} | ||
else { | ||
retVal2.size = 22; | ||
} | ||
return retVal2; | ||
} | ||
var view = this._db.aggregateView(this.mappings().map(function (mapping) { return mapping.column(); }), this.aggrType(), this.aggrColumn()); | ||
var retVal = { | ||
key: "root", | ||
values: view.entries() | ||
return { | ||
label: node.key, | ||
size: node.values.aggregate, | ||
origRows: node.values | ||
}; | ||
return formatData(retVal); | ||
function formatData(node) { | ||
if (node.values instanceof Array) { | ||
var children = node.values.filter(function (value) { | ||
return !(value instanceof Array); | ||
}).map(function (value) { | ||
return formatData(value); | ||
}); | ||
var retVal2 = { | ||
label: node.key | ||
}; | ||
if (children.length) { | ||
retVal2.children = children; | ||
} | ||
}; | ||
Treemap.prototype.enter = function (_domNode, element) { | ||
HTMLWidget.prototype.enter.apply(this, arguments); | ||
this._d3Treemap = d3Treemap(); | ||
this._elementDIV = element.append("div"); | ||
this._selection.widgetElement(this._elementDIV); | ||
}; | ||
Treemap.prototype.update = function (_domNode, _element) { | ||
HTMLWidget.prototype.update.apply(this, arguments); | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
} | ||
var root = d3Hierarchy(this.treemapData()) | ||
.sum(function (d) { | ||
return d.size || 50; | ||
}); | ||
this._d3Treemap | ||
.size([this.width(), this.height()]); | ||
this._d3Treemap(root); | ||
this._elementDIV | ||
.style("font-size", this.fontSize_exists() ? this.fontSize() + "px" : null) | ||
.style("line-height", this.fontSize_exists() ? (this.fontSize() + 2) + "px" : null); | ||
var context = this; | ||
var node = this._elementDIV.selectAll(".node").data(root.descendants()); | ||
node.enter().append("div") | ||
.attr("class", "node") | ||
.call(this._selection.enter.bind(this._selection)) | ||
.on("click", function (d) { | ||
if (d && d.origRows) { | ||
var columnLabel_1 = ""; | ||
context.mappings().forEach(function (mapping) { | ||
if (mapping.column()) { | ||
columnLabel_1 = mapping.column(); | ||
} | ||
else { | ||
retVal2.size = 22; | ||
}); | ||
context.click(context.rowToObj(d.origRows[0]), columnLabel_1, context._selection.selected(this)); | ||
} | ||
}) | ||
.on("dblclick", function (d) { | ||
if (d && d.origRows) { | ||
var columnLabel_2 = ""; | ||
context.mappings().forEach(function (mapping) { | ||
if (mapping.column()) { | ||
columnLabel_2 = mapping.column(); | ||
} | ||
return retVal2; | ||
} | ||
return { | ||
label: node.key, | ||
size: node.values.aggregate, | ||
origRows: node.values | ||
}; | ||
}); | ||
context.dblclick(context.rowToObj(d.origRows[0]), columnLabel_2, context._selection.selected(this)); | ||
} | ||
}; | ||
Treemap.prototype.enter = function (_domNode, element) { | ||
common_1.HTMLWidget.prototype.enter.apply(this, arguments); | ||
this._d3Treemap = d3_hierarchy_1.treemap(); | ||
this._elementDIV = element.append("div"); | ||
this._selection.widgetElement(this._elementDIV); | ||
}; | ||
Treemap.prototype.update = function (_domNode, _element) { | ||
common_1.HTMLWidget.prototype.update.apply(this, arguments); | ||
this._palette = this._palette.switch(this.paletteID()); | ||
if (this.useClonedPalette()) { | ||
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id()); | ||
}) | ||
.style("left", function (d) { return (d.x0 + Math.max(0, d.x1 - d.x0) / 2) + "px"; }) | ||
.style("top", function (d) { return (d.y0 + Math.max(0, d.y1 - d.y0) / 2) + "px"; }) | ||
.style("width", function () { return 0 + "px"; }) | ||
.style("height", function () { return 0 + "px"; }) | ||
.merge(node) | ||
.attr("title", tooltip) | ||
.text(function (d) { return d.children ? null : d.data.label; }) | ||
.style("background", function (d) { return d.children ? context._palette(d.data.label) : null; }) | ||
.transition().duration(this.transitionDuration()) | ||
.style("opacity", function (d) { return d.children ? 1 : null; }) | ||
.style("left", function (d) { return d.x0 + "px"; }) | ||
.style("top", function (d) { return d.y0 + "px"; }) | ||
.style("width", function (d) { return Math.max(0, d.x1 - d.x0) + "px"; }) | ||
.style("height", function (d) { return Math.max(0, d.y1 - d.y0) + "px"; }); | ||
node.exit().transition().duration(this.transitionDuration()) | ||
.style("opacity", 0) | ||
.remove(); | ||
function tooltip(d) { | ||
if (d.children) { | ||
return null; | ||
} | ||
var root = d3_hierarchy_1.hierarchy(this.treemapData()) | ||
.sum(function (d) { | ||
return d.size || 50; | ||
}); | ||
this._d3Treemap | ||
.size([this.width(), this.height()]); | ||
this._d3Treemap(root); | ||
this._elementDIV | ||
.style("font-size", this.fontSize_exists() ? this.fontSize() + "px" : null) | ||
.style("line-height", this.fontSize_exists() ? (this.fontSize() + 2) + "px" : null); | ||
var context = this; | ||
var node = this._elementDIV.selectAll(".node").data(root.descendants()); | ||
node.enter().append("div") | ||
.attr("class", "node") | ||
.call(this._selection.enter.bind(this._selection)) | ||
.on("click", function (d) { | ||
if (d && d.origRows) { | ||
var columnLabel_1 = ""; | ||
context.mappings().forEach(function (mapping) { | ||
if (mapping.column()) { | ||
columnLabel_1 = mapping.column(); | ||
} | ||
}); | ||
context.click(context.rowToObj(d.origRows[0]), columnLabel_1, context._selection.selected(this)); | ||
} | ||
}) | ||
.on("dblclick", function (d) { | ||
if (d && d.origRows) { | ||
var columnLabel_2 = ""; | ||
context.mappings().forEach(function (mapping) { | ||
if (mapping.column()) { | ||
columnLabel_2 = mapping.column(); | ||
} | ||
}); | ||
context.dblclick(context.rowToObj(d.origRows[0]), columnLabel_2, context._selection.selected(this)); | ||
} | ||
}) | ||
.style("left", function (d) { return (d.x0 + Math.max(0, d.x1 - d.x0) / 2) + "px"; }) | ||
.style("top", function (d) { return (d.y0 + Math.max(0, d.y1 - d.y0) / 2) + "px"; }) | ||
.style("width", function () { return 0 + "px"; }) | ||
.style("height", function () { return 0 + "px"; }) | ||
.merge(node) | ||
.attr("title", tooltip) | ||
.text(function (d) { return d.children ? null : d.data.label; }) | ||
.style("background", function (d) { return d.children ? context._palette(d.data.label) : null; }) | ||
.transition().duration(this.transitionDuration()) | ||
.style("opacity", function (d) { return d.children ? 1 : null; }) | ||
.style("left", function (d) { return d.x0 + "px"; }) | ||
.style("top", function (d) { return d.y0 + "px"; }) | ||
.style("width", function (d) { return Math.max(0, d.x1 - d.x0) + "px"; }) | ||
.style("height", function (d) { return Math.max(0, d.y1 - d.y0) + "px"; }); | ||
node.exit().transition().duration(this.transitionDuration()) | ||
.style("opacity", 0) | ||
.remove(); | ||
function tooltip(d) { | ||
if (d.children) { | ||
return null; | ||
} | ||
var retVal = d.data.label + " (" + d.value + ")"; | ||
while (d.parent && d.parent.parent) { | ||
retVal = d.parent.data.label + " -> " + retVal; | ||
d = d.parent; | ||
} | ||
return retVal; | ||
var retVal = d.data.label + " (" + d.value + ")"; | ||
while (d.parent && d.parent.parent) { | ||
retVal = d.parent.data.label + " -> " + retVal; | ||
d = d.parent; | ||
} | ||
}; | ||
Treemap.prototype.exit = function (domNode, element) { | ||
_super.prototype.exit.call(this, domNode, element); | ||
}; | ||
return Treemap; | ||
}(common_1.HTMLWidget)); | ||
exports.Treemap = Treemap; | ||
Treemap.prototype._class += " tree_Treemap"; | ||
Treemap.prototype.implements(api_1.ITree.prototype); | ||
Treemap.prototype.mixin(common_1.Utility.SimpleSelectionMixin); | ||
Treemap.prototype.Column = TreemapColumn; | ||
Treemap.prototype.publish("paletteID", "default", "set", "Palette ID", Treemap.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
Treemap.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
Treemap.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: TreemapColumn }); | ||
Treemap.prototype.publish("aggrType", null, "set", "Aggregation Type", [null, "mean", "median", "sum", "min", "max"], { optional: true }); | ||
Treemap.prototype.publish("aggrColumn", null, "set", "Aggregation Field", function () { return this.columns(); }, { optional: true, disable: function (w) { return !w.aggrType(); } }); | ||
Treemap.prototype.publish("fontSize", null, "number", "Font Size", null, { optional: true }); | ||
Treemap.prototype.publish("transitionDuration", 250, "number", "Transition Duration"); | ||
}); | ||
return retVal; | ||
} | ||
}; | ||
Treemap.prototype.exit = function (domNode, element) { | ||
_super.prototype.exit.call(this, domNode, element); | ||
}; | ||
return Treemap; | ||
}(HTMLWidget)); | ||
export { Treemap }; | ||
Treemap.prototype._class += " tree_Treemap"; | ||
Treemap.prototype.implements(ITree.prototype); | ||
Treemap.prototype.mixin(Utility.SimpleSelectionMixin); | ||
Treemap.prototype.Column = TreemapColumn; | ||
Treemap.prototype.publish("paletteID", "default", "set", "Palette ID", Treemap.prototype._palette.switch(), { tags: ["Basic", "Shared"] }); | ||
Treemap.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] }); | ||
Treemap.prototype.publish("mappings", [], "propertyArray", "Source Columns", null, { autoExpand: TreemapColumn }); | ||
Treemap.prototype.publish("aggrType", null, "set", "Aggregation Type", [null, "mean", "median", "sum", "min", "max"], { optional: true }); | ||
Treemap.prototype.publish("aggrColumn", null, "set", "Aggregation Field", function () { return this.columns(); }, { optional: true, disable: function (w) { return !w.aggrType(); } }); | ||
Treemap.prototype.publish("fontSize", null, "number", "Font Size", null, { optional: true }); | ||
Treemap.prototype.publish("transitionDuration", 250, "number", "Transition Duration"); | ||
//# sourceMappingURL=Treemap.js.map |
{ | ||
"name": "@hpcc-js/tree", | ||
"version": "0.0.44", | ||
"version": "0.0.45", | ||
"description": "hpcc-js - Viz Tree", | ||
"main": "lib/index.js", | ||
"module": "lib-es6/index.js", | ||
"main": "build/tree.js", | ||
"module": "lib/index", | ||
"unpkg": "build/tree.min.js", | ||
"types": "lib/index.d.ts", | ||
"unpkg": "dist/tree.min.js", | ||
"files": [ | ||
"build/*", | ||
"lib/*", | ||
"lib-es6/*", | ||
"src/*.css", | ||
"dist/*" | ||
"src/*.css" | ||
], | ||
"scripts": { | ||
"clean": "rimraf lib* && rimraf dist*", | ||
"build": "tsc", | ||
"build-es6": "tsc --module esnext --outDir ./lib-es6", | ||
"bundle": "node ./node_modules/@hpcc-js/bundle/lib/rollup", | ||
"clean": "rimraf lib* && rimraf build", | ||
"compile": "tsc --module esnext --outDir ./lib", | ||
"compile-watch": "npm run compile -- -w", | ||
"compile-umd": "tsc", | ||
"bundle": "rollup -c", | ||
"bundle-watch": "npm run bundle -- -w", | ||
"minimize": "uglifyjs build/tree.js -c -m -o build/tree.min.js", | ||
"build": "npm run compile && npm run bundle", | ||
"watch": "concurrently --kill-others \"npm run compile-watch\" \"npm run bundle-watch\"", | ||
"lint": "tslint --project . src/**/*.ts", | ||
"docs": "typedoc --options tdoptions.json ." | ||
}, | ||
"dependencies": { | ||
"@hpcc-js/api": "^0.0.44", | ||
"@hpcc-js/common": "^0.0.44", | ||
"@hpcc-js/api": "^0.0.45", | ||
"@hpcc-js/common": "^0.0.45", | ||
"d3-hierarchy": "1.1.4", | ||
@@ -30,9 +35,15 @@ "d3-interpolate": "1.1.5", | ||
"d3-shape": "1.2.0", | ||
"d3-transition": "1.1.0", | ||
"tslib": "1.8.0" | ||
}, | ||
"devDependencies": { | ||
"@hpcc-js/bundle": "^0.0.15", | ||
"@hpcc-js/bundle": "^0.0.16", | ||
"concurrently": "3.5.0", | ||
"rimraf": "2.6.1", | ||
"rollup": "0.51.3", | ||
"rollup-plugin-postcss": "0.5.5", | ||
"tslint": "5.8.0", | ||
"typedoc": "0.7.1", | ||
"typescript": "2.5.2" | ||
"typescript": "2.6.1", | ||
"uglify-js": "3.1.8" | ||
}, | ||
@@ -39,0 +50,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
124255
9
9
25
1905
1
+ Addedd3-transition@1.1.0
+ Added@hpcc-js/api@0.0.45(transitive)
+ Added@hpcc-js/common@0.0.45(transitive)
+ Added@hpcc-js/util@0.0.43(transitive)
+ Addedd3-array@1.2.4(transitive)
+ Addedd3-collection@1.0.7(transitive)
+ Addedd3-dispatch@1.0.6(transitive)
+ Addedd3-format@1.4.5(transitive)
+ Addedd3-transition@1.1.0(transitive)
- Removed@hpcc-js/api@0.0.44(transitive)
- Removed@hpcc-js/common@0.0.44(transitive)
- Removedcolorbrewer@1.0.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedd3-array@1.2.0(transitive)
- Removedd3-brush@1.0.4(transitive)
- Removedd3-collection@1.0.4(transitive)
- Removedd3-dispatch@1.0.3(transitive)
- Removedd3-drag@1.1.0(transitive)
- Removedd3-dsv@1.0.5(transitive)
- Removedd3-format@1.2.0(transitive)
- Removedd3-transition@1.3.2(transitive)
- Removedd3-zoom@1.3.0(transitive)
- Removedes6-promise@4.1.1(transitive)
- Removedfont-awesome@4.7.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedrw@1.3.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
Updated@hpcc-js/api@^0.0.45
Updated@hpcc-js/common@^0.0.45