mascot-vis 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/mascot-esm.js +186 -0
  2. package/package.json +3 -6
  3. package/dist/mascot-es.js +0 -27745
  4. package/dist/mascot-min.js +0 -186
  5. package/dist/mascot-umd.js +0 -27781
  6. package/js/depGraphVis.js +0 -66
  7. package/src-new-ts/action/createElement.ts +0 -91
  8. package/src-new-ts/action/encode.js +0 -20
  9. package/src-new-ts/action/repeat.js +0 -128
  10. package/src-new-ts/action/traverseScene.js +0 -41
  11. package/src-new-ts/data/Network.js +0 -2
  12. package/src-new-ts/data/Scope.js +0 -135
  13. package/src-new-ts/data/Table.js +0 -263
  14. package/src-new-ts/data/Tree.js +0 -3
  15. package/src-new-ts/data/field.ts +0 -115
  16. package/src-new-ts/data/import.ts +0 -96
  17. package/src-new-ts/data/predicate.ts +0 -82
  18. package/src-new-ts/depgraph/DepGraph.js +0 -178
  19. package/src-new-ts/depgraph/Edge.js +0 -9
  20. package/src-new-ts/depgraph/SceneGraph2DepGraph.js +0 -110
  21. package/src-new-ts/depgraph/Signal.js +0 -12
  22. package/src-new-ts/depgraph/operator/BoundsEvaluator.js +0 -30
  23. package/src-new-ts/depgraph/operator/Dataflow.js +0 -41
  24. package/src-new-ts/depgraph/operator/DomainBuilder.js +0 -50
  25. package/src-new-ts/depgraph/updateDepGraph.js +0 -45
  26. package/src-new-ts/depgraph/variable/BoundsVar.js +0 -81
  27. package/src-new-ts/depgraph/variable/ChannelVar.js +0 -17
  28. package/src-new-ts/depgraph/variable/DataScopeVar.js +0 -12
  29. package/src-new-ts/depgraph/variable/DomainVar.js +0 -15
  30. package/src-new-ts/depgraph/variable/FieldVar.js +0 -17
  31. package/src-new-ts/depgraph/variable/LayoutParameter.js +0 -8
  32. package/src-new-ts/depgraph/variable/ScaleVar.js +0 -13
  33. package/src-new-ts/depgraph/variable/Variable.js +0 -39
  34. package/src-new-ts/element/gradient/LinearGradient.js +0 -37
  35. package/src-new-ts/element/group/Collection.js +0 -109
  36. package/src-new-ts/element/group/Group.js +0 -307
  37. package/src-new-ts/element/group/Scene.js +0 -98
  38. package/src-new-ts/element/mark/CircleMark.ts +0 -85
  39. package/src-new-ts/element/mark/Mark.ts +0 -233
  40. package/src-new-ts/element/mark/PathMark.js +0 -483
  41. package/src-new-ts/element/mark/Segment.js +0 -29
  42. package/src-new-ts/element/mark/Vertex.js +0 -118
  43. package/src-new-ts/encode/Scale.ts +0 -115
  44. package/src-new-ts/index.ts +0 -19
  45. package/src-new-ts/layout/Layout.ts +0 -3
  46. package/src-new-ts/render/CanvasRenderer.ts +0 -24
  47. package/src-new-ts/render/SVGRenderer.js +0 -316
  48. package/src-new-ts/util.ts +0 -3
  49. package/src-old/action/Classify.js +0 -53
  50. package/src-old/action/Densify.js +0 -199
  51. package/src-old/action/Partition.js +0 -531
  52. package/src-old/action/Repeat.js +0 -106
  53. package/src-old/action/Repopulate.js +0 -44
  54. package/src-old/action/Stratify.js +0 -156
  55. package/src-old/basic/Gradient.js +0 -37
  56. package/src-old/basic/Point.js +0 -51
  57. package/src-old/basic/Rectangle.js +0 -63
  58. package/src-old/bind/bindToAngle.js +0 -56
  59. package/src-old/bind/bindToAreaMark.js +0 -360
  60. package/src-old/bind/bindToColor.js +0 -114
  61. package/src-old/bind/bindToLink.js +0 -81
  62. package/src-old/bind/bindToPosition.js +0 -283
  63. package/src-old/bind/bindToRadialDistance.js +0 -62
  64. package/src-old/bind/bindToSize.js +0 -235
  65. package/src-old/bind/bindToText.js +0 -60
  66. package/src-old/bind/bindToThickness.js +0 -100
  67. package/src-old/constraint/AffixConstraint.js +0 -129
  68. package/src-old/constraint/AlignConstraint.js +0 -58
  69. package/src-old/core/Encoding.js +0 -336
  70. package/src-old/core/Scale.js +0 -322
  71. package/src-old/core/SceneLoader.js +0 -290
  72. package/src-old/core/SceneValidator.js +0 -232
  73. package/src-old/core/SpecExecutor.js +0 -113
  74. package/src-old/core/SpecGenerator.js +0 -350
  75. package/src-old/data/DataImporter.js +0 -64
  76. package/src-old/data/DataScope.js +0 -124
  77. package/src-old/data/DataTable.js +0 -338
  78. package/src-old/data/Network.js +0 -106
  79. package/src-old/data/Tree.js +0 -251
  80. package/src-old/data/transform/Bin.js +0 -46
  81. package/src-old/data/transform/Filter.js +0 -48
  82. package/src-old/data/transform/Groupby.js +0 -18
  83. package/src-old/data/transform/KDE.js +0 -58
  84. package/src-old/data/transform/Sort.js +0 -14
  85. package/src-old/data/transform/Split.js +0 -5
  86. package/src-old/data/transform/partition.js +0 -46
  87. package/src-old/history/UndoRedoStack +0 -0
  88. package/src-old/index.js +0 -271
  89. package/src-old/indexSVG.js +0 -259
  90. package/src-old/interaction/Interaction.js +0 -91
  91. package/src-old/interaction/MouseEvent.js +0 -8
  92. package/src-old/interaction/Selection.js +0 -9
  93. package/src-old/interaction/brush.js +0 -362
  94. package/src-old/item/Segment.js +0 -29
  95. package/src-old/item/Vertex.js +0 -118
  96. package/src-old/item/composite/Collection.js +0 -106
  97. package/src-old/item/composite/Glyph.js +0 -19
  98. package/src-old/item/composite/Group.js +0 -310
  99. package/src-old/item/composite/Scene.js +0 -1251
  100. package/src-old/item/mark/ArcPath.js +0 -181
  101. package/src-old/item/mark/AreaPath.js +0 -78
  102. package/src-old/item/mark/CirclePath.js +0 -102
  103. package/src-old/item/mark/EllipsePath.js +0 -5
  104. package/src-old/item/mark/Image.js +0 -101
  105. package/src-old/item/mark/LinkPath.js +0 -118
  106. package/src-old/item/mark/Mark.js +0 -163
  107. package/src-old/item/mark/Path.js +0 -494
  108. package/src-old/item/mark/PointText.js +0 -201
  109. package/src-old/item/mark/PolygonPath.js +0 -64
  110. package/src-old/item/mark/RectPath.js +0 -88
  111. package/src-old/item/mark/RingPath.js +0 -92
  112. package/src-old/item/refs/Axis.js +0 -362
  113. package/src-old/item/refs/EncodingAxis.js +0 -515
  114. package/src-old/item/refs/Gridlines.js +0 -144
  115. package/src-old/item/refs/LayoutAxis.js +0 -316
  116. package/src-old/item/refs/Legend.js +0 -273
  117. package/src-old/layout/Circular.js +0 -95
  118. package/src-old/layout/Force.js +0 -52
  119. package/src-old/layout/Grid.js +0 -423
  120. package/src-old/layout/Layout.js +0 -13
  121. package/src-old/layout/Packing.js +0 -56
  122. package/src-old/layout/Stack.js +0 -264
  123. package/src-old/layout/Strata.js +0 -88
  124. package/src-old/layout/Sugiyama.js +0 -59
  125. package/src-old/layout/TidyTree.js +0 -105
  126. package/src-old/layout/Treemap.js +0 -87
  127. package/src-old/renderer/SVGInteractionHandler.js +0 -241
  128. package/src-old/renderer/SVGRenderer.js +0 -325
  129. package/src-old/renderer/WebGLRenderer.js +0 -1097
  130. package/src-old/renderer/WebGLRenderer2.js +0 -249
  131. package/src-old/renderer/threejs/Line2.js +0 -18
  132. package/src-old/renderer/threejs/LineGeometry.js +0 -77
  133. package/src-old/renderer/threejs/LineMaterial.js +0 -605
  134. package/src-old/renderer/threejs/LineSegments2.js +0 -281
  135. package/src-old/renderer/threejs/LineSegmentsGeometry.js +0 -226
  136. package/src-old/renderer/threejs/Wireframe.js +0 -51
  137. package/src-old/renderer/threejs/WireframeGeometry2.js +0 -16
  138. package/src-old/scale/areaSize.js +0 -0
  139. package/src-old/scale/domain.js +0 -38
  140. package/src-old/util/Constants.js +0 -180
  141. package/src-old/util/DataUtil.js +0 -35
  142. package/src-old/util/ItemUtil.js +0 -586
  143. package/src-old/util/Numerical.js +0 -33
  144. package/tests/demo-tests/README.md +0 -80
  145. package/tests/demo-tests/SVG2PNG.js +0 -56
  146. package/tests/demo-tests/demos2CanvasPNGs.js +0 -69
  147. package/tests/demo-tests/demos2ScenesSVGs.js +0 -100
  148. package/tests/demo-tests/pathElementWorker.js +0 -91
  149. package/tests/demo-tests/pixelTest.js +0 -62
  150. package/tests/demo-tests/renderDemos.html +0 -132
  151. package/tests/demo-tests/serializationTest.js +0 -36
  152. package/tests/demo-tests/serializeDemos.html +0 -134
  153. package/tests/unit-tests/README.md +0 -4
  154. package/tests/unit-tests/jasmine-browser.json +0 -21
  155. package/tests/unit-tests/jasmine.json +0 -14
  156. package/tests/unit-tests/testSpec.js +0 -274
@@ -1,156 +0,0 @@
1
- import StrataLayout from "../layout/Strata";
2
- import { Direction, Errors, ItemType } from "../util/Constants";
3
- import { normalizeAngle } from "../util/DataUtil";
4
- import { getPeers } from "../util/ItemUtil";
5
-
6
- export function stratifyItem(scene, compnt, direction, size, tree) {
7
- switch (compnt.type) {
8
- // case ItemType.Line:
9
- // return _doLineDivide(scene, compnt, f, datatable);
10
- case ItemType.Circle:
11
- return _doCircleStratify(scene, compnt, direction, size, tree);
12
- case ItemType.Rect:
13
- return _doRectStratify(scene, compnt, direction, size, tree);
14
- // case ItemType.Pie:
15
- // return _doPieDivide(scene, compnt, orientation, f, datatable);
16
- }
17
- }
18
-
19
- function _doCircleStratify(scene, compnt, dir, sz, tree) {
20
- let toReturn, direction = dir ? dir : Direction.Outward, size = sz ? sz : 50;
21
- if (direction !== Direction.Inward && direction !== Direction.Outward) {
22
- throw Errors.UNKNOWN_DIRECTION + " " + direction;
23
- }
24
- let peers = getPeers(compnt, scene);
25
- let collClassId;
26
- peers.forEach(p => {
27
- let coll = scene.collection();
28
- coll.dataScope = undefined;
29
- if (collClassId == undefined)
30
- collClassId = coll.id;
31
- coll.classId = collClassId;
32
- let parent = p.parent;
33
- _addArcStrata(p, compnt.id, direction, size, tree, tree.getRoot(), coll, scene, true);
34
- coll.layout = new StrataLayout({direction: direction, rootMark: p});
35
- parent.addChild(coll);
36
-
37
- if (p === compnt)
38
- toReturn = coll;
39
- });
40
- return toReturn;
41
- }
42
-
43
- function _addArcStrata(compnt, classId, direction, size, tree, node, coll, scene, isRoot) {
44
- if (isRoot) {
45
- compnt.dataScope = tree.getNodeDataScope(node);
46
- // console.log(mark.dataScope);
47
- compnt.classId = classId;
48
- coll.addChild(compnt);
49
- }
50
- let children = tree.getChildren(node);
51
- if (children.length === 0) return;
52
- let start = compnt.type === ItemType.Circle || compnt.type === ItemType.Ring ? 90 : compnt.startAngle,
53
- extent = compnt.type === ItemType.Circle || compnt.type === ItemType.Ring ? 360 : compnt.angle,
54
- angle = extent/children.length;
55
- for (let i = 0; i < children.length; i++) {
56
- let ir = compnt.type === ItemType.Circle ? compnt.radius : compnt.outerRadius;
57
- let mark;
58
- if (angle === 360) {
59
- mark = scene.mark("ring", {
60
- innerRadius: ir,
61
- outerRadius: ir + size,
62
- x: compnt.x,
63
- y: compnt.y,
64
- strokeColor: compnt.strokeColor,
65
- fillColor: compnt.fillColor,
66
- strokeWidth: compnt.strokeWidth,
67
- opacity: compnt.opacity
68
- });
69
- } else {
70
- mark = scene.mark("arc", {
71
- innerRadius: ir,
72
- outerRadius: ir + size,
73
- x: compnt.x,
74
- y: compnt.y,
75
- startAngle: normalizeAngle(start + angle * i),
76
- endAngle: normalizeAngle(start + angle * (i+1)),
77
- strokeColor: compnt.strokeColor,
78
- fillColor: compnt.fillColor,
79
- strokeWidth: compnt.strokeWidth,
80
- opacity: compnt.opacity
81
- });
82
- }
83
- mark.dataScope = tree.getNodeDataScope(children[i]);
84
- // console.log(mark.dataScope);
85
- mark.classId = classId;
86
- coll.addChild(mark);
87
- _addArcStrata(mark, classId, direction, size, tree, children[i], coll, scene);
88
- }
89
- }
90
-
91
- function _doRectStratify(scene, compnt, dir, sz, tree) {
92
- let toReturn, direction = dir ? dir : Direction.Down, size = sz ? sz : 50;
93
- if ([Direction.Up, Direction.Down, Direction.Left, Direction.Right].indexOf(direction) < 0) {
94
- throw Errors.UNKNOWN_DIRECTION + " " + direction;
95
- }
96
- let peers = getPeers(compnt, scene);
97
- let collClassId;
98
- peers.forEach(p => {
99
- let coll = scene.collection();
100
- coll.dataScope = undefined;
101
- if (collClassId == undefined)
102
- collClassId = coll.id;
103
- coll.classId = collClassId;
104
- let parent = p.parent;
105
- _addRectStrata(p, compnt.id, direction, size, tree, tree.getRoot(), coll, scene, true);
106
- coll.layout = new StrataLayout({direction: direction, rootMark: p});
107
- parent.addChild(coll);
108
-
109
- if (p === compnt)
110
- toReturn = coll;
111
- });
112
- return toReturn;
113
- }
114
-
115
- function _addRectStrata(compnt, classId, direction, size, tree, node, coll, scene, isRoot) {
116
- if (isRoot) {
117
- compnt.dataScope = tree.getNodeDataScope(node);
118
- compnt.classId = classId;
119
- coll.addChild(compnt);
120
- }
121
- let children = tree.getChildren(node);
122
- if (children.length === 0) return;
123
- let x, y, width, height;
124
- switch (direction) {
125
- case Direction.Up:
126
- case Direction.Down:
127
- case Direction.Left:
128
- case Direction.Right:
129
- default:
130
- x = compnt.left;
131
- y = compnt.bottom;
132
- width = compnt.width/children.length;
133
- break;
134
- }
135
-
136
- // let start = compnt.type === ItemType.Circle || compnt.type === ItemType.Ring ? 90 : compnt.startAngle,
137
- // extent = compnt.type === ItemType.Circle || compnt.type === ItemType.Ring ? 360 : compnt.angle,
138
- // angle = extent/children.length;
139
- for (let i = 0; i < children.length; i++) {
140
- let mark = scene.mark("rect", {
141
- left: x,
142
- top: y,
143
- width: width,
144
- height: size,
145
- strokeColor: compnt.strokeColor,
146
- fillColor: compnt.fillColor,
147
- strokeWidth: compnt.strokeWidth,
148
- opacity: compnt.opacity
149
- });
150
- x += width;
151
- mark.dataScope = tree.getNodeDataScope(children[i]);
152
- mark.classId = classId;
153
- coll.addChild(mark);
154
- _addRectStrata(mark, classId, direction, size, tree, children[i], coll, scene);
155
- }
156
- }
@@ -1,37 +0,0 @@
1
- import {ItemType} from "../util/Constants";
2
- import { ItemCounter } from "../util/ItemUtil";
3
-
4
- export default class LinearGradient {
5
-
6
- constructor(params) {
7
- let args = params ? params: {};
8
- this._stops = [];
9
- this.type = ItemType.LinearGradient;
10
- this.id = this.type + ItemCounter[this.type]++;
11
- this.x1 = ("x1" in args) ? args.x1 : 0;
12
- this.x2 = ("x2" in args) ? args.x2 : 100;
13
- this.y1 = ("y1" in args) ? args.y1 : 0;
14
- this.y2 = ("y2" in args) ? args.y2 : 0;
15
- }
16
-
17
- toJSON() {
18
- let json = {};
19
- json.type = this.type;
20
- json.id = this.id;
21
- json.x1 = this.x1;
22
- json.x2 = this.x2;
23
- json.y1 = this.y1;
24
- json.y2 = this.y2;
25
- json.stops = this._stops;
26
- return json;
27
- }
28
-
29
- addStop(offset, color, opacity) {
30
- this._stops.push({offset: offset, color: color, opacity: opacity});
31
- }
32
-
33
- get stops() {
34
- return this._stops;
35
- }
36
-
37
- }
@@ -1,51 +0,0 @@
1
- // Based on basic.Point.js, as part of Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
2
- // http://paperjs.org/
3
- // Copyright (c) 2011 - 2019, Juerg Lehni & Jonathan Puckey
4
- // http://scratchdisk.com/ & https://puckey.studio/
5
- //
6
- // Distributed under the MIT license. See LICENSE file for detail
7
- //
8
- // All rights reserved.
9
-
10
- import {isZero, TRIGONOMETRIC_EPSILON} from "../util/Numerical"
11
-
12
- export default class Point {
13
-
14
- constructor(x, y) {
15
- this.x = x;
16
- this.y = y;
17
- }
18
-
19
- transform(matrix) {
20
- return matrix ? matrix._transformPoint(this) : this;
21
- }
22
-
23
- negate() {
24
- return new Point(-this.x, -this.y);
25
- }
26
-
27
- subtract(point) {
28
- return new Point(this.x - point.x, this.y - point.y);
29
- }
30
-
31
- isZero() {
32
- return isZero(this.x) && isZero(this.y)
33
- }
34
-
35
- /**
36
- * Checks if the vector represented by this point is collinear (parallel) to
37
- * another vector.
38
- *
39
- * @param {Point} point the vector to check against
40
- * @return {Boolean} {@true it is collinear}
41
- */
42
- isCollinear(point) {
43
- let x1 = this.x,
44
- y1 = this.y,
45
- x2 = point.x,
46
- y2 = point.y;
47
- return Math.abs(x1 * y2 - y1 * x2) <= Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2))
48
- * /*#=*/TRIGONOMETRIC_EPSILON;
49
- }
50
-
51
- }
@@ -1,63 +0,0 @@
1
- export default class Rectangle {
2
-
3
- constructor(left, top, width, height) {
4
- this.left = left;
5
- this.top = top;
6
- this.width = width;
7
- this.height = height;
8
- }
9
-
10
- toJSON() {
11
- let json = {};
12
- json.left = this.left;
13
- json.top = this.top;
14
- json.width = this.width;
15
- json.height = this.height;
16
- return json;
17
- }
18
-
19
- union(rect) {
20
- let left = Math.min(this.left, rect.left),
21
- top = Math.min(this.top, rect.top),
22
- right = Math.max(this.right, rect.right),
23
- btm = Math.max(this.bottom, rect.bottom);
24
- return new Rectangle(left, top, right - left, btm - top);
25
- }
26
-
27
- clone() {
28
- return new Rectangle(this.left, this.top, this.width, this.height);
29
- }
30
-
31
- get right() {
32
- return this.left + this.width;
33
- }
34
-
35
- get bottom() {
36
- return this.top + this.height;
37
- }
38
-
39
- get x() {
40
- return (this.left + this.right)/2;
41
- }
42
-
43
- get y() {
44
- return (this.top + this.bottom)/2;
45
- }
46
-
47
- get center() {
48
- return (this.left + this.right)/2;
49
- }
50
-
51
- get middle() {
52
- return (this.top + this.bottom)/2;
53
- }
54
-
55
- contains(x, y) {
56
- return this.left <= x && this.right >= x && this.top <= y && this.bottom >= y;
57
- }
58
-
59
- overlap(r) {
60
- return !(this.right < r.left || this.bottom < r.top || this.left > r.right || this.top > r.bottom);
61
- }
62
-
63
- }
@@ -1,56 +0,0 @@
1
- import Scale from "../core/Scale";
2
- import {DataType, ItemType} from "../util/Constants";
3
- import { normalizeAngle } from "../util/DataUtil";
4
-
5
- export function bindToAngle(encoding){
6
-
7
- encoding._query = function() {
8
- this.data = [];
9
- this.id2data = {};
10
-
11
- let field = this.field, items = this.items;
12
-
13
- switch (this.datatable.getFieldType(field)) {
14
- case DataType.Boolean:
15
- break;
16
-
17
- case DataType.Date:
18
- this.data = items.map(d => d.dataScope.getFieldValue(field));
19
- break;
20
-
21
- case DataType.String:
22
- break;
23
-
24
- default: //integer or number
25
- this.data = items.map(d => d.dataScope.aggregateNumericalField(field, this.aggregator));
26
- break;
27
- }
28
- for (let i = 0; i < this.data.length; i++) {
29
- this.id2data[items[i].id] = this.data[i];
30
- }
31
- }
32
-
33
- encoding._map = function() {
34
- if (this.scale) {
35
- } else {
36
- this.scale = new Scale("linear");
37
- this.scale.domain = this.datatable.tree ? [0, Math.max(...this.data)] : [0, this.data.reduce((a, d) => a + d, 0)];
38
- this.scale._setRange([0, 360]);
39
- this.scale._addEncoding(this);
40
- }
41
- }
42
-
43
- encoding._apply = function() {
44
- let peer;
45
- for (let i = 0; i < this.items.length; i++) {
46
- peer = this.items[i];
47
- if (peer.type === ItemType.Arc || peer.type === ItemType.Pie) {
48
- peer.adjustAngle(peer.startAngle, normalizeAngle(peer.startAngle + this.scale.map(this.data[i])));
49
- }
50
- }
51
- this.scene._relayoutAncestors(this.anyItem, this.items);
52
- }
53
-
54
- encoding.run();
55
- return encoding;
56
- }