mascot-vis 3.0.0 → 3.0.1

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 (152) hide show
  1. package/package.json +1 -2
  2. package/js/depGraphVis.js +0 -66
  3. package/src-new-ts/action/createElement.ts +0 -91
  4. package/src-new-ts/action/encode.js +0 -20
  5. package/src-new-ts/action/repeat.js +0 -128
  6. package/src-new-ts/action/traverseScene.js +0 -41
  7. package/src-new-ts/data/Network.js +0 -2
  8. package/src-new-ts/data/Scope.js +0 -135
  9. package/src-new-ts/data/Table.js +0 -263
  10. package/src-new-ts/data/Tree.js +0 -3
  11. package/src-new-ts/data/field.ts +0 -115
  12. package/src-new-ts/data/import.ts +0 -96
  13. package/src-new-ts/data/predicate.ts +0 -82
  14. package/src-new-ts/depgraph/DepGraph.js +0 -178
  15. package/src-new-ts/depgraph/Edge.js +0 -9
  16. package/src-new-ts/depgraph/SceneGraph2DepGraph.js +0 -110
  17. package/src-new-ts/depgraph/Signal.js +0 -12
  18. package/src-new-ts/depgraph/operator/BoundsEvaluator.js +0 -30
  19. package/src-new-ts/depgraph/operator/Dataflow.js +0 -41
  20. package/src-new-ts/depgraph/operator/DomainBuilder.js +0 -50
  21. package/src-new-ts/depgraph/updateDepGraph.js +0 -45
  22. package/src-new-ts/depgraph/variable/BoundsVar.js +0 -81
  23. package/src-new-ts/depgraph/variable/ChannelVar.js +0 -17
  24. package/src-new-ts/depgraph/variable/DataScopeVar.js +0 -12
  25. package/src-new-ts/depgraph/variable/DomainVar.js +0 -15
  26. package/src-new-ts/depgraph/variable/FieldVar.js +0 -17
  27. package/src-new-ts/depgraph/variable/LayoutParameter.js +0 -8
  28. package/src-new-ts/depgraph/variable/ScaleVar.js +0 -13
  29. package/src-new-ts/depgraph/variable/Variable.js +0 -39
  30. package/src-new-ts/element/gradient/LinearGradient.js +0 -37
  31. package/src-new-ts/element/group/Collection.js +0 -109
  32. package/src-new-ts/element/group/Group.js +0 -307
  33. package/src-new-ts/element/group/Scene.js +0 -98
  34. package/src-new-ts/element/mark/CircleMark.ts +0 -85
  35. package/src-new-ts/element/mark/Mark.ts +0 -233
  36. package/src-new-ts/element/mark/PathMark.js +0 -483
  37. package/src-new-ts/element/mark/Segment.js +0 -29
  38. package/src-new-ts/element/mark/Vertex.js +0 -118
  39. package/src-new-ts/encode/Scale.ts +0 -115
  40. package/src-new-ts/index.ts +0 -19
  41. package/src-new-ts/layout/Layout.ts +0 -3
  42. package/src-new-ts/render/CanvasRenderer.ts +0 -24
  43. package/src-new-ts/render/SVGRenderer.js +0 -316
  44. package/src-new-ts/util.ts +0 -3
  45. package/src-old/action/Classify.js +0 -53
  46. package/src-old/action/Densify.js +0 -199
  47. package/src-old/action/Partition.js +0 -531
  48. package/src-old/action/Repeat.js +0 -106
  49. package/src-old/action/Repopulate.js +0 -44
  50. package/src-old/action/Stratify.js +0 -156
  51. package/src-old/basic/Gradient.js +0 -37
  52. package/src-old/basic/Point.js +0 -51
  53. package/src-old/basic/Rectangle.js +0 -63
  54. package/src-old/bind/bindToAngle.js +0 -56
  55. package/src-old/bind/bindToAreaMark.js +0 -360
  56. package/src-old/bind/bindToColor.js +0 -114
  57. package/src-old/bind/bindToLink.js +0 -81
  58. package/src-old/bind/bindToPosition.js +0 -283
  59. package/src-old/bind/bindToRadialDistance.js +0 -62
  60. package/src-old/bind/bindToSize.js +0 -235
  61. package/src-old/bind/bindToText.js +0 -60
  62. package/src-old/bind/bindToThickness.js +0 -100
  63. package/src-old/constraint/AffixConstraint.js +0 -129
  64. package/src-old/constraint/AlignConstraint.js +0 -58
  65. package/src-old/core/Encoding.js +0 -336
  66. package/src-old/core/Scale.js +0 -322
  67. package/src-old/core/SceneLoader.js +0 -290
  68. package/src-old/core/SceneValidator.js +0 -232
  69. package/src-old/core/SpecExecutor.js +0 -113
  70. package/src-old/core/SpecGenerator.js +0 -350
  71. package/src-old/data/DataImporter.js +0 -64
  72. package/src-old/data/DataScope.js +0 -124
  73. package/src-old/data/DataTable.js +0 -338
  74. package/src-old/data/Network.js +0 -106
  75. package/src-old/data/Tree.js +0 -251
  76. package/src-old/data/transform/Bin.js +0 -46
  77. package/src-old/data/transform/Filter.js +0 -48
  78. package/src-old/data/transform/Groupby.js +0 -18
  79. package/src-old/data/transform/KDE.js +0 -58
  80. package/src-old/data/transform/Sort.js +0 -14
  81. package/src-old/data/transform/Split.js +0 -5
  82. package/src-old/data/transform/partition.js +0 -46
  83. package/src-old/history/UndoRedoStack +0 -0
  84. package/src-old/index.js +0 -271
  85. package/src-old/indexSVG.js +0 -259
  86. package/src-old/interaction/Interaction.js +0 -91
  87. package/src-old/interaction/MouseEvent.js +0 -8
  88. package/src-old/interaction/Selection.js +0 -9
  89. package/src-old/interaction/brush.js +0 -362
  90. package/src-old/item/Segment.js +0 -29
  91. package/src-old/item/Vertex.js +0 -118
  92. package/src-old/item/composite/Collection.js +0 -106
  93. package/src-old/item/composite/Glyph.js +0 -19
  94. package/src-old/item/composite/Group.js +0 -310
  95. package/src-old/item/composite/Scene.js +0 -1251
  96. package/src-old/item/mark/ArcPath.js +0 -181
  97. package/src-old/item/mark/AreaPath.js +0 -78
  98. package/src-old/item/mark/CirclePath.js +0 -102
  99. package/src-old/item/mark/EllipsePath.js +0 -5
  100. package/src-old/item/mark/Image.js +0 -101
  101. package/src-old/item/mark/LinkPath.js +0 -118
  102. package/src-old/item/mark/Mark.js +0 -163
  103. package/src-old/item/mark/Path.js +0 -494
  104. package/src-old/item/mark/PointText.js +0 -201
  105. package/src-old/item/mark/PolygonPath.js +0 -64
  106. package/src-old/item/mark/RectPath.js +0 -88
  107. package/src-old/item/mark/RingPath.js +0 -92
  108. package/src-old/item/refs/Axis.js +0 -362
  109. package/src-old/item/refs/EncodingAxis.js +0 -515
  110. package/src-old/item/refs/Gridlines.js +0 -144
  111. package/src-old/item/refs/LayoutAxis.js +0 -316
  112. package/src-old/item/refs/Legend.js +0 -273
  113. package/src-old/layout/Circular.js +0 -95
  114. package/src-old/layout/Force.js +0 -52
  115. package/src-old/layout/Grid.js +0 -423
  116. package/src-old/layout/Layout.js +0 -13
  117. package/src-old/layout/Packing.js +0 -56
  118. package/src-old/layout/Stack.js +0 -264
  119. package/src-old/layout/Strata.js +0 -88
  120. package/src-old/layout/Sugiyama.js +0 -59
  121. package/src-old/layout/TidyTree.js +0 -105
  122. package/src-old/layout/Treemap.js +0 -87
  123. package/src-old/renderer/SVGInteractionHandler.js +0 -241
  124. package/src-old/renderer/SVGRenderer.js +0 -325
  125. package/src-old/renderer/WebGLRenderer.js +0 -1097
  126. package/src-old/renderer/WebGLRenderer2.js +0 -249
  127. package/src-old/renderer/threejs/Line2.js +0 -18
  128. package/src-old/renderer/threejs/LineGeometry.js +0 -77
  129. package/src-old/renderer/threejs/LineMaterial.js +0 -605
  130. package/src-old/renderer/threejs/LineSegments2.js +0 -281
  131. package/src-old/renderer/threejs/LineSegmentsGeometry.js +0 -226
  132. package/src-old/renderer/threejs/Wireframe.js +0 -51
  133. package/src-old/renderer/threejs/WireframeGeometry2.js +0 -16
  134. package/src-old/scale/areaSize.js +0 -0
  135. package/src-old/scale/domain.js +0 -38
  136. package/src-old/util/Constants.js +0 -180
  137. package/src-old/util/DataUtil.js +0 -35
  138. package/src-old/util/ItemUtil.js +0 -586
  139. package/src-old/util/Numerical.js +0 -33
  140. package/tests/demo-tests/README.md +0 -80
  141. package/tests/demo-tests/SVG2PNG.js +0 -56
  142. package/tests/demo-tests/demos2CanvasPNGs.js +0 -69
  143. package/tests/demo-tests/demos2ScenesSVGs.js +0 -100
  144. package/tests/demo-tests/pathElementWorker.js +0 -91
  145. package/tests/demo-tests/pixelTest.js +0 -62
  146. package/tests/demo-tests/renderDemos.html +0 -132
  147. package/tests/demo-tests/serializationTest.js +0 -36
  148. package/tests/demo-tests/serializeDemos.html +0 -134
  149. package/tests/unit-tests/README.md +0 -4
  150. package/tests/unit-tests/jasmine-browser.json +0 -21
  151. package/tests/unit-tests/jasmine.json +0 -14
  152. 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
- }