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.
- package/dist/mascot-esm.js +186 -0
- package/package.json +3 -6
- package/dist/mascot-es.js +0 -27745
- package/dist/mascot-min.js +0 -186
- package/dist/mascot-umd.js +0 -27781
- package/js/depGraphVis.js +0 -66
- package/src-new-ts/action/createElement.ts +0 -91
- package/src-new-ts/action/encode.js +0 -20
- package/src-new-ts/action/repeat.js +0 -128
- package/src-new-ts/action/traverseScene.js +0 -41
- package/src-new-ts/data/Network.js +0 -2
- package/src-new-ts/data/Scope.js +0 -135
- package/src-new-ts/data/Table.js +0 -263
- package/src-new-ts/data/Tree.js +0 -3
- package/src-new-ts/data/field.ts +0 -115
- package/src-new-ts/data/import.ts +0 -96
- package/src-new-ts/data/predicate.ts +0 -82
- package/src-new-ts/depgraph/DepGraph.js +0 -178
- package/src-new-ts/depgraph/Edge.js +0 -9
- package/src-new-ts/depgraph/SceneGraph2DepGraph.js +0 -110
- package/src-new-ts/depgraph/Signal.js +0 -12
- package/src-new-ts/depgraph/operator/BoundsEvaluator.js +0 -30
- package/src-new-ts/depgraph/operator/Dataflow.js +0 -41
- package/src-new-ts/depgraph/operator/DomainBuilder.js +0 -50
- package/src-new-ts/depgraph/updateDepGraph.js +0 -45
- package/src-new-ts/depgraph/variable/BoundsVar.js +0 -81
- package/src-new-ts/depgraph/variable/ChannelVar.js +0 -17
- package/src-new-ts/depgraph/variable/DataScopeVar.js +0 -12
- package/src-new-ts/depgraph/variable/DomainVar.js +0 -15
- package/src-new-ts/depgraph/variable/FieldVar.js +0 -17
- package/src-new-ts/depgraph/variable/LayoutParameter.js +0 -8
- package/src-new-ts/depgraph/variable/ScaleVar.js +0 -13
- package/src-new-ts/depgraph/variable/Variable.js +0 -39
- package/src-new-ts/element/gradient/LinearGradient.js +0 -37
- package/src-new-ts/element/group/Collection.js +0 -109
- package/src-new-ts/element/group/Group.js +0 -307
- package/src-new-ts/element/group/Scene.js +0 -98
- package/src-new-ts/element/mark/CircleMark.ts +0 -85
- package/src-new-ts/element/mark/Mark.ts +0 -233
- package/src-new-ts/element/mark/PathMark.js +0 -483
- package/src-new-ts/element/mark/Segment.js +0 -29
- package/src-new-ts/element/mark/Vertex.js +0 -118
- package/src-new-ts/encode/Scale.ts +0 -115
- package/src-new-ts/index.ts +0 -19
- package/src-new-ts/layout/Layout.ts +0 -3
- package/src-new-ts/render/CanvasRenderer.ts +0 -24
- package/src-new-ts/render/SVGRenderer.js +0 -316
- package/src-new-ts/util.ts +0 -3
- package/src-old/action/Classify.js +0 -53
- package/src-old/action/Densify.js +0 -199
- package/src-old/action/Partition.js +0 -531
- package/src-old/action/Repeat.js +0 -106
- package/src-old/action/Repopulate.js +0 -44
- package/src-old/action/Stratify.js +0 -156
- package/src-old/basic/Gradient.js +0 -37
- package/src-old/basic/Point.js +0 -51
- package/src-old/basic/Rectangle.js +0 -63
- package/src-old/bind/bindToAngle.js +0 -56
- package/src-old/bind/bindToAreaMark.js +0 -360
- package/src-old/bind/bindToColor.js +0 -114
- package/src-old/bind/bindToLink.js +0 -81
- package/src-old/bind/bindToPosition.js +0 -283
- package/src-old/bind/bindToRadialDistance.js +0 -62
- package/src-old/bind/bindToSize.js +0 -235
- package/src-old/bind/bindToText.js +0 -60
- package/src-old/bind/bindToThickness.js +0 -100
- package/src-old/constraint/AffixConstraint.js +0 -129
- package/src-old/constraint/AlignConstraint.js +0 -58
- package/src-old/core/Encoding.js +0 -336
- package/src-old/core/Scale.js +0 -322
- package/src-old/core/SceneLoader.js +0 -290
- package/src-old/core/SceneValidator.js +0 -232
- package/src-old/core/SpecExecutor.js +0 -113
- package/src-old/core/SpecGenerator.js +0 -350
- package/src-old/data/DataImporter.js +0 -64
- package/src-old/data/DataScope.js +0 -124
- package/src-old/data/DataTable.js +0 -338
- package/src-old/data/Network.js +0 -106
- package/src-old/data/Tree.js +0 -251
- package/src-old/data/transform/Bin.js +0 -46
- package/src-old/data/transform/Filter.js +0 -48
- package/src-old/data/transform/Groupby.js +0 -18
- package/src-old/data/transform/KDE.js +0 -58
- package/src-old/data/transform/Sort.js +0 -14
- package/src-old/data/transform/Split.js +0 -5
- package/src-old/data/transform/partition.js +0 -46
- package/src-old/history/UndoRedoStack +0 -0
- package/src-old/index.js +0 -271
- package/src-old/indexSVG.js +0 -259
- package/src-old/interaction/Interaction.js +0 -91
- package/src-old/interaction/MouseEvent.js +0 -8
- package/src-old/interaction/Selection.js +0 -9
- package/src-old/interaction/brush.js +0 -362
- package/src-old/item/Segment.js +0 -29
- package/src-old/item/Vertex.js +0 -118
- package/src-old/item/composite/Collection.js +0 -106
- package/src-old/item/composite/Glyph.js +0 -19
- package/src-old/item/composite/Group.js +0 -310
- package/src-old/item/composite/Scene.js +0 -1251
- package/src-old/item/mark/ArcPath.js +0 -181
- package/src-old/item/mark/AreaPath.js +0 -78
- package/src-old/item/mark/CirclePath.js +0 -102
- package/src-old/item/mark/EllipsePath.js +0 -5
- package/src-old/item/mark/Image.js +0 -101
- package/src-old/item/mark/LinkPath.js +0 -118
- package/src-old/item/mark/Mark.js +0 -163
- package/src-old/item/mark/Path.js +0 -494
- package/src-old/item/mark/PointText.js +0 -201
- package/src-old/item/mark/PolygonPath.js +0 -64
- package/src-old/item/mark/RectPath.js +0 -88
- package/src-old/item/mark/RingPath.js +0 -92
- package/src-old/item/refs/Axis.js +0 -362
- package/src-old/item/refs/EncodingAxis.js +0 -515
- package/src-old/item/refs/Gridlines.js +0 -144
- package/src-old/item/refs/LayoutAxis.js +0 -316
- package/src-old/item/refs/Legend.js +0 -273
- package/src-old/layout/Circular.js +0 -95
- package/src-old/layout/Force.js +0 -52
- package/src-old/layout/Grid.js +0 -423
- package/src-old/layout/Layout.js +0 -13
- package/src-old/layout/Packing.js +0 -56
- package/src-old/layout/Stack.js +0 -264
- package/src-old/layout/Strata.js +0 -88
- package/src-old/layout/Sugiyama.js +0 -59
- package/src-old/layout/TidyTree.js +0 -105
- package/src-old/layout/Treemap.js +0 -87
- package/src-old/renderer/SVGInteractionHandler.js +0 -241
- package/src-old/renderer/SVGRenderer.js +0 -325
- package/src-old/renderer/WebGLRenderer.js +0 -1097
- package/src-old/renderer/WebGLRenderer2.js +0 -249
- package/src-old/renderer/threejs/Line2.js +0 -18
- package/src-old/renderer/threejs/LineGeometry.js +0 -77
- package/src-old/renderer/threejs/LineMaterial.js +0 -605
- package/src-old/renderer/threejs/LineSegments2.js +0 -281
- package/src-old/renderer/threejs/LineSegmentsGeometry.js +0 -226
- package/src-old/renderer/threejs/Wireframe.js +0 -51
- package/src-old/renderer/threejs/WireframeGeometry2.js +0 -16
- package/src-old/scale/areaSize.js +0 -0
- package/src-old/scale/domain.js +0 -38
- package/src-old/util/Constants.js +0 -180
- package/src-old/util/DataUtil.js +0 -35
- package/src-old/util/ItemUtil.js +0 -586
- package/src-old/util/Numerical.js +0 -33
- package/tests/demo-tests/README.md +0 -80
- package/tests/demo-tests/SVG2PNG.js +0 -56
- package/tests/demo-tests/demos2CanvasPNGs.js +0 -69
- package/tests/demo-tests/demos2ScenesSVGs.js +0 -100
- package/tests/demo-tests/pathElementWorker.js +0 -91
- package/tests/demo-tests/pixelTest.js +0 -62
- package/tests/demo-tests/renderDemos.html +0 -132
- package/tests/demo-tests/serializationTest.js +0 -36
- package/tests/demo-tests/serializeDemos.html +0 -134
- package/tests/unit-tests/README.md +0 -4
- package/tests/unit-tests/jasmine-browser.json +0 -21
- package/tests/unit-tests/jasmine.json +0 -14
- package/tests/unit-tests/testSpec.js +0 -274
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import {Errors, DataType, ItemType, Orientation, Alignment} from "../util/Constants";
|
|
2
|
-
import DataScope from "../data/DataScope";
|
|
3
|
-
import {getPeers, polar2Cartesian} from "../util/ItemUtil";
|
|
4
|
-
import Vertex from "../item/Vertex";
|
|
5
|
-
|
|
6
|
-
export function densifiable(compnt) {
|
|
7
|
-
if ([ItemType.Line, ItemType.Circle, ItemType.Rect, ItemType.Area].indexOf(compnt.type) < 0) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
if (!compnt.dataScope) {
|
|
11
|
-
return true;
|
|
12
|
-
} else {
|
|
13
|
-
let peers = getPeers(compnt, compnt.getScene());
|
|
14
|
-
for (let p of peers) {
|
|
15
|
-
if (p.dataScope.numTuples > 1)
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function densifyItem(scene, compnt, orientation, field, datatable, callback, startAngle, direction) {
|
|
23
|
-
let f = callback ? datatable.transformField(field, callback) : field;
|
|
24
|
-
let type = datatable.getFieldType(f);
|
|
25
|
-
|
|
26
|
-
if (type != DataType.String && type != DataType.Date && type != DataType.Number) {
|
|
27
|
-
throw new Error(Errors.DENSIFY_BY_NONCAT + ": " + f + " is " + type);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!densifiable(compnt, f, scene)) {
|
|
31
|
-
throw new Error(Errors.COMPNT_NON_DENSIFIABLE);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
switch (compnt.type) {
|
|
35
|
-
case ItemType.Line:
|
|
36
|
-
return _doLineDensify(scene, compnt, f, datatable);
|
|
37
|
-
case ItemType.Circle:
|
|
38
|
-
return _doCircleDensify(scene, compnt, f, datatable, startAngle, direction);
|
|
39
|
-
case ItemType.Rect:
|
|
40
|
-
case ItemType.Area:
|
|
41
|
-
return _doAreaDensify(scene, compnt, orientation, f, datatable);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _doLineDensify(scene, compnt, field, datatable) {
|
|
47
|
-
let peers = getPeers(compnt, scene);
|
|
48
|
-
|
|
49
|
-
let toReturn;
|
|
50
|
-
for (let p of peers) {
|
|
51
|
-
let lineDS = p.dataScope ? p.dataScope : new DataScope(datatable);
|
|
52
|
-
let ds = datatable.getFieldSummary(field).unique.map(d => lineDS.cross(field, d));
|
|
53
|
-
ds = ds.filter(d => !d.isEmpty());
|
|
54
|
-
if (ds.length === 1) {
|
|
55
|
-
ds.push(ds[0].clone());
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let args = Object.assign({}, p.styles);
|
|
59
|
-
for (let vs of Vertex.styles){
|
|
60
|
-
if (p[vs])
|
|
61
|
-
args[vs] = p[vs];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//compute vertices
|
|
65
|
-
let x1 = p.vertices[0].x,
|
|
66
|
-
y1 = p.vertices[0].y,
|
|
67
|
-
x2 = p.vertices[1].x,
|
|
68
|
-
y2 = p.vertices[1].y;
|
|
69
|
-
|
|
70
|
-
let vertices = [], wd = x2 - x1, ht = y2 - y1;
|
|
71
|
-
for (let i = 0; i < ds.length; i++){
|
|
72
|
-
vertices.push([x1 + i * wd / (ds.length - 1), y1 + i * ht /(ds.length - 1)]);
|
|
73
|
-
}
|
|
74
|
-
args.vertices = vertices;
|
|
75
|
-
let polyLine = scene.mark("path", args);
|
|
76
|
-
polyLine.classId = compnt.id;
|
|
77
|
-
polyLine.dataScope = lineDS;
|
|
78
|
-
|
|
79
|
-
let parent = p.parent;
|
|
80
|
-
parent.addChild(polyLine);
|
|
81
|
-
parent.removeChild(p);
|
|
82
|
-
|
|
83
|
-
for (let [i, v] of polyLine.vertices.entries()){
|
|
84
|
-
if (v.dataScope)
|
|
85
|
-
v.dataScope = v.dataScope.merge(ds[i]);
|
|
86
|
-
else
|
|
87
|
-
v.dataScope = ds[i];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (p == compnt)
|
|
91
|
-
toReturn = polyLine;
|
|
92
|
-
}
|
|
93
|
-
return toReturn;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _doAreaDensify(scene, compnt, orientation, field, datatable) {
|
|
97
|
-
let peers = getPeers(compnt, scene);
|
|
98
|
-
let toReturn;
|
|
99
|
-
|
|
100
|
-
for (let p of peers) {
|
|
101
|
-
// How to handle missing elements across different partitions in area mark?
|
|
102
|
-
let ft = datatable.getFieldType(field);
|
|
103
|
-
let areaDS = p.dataScope ? p.dataScope : new DataScope(datatable);
|
|
104
|
-
let ds = datatable.getFieldSummary(field).unique.map(d => areaDS.cross(field, d));
|
|
105
|
-
ds = ft == DataType.Number? ds : ds.filter(d => !d.isEmpty());
|
|
106
|
-
if (ds.length === 1) {
|
|
107
|
-
ds.push(ds[0].clone());
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (ft == DataType.Number || ft == DataType.Date) {
|
|
111
|
-
// sorting ds
|
|
112
|
-
ds.sort((a, b) => (a._field2value[field] > b._field2value[field]) ? 1 : -1)
|
|
113
|
-
}
|
|
114
|
-
let args = Object.assign({}, p.styles);
|
|
115
|
-
//compute vertices
|
|
116
|
-
let x1 = p.vertices[0].x,
|
|
117
|
-
y1 = p.vertices[0].y,
|
|
118
|
-
x2 = p.vertices[p.vertices.length - 2].x,
|
|
119
|
-
y2 = p.vertices[p.vertices.length - 2].y;
|
|
120
|
-
|
|
121
|
-
let vertices = [], wd = x2 - x1, ht = y2 - y1;
|
|
122
|
-
for(let j = 0; j < ds.length; j++) {
|
|
123
|
-
vertices.push(orientation == Orientation.Vertical ? [x2, y1 + (ds.length-1-j) * ht /(ds.length - 1)] : [x1 + j * wd / (ds.length - 1), y1]);
|
|
124
|
-
}
|
|
125
|
-
for(let j = 0; j < ds.length; j++) {
|
|
126
|
-
vertices.push(orientation == Orientation.Vertical ? [x1, y1 + j * ht /(ds.length - 1)] : [x1 + (ds.length-1-j) * wd / (ds.length - 1), y2]);
|
|
127
|
-
}
|
|
128
|
-
args.vertices = vertices;
|
|
129
|
-
let NewArea = scene.mark("area", args);
|
|
130
|
-
// Very Important: keep new areas' classID consistent
|
|
131
|
-
NewArea.classId = p.type == "area"? p.classId : "area" + p.classId.substring(9);
|
|
132
|
-
NewArea.dataScope = areaDS;
|
|
133
|
-
NewArea.orientation = orientation;
|
|
134
|
-
NewArea.baseline = orientation === Orientation.Horizontal ? Alignment.Bottom : Alignment.Left;
|
|
135
|
-
|
|
136
|
-
let parent = p.parent;
|
|
137
|
-
parent.addChild(NewArea);
|
|
138
|
-
parent.removeChild(p);
|
|
139
|
-
|
|
140
|
-
for (let [i, v] of NewArea.vertices.entries()){
|
|
141
|
-
// two boundary lines are encoded the same; possible to modify later according to the data encoding
|
|
142
|
-
if (i>=ds.length) {
|
|
143
|
-
v.dataScope = areaDS.merge(ds[ds.length*2-1-i]);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
v.dataScope = areaDS.merge(ds[i]);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (p == compnt) {
|
|
150
|
-
toReturn = NewArea;
|
|
151
|
-
// targetArea = NewArea;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return toReturn;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function _doCircleDensify(scene, compnt, field, datatable, startAngle, direction) {
|
|
158
|
-
let toReturn;
|
|
159
|
-
let peers = getPeers(compnt, scene);
|
|
160
|
-
peers.forEach(p => {
|
|
161
|
-
let circDS = p.dataScope ? p.dataScope : new DataScope(datatable);
|
|
162
|
-
let ds = datatable.getFieldSummary(field).unique.map(d => circDS.cross(field, d));
|
|
163
|
-
ds = ds.filter(d => !d.isEmpty());
|
|
164
|
-
let numVertices = ds.length;
|
|
165
|
-
if (numVertices < 3)
|
|
166
|
-
throw Error(Errors.INSUFFICIENT_DATA_SCOPES);
|
|
167
|
-
let k = 360/numVertices, vertices = [], angle = [];
|
|
168
|
-
let dirSign = direction == "clockwise" ? -1 : 1;
|
|
169
|
-
for (let i = 0; i < ds.length; i++){
|
|
170
|
-
let a = startAngle + dirSign * i * k;
|
|
171
|
-
angle[i] = a;
|
|
172
|
-
let coords = polar2Cartesian(p.x, p.y, p.radius, angle[i]);
|
|
173
|
-
vertices.push(coords);
|
|
174
|
-
}
|
|
175
|
-
let polygon = scene.mark("polygon", {x: p.x, y: p.y, radius: p.radius, vertices:vertices});
|
|
176
|
-
polygon.dataScope = circDS;
|
|
177
|
-
polygon.styles = Object.assign({}, p.styles);
|
|
178
|
-
for (let vs of Vertex.styles){
|
|
179
|
-
if (p[vs])
|
|
180
|
-
polygon[vs] = p[vs];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
let parent = p.parent;
|
|
184
|
-
parent.addChild(polygon);
|
|
185
|
-
parent.removeChild(p);
|
|
186
|
-
|
|
187
|
-
for (let [i, v] of polygon.vertices.entries()){
|
|
188
|
-
v.polarAngle = angle[i];
|
|
189
|
-
if (v.dataScope)
|
|
190
|
-
v.dataScope = v.dataScope.merge(ds[i]);
|
|
191
|
-
else
|
|
192
|
-
v.dataScope = ds[i];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (p == compnt)
|
|
196
|
-
toReturn = polygon;
|
|
197
|
-
});
|
|
198
|
-
return toReturn;
|
|
199
|
-
}
|