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,310 +0,0 @@
1
- /**
2
- * Same as group in graphical design tools
3
- **/
4
-
5
- import Rectangle from "../../basic/Rectangle";
6
- import {DataType, ItemType} from "../../util/Constants";
7
- import {ItemCounter} from "../../util/ItemUtil";
8
-
9
- export default class Group {
10
-
11
- constructor() {
12
- this.children = [];
13
- this._dataScope = undefined;
14
- this._layout = undefined;
15
- this.type = ItemType.Group;
16
- this._id = this.type + ItemCounter[this.type]++;
17
- }
18
-
19
- get id() {
20
- return this._id;
21
- }
22
-
23
- set id(id) {
24
- if (this.type === ItemType.Scene || !this.getScene())
25
- this._id = id;
26
- else {
27
- delete this.getScene()._itemMap[this._id];
28
- this._id = id;
29
- this.getScene()._itemMap[id] = this;
30
- }
31
- }
32
-
33
- contains(x, y) {
34
- if (!this._bounds) {
35
- this._updateBounds();
36
- }
37
- return this._bounds.contains(x, y);
38
- }
39
-
40
- toJSON() {
41
- let json = {};
42
- json.type = this.type;
43
- json.id = this.id;
44
- if (this._dataScope)
45
- json.dataScope = this._dataScope.toJSON();
46
- if (this.classId)
47
- json.classId = this.classId;
48
- if (this._layout)
49
- json.layout = this._layout.toJSON();
50
- if (this._bounds)
51
- json.bounds = this._bounds.toJSON();
52
- json.children = [];
53
- if (this.children.length > 0) { //&& this.type != ItemType.Axis
54
- for (let c of this.children) {
55
- json.children.push(c.toJSON());
56
- }
57
- }
58
- if (this.childrenOrder) {
59
- json.childrenOrder = this.childrenOrder;
60
- }
61
- return json;
62
- }
63
-
64
- addChild(c) {
65
- if (this.children.indexOf(c) >= 0) return;
66
- if (c.parent)
67
- c.parent.removeChild(c);
68
- this.children.push(c);
69
- c.parent = this;
70
- }
71
-
72
- addChildAt(c,index){
73
- if (c.parent)
74
- c.parent.removeChild(c);
75
- this.children.splice(index, 0, c);
76
- c.parent = this;
77
- }
78
-
79
- removeChild(c) {
80
- let idx = this.children.indexOf(c);
81
- if (idx >= 0) {
82
- this.children.splice(idx, 1);
83
- c.parent = null;
84
- }
85
- }
86
-
87
- removeChildAt(i) {
88
- this.children[i].parent = null;
89
- this.children.splice(i, 1);
90
- }
91
-
92
- removeAll() {
93
- for (let c of this.children)
94
- c.parent = null;
95
- this.children = [];
96
- }
97
-
98
- getScene() {
99
- let p = this;
100
- while (p) {
101
- if (p.type == ItemType.Scene)
102
- return p;
103
- else
104
- p = p.parent;
105
- }
106
- }
107
-
108
- get dataScope() {
109
- return this._dataScope;
110
- }
111
-
112
- set dataScope(ds) {
113
- this._dataScope = ds;
114
- if (ds === undefined) {
115
- for (let c of this.children) {
116
- c.dataScope = ds;
117
- }
118
- } else {
119
- for (let c of this.children) {
120
- if (c.dataScope)
121
- c.dataScope = c.dataScope.merge(ds);
122
- else
123
- c.dataScope = ds;
124
- }
125
- }
126
- }
127
-
128
- _doTranslate(dx, dy) {
129
- for (let child of this.children) {
130
- child._doTranslate(dx, dy);
131
- }
132
- this._updateBounds();
133
- if (this._layout) {
134
- if (this._layout._left !== undefined)
135
- this._layout._left += dx;
136
- if (this._layout._top !== undefined)
137
- this._layout._top += dy;
138
- if (this._layout.x !== undefined)
139
- this._layout.x += dx;
140
- if (this._layout.y !== undefined)
141
- this._layout.y += dy;
142
- //this._layout.run();
143
- }
144
- this._updateBounds();
145
- }
146
-
147
- getInternalEncodings(channel) {
148
- if (this.children.length == 0)
149
- return [];
150
- let item = this.children[0], scene = this.getScene();
151
- let encodingKeys = Object.keys(scene.encodings);
152
- let classIds = [];
153
- while(item) {
154
- if (item.classId && classIds.indexOf(item.classId) < 0)
155
- classIds.push(item.classId);
156
- if (item.type === ItemType.Glyph) {
157
- item.children.forEach(d => classIds.push(d.classId));
158
- break;
159
- } else if (item.children) {
160
- item = item.children[0];
161
- } else
162
- break;
163
- }
164
- let result = [];
165
- for (let k of encodingKeys) {
166
- let tokens = k.split("_");
167
- for (let classId of classIds) {
168
- if (tokens[0] == classId) {
169
- if (scene.encodings[k][channel])
170
- result.push(scene.encodings[k][channel]);
171
- }
172
- }
173
- }
174
- return result;
175
- }
176
-
177
- get firstChild() {
178
- return this.children[0];
179
- }
180
-
181
- get lastChild() {
182
- return this.children[this.children.length - 1];
183
- }
184
-
185
- set layout(l) {
186
- this._layout = l;
187
- if (l) {
188
- l.group = this;
189
- this._layout.run();
190
- } else {
191
- //check if there are position encodings and reapply them
192
- let xEncs = this.getInternalEncodings("x"),
193
- yEncs = this.getInternalEncodings("y");
194
- for (let e of xEncs) {
195
- e._map();
196
- e._apply();
197
- }
198
- for (let e of yEncs) {
199
- e._map();
200
- e._apply();
201
- }
202
- }
203
- }
204
-
205
- get layout() {
206
- return this._layout;
207
- }
208
-
209
- get bounds() {
210
- if (!this._bounds) {
211
- this._updateBounds();
212
- }
213
- return this._bounds;
214
- }
215
-
216
- get refBounds() {
217
- let cRefBounds = this.children.map (d => d.refBounds);
218
- let left = Math.min(...cRefBounds.map(d => d.left)), top = Math.min(...cRefBounds.map(d => d.top)),
219
- right = Math.max(...cRefBounds.map(d => d.right)), bottom = Math.max(...cRefBounds.map(d => d.bottom));
220
- return new Rectangle(left, top, right - left, bottom - top);
221
- }
222
-
223
- get x() {
224
- return this.bounds.x;
225
- }
226
-
227
- get y() {
228
- return this.bounds.y;
229
- }
230
-
231
- _updateBounds() {
232
- if (this.children.length > 0){
233
- this._bounds = this.children[0].bounds.clone();
234
- for (let i = 1; i < this.children.length; i++) {
235
- if (this.children[i].visibility == "hidden")
236
- continue;
237
- this._bounds = this._bounds.union(this.children[i].bounds);
238
- }
239
- if (this._layout && this._layout.type == "grid") {
240
- let cellBounds = this._layout.cellBounds;
241
- for (let i = 0; i < cellBounds.length; i++) {
242
- this._bounds = this._bounds.union(cellBounds[i]);
243
- }
244
- }
245
- } else {
246
- this._bounds = new Rectangle(0, 0, 0, 0);
247
- }
248
- }
249
-
250
- sortChildrenByData(field, reverse, order) {
251
- let type = this.children[0].dataScope.getFieldType(field);
252
- let f;
253
- switch (type) {
254
- case DataType.Date:
255
- break;
256
- case DataType.Number:
257
- case DataType.Integer:
258
- f = (a, b) => a.dataScope.aggregateNumericalField(field) - b.dataScope.aggregateNumericalField(field);
259
- break;
260
- case DataType.String:
261
- if (order)
262
- f = (a, b) => order.indexOf(a.dataScope.getFieldValue(field)) - order.indexOf(b.dataScope.getFieldValue(field));
263
- else
264
- f = (a, b) => (a.dataScope.getFieldValue(field) < b.dataScope.getFieldValue(field) ? -1 : 1 );
265
- break;
266
- }
267
- this.children.sort(f);
268
- if (reverse)
269
- this.children.reverse();
270
- if (this.layout)
271
- this.layout.run();
272
- this._childrenOrder = {field: field, direction: reverse ? "desc" : "asc", ranking: order};
273
- }
274
-
275
- sortChildren(channel, reverse){
276
- let f;
277
- switch (channel){
278
- case "x":
279
- case "y":
280
- case "width":
281
- case "height":
282
- f = (a, b) => a.bounds[channel] - b.bounds[channel];
283
- break;
284
- default:
285
- f = (a, b) => a[channel] - b[channel];
286
- break;
287
- }
288
- this.children.sort(f);
289
- if (reverse)
290
- this.children.reverse();
291
- if (this.layout)
292
- this.layout.run();
293
- this.childrenOrder = {channel: channel, reverse: reverse};
294
- }
295
-
296
- set visibility(v) {
297
- if (v == "hidden")
298
- this._visibility = v;
299
- else
300
- this._visibility = "visible";
301
- for (let c of this.children)
302
- c.visibility = v;
303
- }
304
-
305
- get visibility() {
306
- if (!this._visibility)
307
- return "visible";
308
- return this._visibility;
309
- }
310
- }