@plotdb/chart 0.0.3 → 1.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.
- package/CHANGELOG.md +11 -1
- package/build +11 -5
- package/dist/index.css +8 -0
- package/dist/index.js +607 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/package.json +12 -9
- package/src/{chart.ls → index.ls} +0 -0
- package/src/{chart.styl → index.styl} +0 -0
- package/web/src/pug/base.pug +1 -0
- package/web/src/pug/block/axis/0.0.1/index.ls +1 -7
- package/web/src/pug/block/axis-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-list/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bar-race/0.0.1/index.ls +1 -5
- package/web/src/pug/block/base/0.0.1/index.ls +63 -64
- package/web/src/pug/block/blank/0.0.1/index.ls +1 -5
- package/web/src/pug/block/bubble/0.0.1/index.ls +4 -6
- package/web/src/pug/block/bubble/0.0.1/index.pug +14 -0
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/dumbbell/0.0.1/index.ls +1 -5
- package/web/src/pug/block/empty/0.0.1/index.ls +25 -24
- package/web/src/pug/block/gauge/0.0.1/index.ls +1 -5
- package/web/src/pug/block/line/0.0.1/index.ls +1 -6
- package/web/src/pug/block/number/0.0.1/index.ls +1 -5
- package/web/src/pug/block/percent-list/0.0.1/index.ls +1 -7
- package/web/src/pug/block/pie/0.0.1/index.ls +1 -5
- package/web/src/pug/block/pie-bubble/0.0.1/index.ls +1 -5
- package/web/src/pug/block/radar/0.0.1/index.ls +1 -5
- package/web/src/pug/block/scatter/0.0.1/index.ls +1 -5
- package/web/src/pug/block/sheet/0.0.1/index.ls +1 -5
- package/web/src/pug/block/table/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwancounty/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwantown/0.0.1/index.ls +1 -5
- package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +1 -5
- package/web/src/pug/block/treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +1 -5
- package/web/src/pug/block/wordcloud/0.0.1/index.ls +1 -5
- package/web/src/pug/block/worldmap/0.0.1/index.ls +1 -5
- package/web/src/styl/index.styl +6 -0
- package/web/static/block/axis/0.0.1/index.html +68 -73
- package/web/static/block/axis-bubble/0.0.1/index.html +205 -210
- package/web/static/block/bar/0.0.1/index.html +484 -489
- package/web/static/block/bar-list/0.0.1/index.html +188 -193
- package/web/static/block/bar-race/0.0.1/index.html +155 -160
- package/web/static/block/base/0.0.1/index.html +2 -2
- package/web/static/block/blank/0.0.1/index.html +35 -40
- package/web/static/block/bubble/0.0.1/index.html +377 -357
- package/web/static/block/curve-bar/0.0.1/index.html +126 -131
- package/web/static/block/dumbbell/0.0.1/index.html +160 -165
- package/web/static/block/empty/0.0.1/index.html +2 -2
- package/web/static/block/gauge/0.0.1/index.html +116 -121
- package/web/static/block/line/0.0.1/index.html +502 -507
- package/web/static/block/number/0.0.1/index.html +123 -128
- package/web/static/block/percent-list/0.0.1/index.html +263 -268
- package/web/static/block/pie/0.0.1/index.html +241 -246
- package/web/static/block/pie-bubble/0.0.1/index.html +295 -300
- package/web/static/block/radar/0.0.1/index.html +137 -142
- package/web/static/block/scatter/0.0.1/index.html +207 -212
- package/web/static/block/sheet/0.0.1/index.html +93 -98
- package/web/static/block/table/0.0.1/index.html +64 -70
- package/web/static/block/taiwancounty/0.0.1/index.html +180 -185
- package/web/static/block/taiwantown/0.0.1/index.html +104 -109
- package/web/static/block/taiwanvillage/0.0.1/index.html +114 -119
- package/web/static/block/treemap/0.0.1/index.html +296 -301
- package/web/static/block/voronoi-treemap/0.0.1/index.html +311 -316
- package/web/static/block/wordcloud/0.0.1/index.html +82 -87
- package/web/static/block/worldmap/0.0.1/index.html +186 -191
- package/web/static/css/index.css +6 -0
- package/web/static/css/index.min.css +1 -0
- package/web/static/index.html +1 -1
|
@@ -18,234 +18,229 @@
|
|
|
18
18
|
grid-column: 3
|
|
19
19
|
grid-row: 1 / span 2
|
|
20
20
|
*/
|
|
21
|
-
</style><script type="@plotdb/block">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
name:
|
|
28
|
-
version:
|
|
29
|
-
extend: {
|
|
30
|
-
name: "base",
|
|
31
|
-
version: "0.0.1"
|
|
32
|
-
},
|
|
33
|
-
dependencies: [{
|
|
34
|
-
url: "http://cdn.jsdelivr.net/npm/d3-delaunay@6/dist/d3-delaunay.min.js"
|
|
35
|
-
}]
|
|
21
|
+
</style><script type="@plotdb/block">var mod;
|
|
22
|
+
module.exports = {
|
|
23
|
+
pkg: {
|
|
24
|
+
name: 'scatter',
|
|
25
|
+
version: '0.0.1',
|
|
26
|
+
extend: {
|
|
27
|
+
name: "base",
|
|
28
|
+
version: "0.0.1"
|
|
36
29
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
dependencies: [{
|
|
31
|
+
url: "http://cdn.jsdelivr.net/npm/d3-delaunay@6/dist/d3-delaunay.min.js"
|
|
32
|
+
}]
|
|
33
|
+
},
|
|
34
|
+
init: function(arg$){
|
|
35
|
+
var root, context, pubsub;
|
|
36
|
+
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
37
|
+
return pubsub.fire('init', {
|
|
38
|
+
mod: mod({
|
|
39
|
+
context: context
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
mod = function(arg$){
|
|
45
|
+
var context, d3, chart, names;
|
|
46
|
+
context = arg$.context;
|
|
47
|
+
d3 = context.d3, chart = context.chart;
|
|
48
|
+
names = ["The Glenn Miller Story", "The Fifth Element", "Forrest Gump", "Finding Nemo", "The Fly", "First Blood", "You Can't Take It with You", "Man of the Year", "From Hell", "The Easy Rider", "The English Patient", "The Extra-Terrestial", "Edward Scissorhands", "Empire of the Sun", "Encounters of the Third Kind", "Elizabeth: The Golden Age"];
|
|
49
|
+
return {
|
|
50
|
+
sample: function(){
|
|
51
|
+
return {
|
|
52
|
+
raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100].map(function(val){
|
|
53
|
+
var ret;
|
|
54
|
+
ret = {
|
|
55
|
+
x: Math.random(),
|
|
56
|
+
y: Math.random(),
|
|
57
|
+
name: names[Math.floor(Math.random() * names.length)]
|
|
58
|
+
};
|
|
59
|
+
return ret;
|
|
60
|
+
}),
|
|
61
|
+
binding: {
|
|
62
|
+
x: {
|
|
63
|
+
key: 'x'
|
|
64
|
+
},
|
|
65
|
+
y: {
|
|
66
|
+
key: 'y'
|
|
67
|
+
},
|
|
68
|
+
name: {
|
|
69
|
+
key: 'name'
|
|
74
70
|
}
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
config: {},
|
|
78
|
-
dimension: {
|
|
79
|
-
x: {
|
|
80
|
-
type: 'R',
|
|
81
|
-
name: "x axis"
|
|
82
|
-
},
|
|
83
|
-
y: {
|
|
84
|
-
type: 'R',
|
|
85
|
-
name: "y axis"
|
|
86
|
-
},
|
|
87
|
-
radius: {
|
|
88
|
-
type: 'R',
|
|
89
|
-
name: "radius"
|
|
90
|
-
},
|
|
91
|
-
category: {
|
|
92
|
-
type: 'CN',
|
|
93
|
-
name: "category"
|
|
94
|
-
},
|
|
95
|
-
name: {
|
|
96
|
-
type: 'N',
|
|
97
|
-
name: "name"
|
|
98
71
|
}
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
config: {},
|
|
75
|
+
dimension: {
|
|
76
|
+
x: {
|
|
77
|
+
type: 'R',
|
|
78
|
+
name: "x axis"
|
|
99
79
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
['view', 'yaxis', 'xaxis'].map(function(it){
|
|
104
|
-
return (this$.g || (this$.g = {}))[it] = d3.select(this$.layout.getGroup(it));
|
|
105
|
-
});
|
|
106
|
-
return this.path = d3.select(this.svg).append('path');
|
|
80
|
+
y: {
|
|
81
|
+
type: 'R',
|
|
82
|
+
name: "y axis"
|
|
107
83
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
ref$ = [this.box.width, this.box.height], w = ref$[0], h = ref$[1];
|
|
112
|
-
this.extent = {
|
|
113
|
-
x: d3.extent(this.data.map(function(it){
|
|
114
|
-
return it.x;
|
|
115
|
-
})),
|
|
116
|
-
y: d3.extent(this.data.map(function(it){
|
|
117
|
-
return it.y;
|
|
118
|
-
}))
|
|
119
|
-
};
|
|
120
|
-
box = this.layout.getBox('view');
|
|
121
|
-
this.scale = {
|
|
122
|
-
x: d3.scaleLinear().domain(this.extent.x).range([0, box.width]),
|
|
123
|
-
y: d3.scaleLinear().domain(this.extent.y).range([0, box.height])
|
|
124
|
-
};
|
|
125
|
-
this.pts = this.data.map(function(d){
|
|
126
|
-
return [this$.scale.x(d.x), this$.scale.y(d.y)];
|
|
127
|
-
});
|
|
128
|
-
this.delaunay = d3.Delaunay.from(this.pts);
|
|
129
|
-
this.voronoi = this.delaunay.voronoi([0, 0, box.width, box.height]);
|
|
130
|
-
return this.cells = this.pts.map(function(point, i){
|
|
131
|
-
var x, y, polygon, centroid, ref$, cx, cy, area, angle;
|
|
132
|
-
x = point[0], y = point[1];
|
|
133
|
-
polygon = this$.voronoi.cellPolygon(i);
|
|
134
|
-
ref$ = centroid = d3.polygonCentroid(polygon), cx = ref$[0], cy = ref$[1];
|
|
135
|
-
area = -d3.polygonArea(polygon);
|
|
136
|
-
angle = (Math.round(Math.atan2(cy - y, cx - x) / Math.PI * 2) + 4) % 4;
|
|
137
|
-
return {
|
|
138
|
-
point: point,
|
|
139
|
-
polygon: polygon,
|
|
140
|
-
centroid: centroid,
|
|
141
|
-
area: area,
|
|
142
|
-
angle: angle
|
|
143
|
-
};
|
|
144
|
-
});
|
|
84
|
+
radius: {
|
|
85
|
+
type: 'R',
|
|
86
|
+
name: "radius"
|
|
145
87
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
88
|
+
category: {
|
|
89
|
+
type: 'CN',
|
|
90
|
+
name: "category"
|
|
91
|
+
},
|
|
92
|
+
name: {
|
|
93
|
+
type: 'N',
|
|
94
|
+
name: "name"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
init: function(){
|
|
98
|
+
var tint, this$ = this;
|
|
99
|
+
this.tint = tint = new chart.utils.tint();
|
|
100
|
+
['view', 'yaxis', 'xaxis'].map(function(it){
|
|
101
|
+
return (this$.g || (this$.g = {}))[it] = d3.select(this$.layout.getGroup(it));
|
|
102
|
+
});
|
|
103
|
+
return this.path = d3.select(this.svg).append('path');
|
|
104
|
+
},
|
|
105
|
+
parse: function(){},
|
|
106
|
+
resize: function(){
|
|
107
|
+
var ref$, w, h, box, this$ = this;
|
|
108
|
+
ref$ = [this.box.width, this.box.height], w = ref$[0], h = ref$[1];
|
|
109
|
+
this.extent = {
|
|
110
|
+
x: d3.extent(this.data.map(function(it){
|
|
111
|
+
return it.x;
|
|
112
|
+
})),
|
|
113
|
+
y: d3.extent(this.data.map(function(it){
|
|
114
|
+
return it.y;
|
|
115
|
+
}))
|
|
116
|
+
};
|
|
117
|
+
box = this.layout.getBox('view');
|
|
118
|
+
this.scale = {
|
|
119
|
+
x: d3.scaleLinear().domain(this.extent.x).range([0, box.width]),
|
|
120
|
+
y: d3.scaleLinear().domain(this.extent.y).range([0, box.height])
|
|
121
|
+
};
|
|
122
|
+
this.pts = this.data.map(function(d){
|
|
123
|
+
return [this$.scale.x(d.x), this$.scale.y(d.y)];
|
|
124
|
+
});
|
|
125
|
+
this.delaunay = d3.Delaunay.from(this.pts);
|
|
126
|
+
this.voronoi = this.delaunay.voronoi([0, 0, box.width, box.height]);
|
|
127
|
+
return this.cells = this.pts.map(function(point, i){
|
|
128
|
+
var x, y, polygon, centroid, ref$, cx, cy, area, angle;
|
|
129
|
+
x = point[0], y = point[1];
|
|
130
|
+
polygon = this$.voronoi.cellPolygon(i);
|
|
131
|
+
ref$ = centroid = d3.polygonCentroid(polygon), cx = ref$[0], cy = ref$[1];
|
|
132
|
+
area = -d3.polygonArea(polygon);
|
|
133
|
+
angle = (Math.round(Math.atan2(cy - y, cx - x) / Math.PI * 2) + 4) % 4;
|
|
134
|
+
return {
|
|
135
|
+
point: point,
|
|
136
|
+
polygon: polygon,
|
|
137
|
+
centroid: centroid,
|
|
138
|
+
area: area,
|
|
139
|
+
angle: angle
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
render: function(){
|
|
144
|
+
var scale, x$, y$;
|
|
145
|
+
scale = this.scale;
|
|
146
|
+
x$ = this.g.view.selectAll('circle.data').data(this.data);
|
|
147
|
+
x$.exit().remove();
|
|
148
|
+
x$.enter().append('circle').attr('class', 'data').attr('cx', function(d, i){
|
|
149
|
+
return scale.x(d.x);
|
|
150
|
+
}).attr('cy', function(d, i){
|
|
151
|
+
return scale.y(d.y);
|
|
152
|
+
}).attr('r', 3).attr('fill', '#000');
|
|
153
|
+
y$ = this.g.view.selectAll('text').data(this.data);
|
|
154
|
+
y$.exit().remove();
|
|
155
|
+
y$.enter().append('text').text(function(d, i){
|
|
156
|
+
return d.name;
|
|
157
|
+
}).attr('x', function(d, i){
|
|
158
|
+
if (d.nb) {
|
|
159
|
+
return d.nb.x;
|
|
160
|
+
} else {
|
|
152
161
|
return scale.x(d.x);
|
|
153
|
-
}
|
|
162
|
+
}
|
|
163
|
+
}).attr('y', function(d, i){
|
|
164
|
+
if (d.nb) {
|
|
165
|
+
return d.nb.y;
|
|
166
|
+
} else {
|
|
154
167
|
return scale.y(d.y);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return d.
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle');
|
|
173
|
-
this.g.view.selectAll('text').data(this.data).attr('x', function(d, i){
|
|
174
|
-
if (d.nb) {
|
|
175
|
-
return d.nb.x;
|
|
176
|
-
} else {
|
|
177
|
-
return scale.x(d.x);
|
|
178
|
-
}
|
|
179
|
-
}).attr('y', function(d, i){
|
|
180
|
-
if (d.nb) {
|
|
181
|
-
return d.nb.y;
|
|
182
|
-
} else {
|
|
183
|
-
return scale.y(d.y) - 20;
|
|
184
|
-
}
|
|
185
|
-
}).attr('opacity', function(d, i){
|
|
186
|
-
if (d.nb) {
|
|
187
|
-
if (d.nb.show) {
|
|
188
|
-
return 1;
|
|
189
|
-
} else {
|
|
190
|
-
return 0;
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
168
|
+
}
|
|
169
|
+
}).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle');
|
|
170
|
+
this.g.view.selectAll('text').data(this.data).attr('x', function(d, i){
|
|
171
|
+
if (d.nb) {
|
|
172
|
+
return d.nb.x;
|
|
173
|
+
} else {
|
|
174
|
+
return scale.x(d.x);
|
|
175
|
+
}
|
|
176
|
+
}).attr('y', function(d, i){
|
|
177
|
+
if (d.nb) {
|
|
178
|
+
return d.nb.y;
|
|
179
|
+
} else {
|
|
180
|
+
return scale.y(d.y) - 20;
|
|
181
|
+
}
|
|
182
|
+
}).attr('opacity', function(d, i){
|
|
183
|
+
if (d.nb) {
|
|
184
|
+
if (d.nb.show) {
|
|
193
185
|
return 1;
|
|
186
|
+
} else {
|
|
187
|
+
return 0;
|
|
194
188
|
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
tick: function(){
|
|
199
|
-
var scale, rbox, i$, to$, i, d, ref$, r, j$, k$, j, a, b, data;
|
|
200
|
-
scale = this.scale;
|
|
201
|
-
this.g.view.selectAll('text').each(function(d, i){
|
|
202
|
-
return d.box = this.getBoundingClientRect();
|
|
203
|
-
});
|
|
204
|
-
rbox = this.layout.getBox('view');
|
|
205
|
-
for (i$ = 0, to$ = this.data.length; i$ < to$; ++i$) {
|
|
206
|
-
i = i$;
|
|
207
|
-
d = this.data[i].box;
|
|
208
|
-
if (!this.data[i].nb) {
|
|
209
|
-
this.data[i].nb = {
|
|
210
|
-
x: scale.x(this.data[i].x),
|
|
211
|
-
y: scale.y(this.data[i].y) - 20
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
ref$ = this.data[i].nb;
|
|
215
|
-
ref$.width = d.width;
|
|
216
|
-
ref$.height = d.height;
|
|
217
|
-
ref$.show = true;
|
|
189
|
+
} else {
|
|
190
|
+
return 1;
|
|
218
191
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
192
|
+
});
|
|
193
|
+
return this.path.attr('d', this.voronoi.render()).attr('stroke', '#000').attr('transform', this.g.view.node().getAttribute('transform'));
|
|
194
|
+
},
|
|
195
|
+
tick: function(){
|
|
196
|
+
var scale, rbox, i$, to$, i, d, ref$, r, j$, k$, j, a, b, data;
|
|
197
|
+
scale = this.scale;
|
|
198
|
+
this.g.view.selectAll('text').each(function(d, i){
|
|
199
|
+
return d.box = this.getBoundingClientRect();
|
|
200
|
+
});
|
|
201
|
+
rbox = this.layout.getBox('view');
|
|
202
|
+
for (i$ = 0, to$ = this.data.length; i$ < to$; ++i$) {
|
|
203
|
+
i = i$;
|
|
204
|
+
d = this.data[i].box;
|
|
205
|
+
if (!this.data[i].nb) {
|
|
206
|
+
this.data[i].nb = {
|
|
207
|
+
x: scale.x(this.data[i].x),
|
|
208
|
+
y: scale.y(this.data[i].y) - 20
|
|
209
|
+
};
|
|
235
210
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
211
|
+
ref$ = this.data[i].nb;
|
|
212
|
+
ref$.width = d.width;
|
|
213
|
+
ref$.height = d.height;
|
|
214
|
+
ref$.show = true;
|
|
215
|
+
}
|
|
216
|
+
for (i$ = 20; i$ < 200; i$ += 20) {
|
|
217
|
+
r = i$;
|
|
218
|
+
for (j$ = 0, to$ = this.data.length; j$ < to$; ++j$) {
|
|
219
|
+
i = j$;
|
|
220
|
+
for (k$ = 0; k$ < i; ++k$) {
|
|
221
|
+
j = k$;
|
|
240
222
|
ref$ = [this.data[i].nb, this.data[j].nb], a = ref$[0], b = ref$[1];
|
|
241
223
|
if (((a.x >= b.x && a.x <= b.x + b.width) || (a.x + a.width >= b.x && a.x + a.width <= b.x + b.width)) && ((a.y >= b.y && a.y <= b.y + b.height) || (a.y + a.height >= b.y && a.y + a.height <= b.y + b.height))) {
|
|
242
|
-
|
|
224
|
+
d = Math.random() * Math.PI * 2;
|
|
225
|
+
data = this.data[i];
|
|
226
|
+
ref$ = data.nb;
|
|
227
|
+
ref$.x = scale.x(data.x) + Math.cos(d) * r;
|
|
228
|
+
ref$.y = scale.y(data.y) + Math.sin(d) * r;
|
|
243
229
|
}
|
|
244
230
|
}
|
|
245
231
|
}
|
|
246
|
-
return this.render();
|
|
247
232
|
}
|
|
248
|
-
|
|
233
|
+
for (i$ = 0, to$ = this.data.length; i$ < to$; ++i$) {
|
|
234
|
+
i = i$;
|
|
235
|
+
for (j$ = 0; j$ < i; ++j$) {
|
|
236
|
+
j = j$;
|
|
237
|
+
ref$ = [this.data[i].nb, this.data[j].nb], a = ref$[0], b = ref$[1];
|
|
238
|
+
if (((a.x >= b.x && a.x <= b.x + b.width) || (a.x + a.width >= b.x && a.x + a.width <= b.x + b.width)) && ((a.y >= b.y && a.y <= b.y + b.height) || (a.y + a.height >= b.y && a.y + a.height <= b.y + b.height))) {
|
|
239
|
+
this.data[i].nb.show = false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return this.render();
|
|
244
|
+
}
|
|
249
245
|
};
|
|
250
|
-
|
|
251
|
-
});</script></div>
|
|
246
|
+
};</script></div>
|
|
@@ -1,103 +1,98 @@
|
|
|
1
|
-
<div><div plug="layout"></div><style type="text/css"></style><script type="@plotdb/block">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
name:
|
|
8
|
-
version:
|
|
9
|
-
extend: {
|
|
10
|
-
name: "base",
|
|
11
|
-
version: "0.0.1"
|
|
12
|
-
},
|
|
13
|
-
dependencies: [
|
|
14
|
-
{
|
|
15
|
-
url: "/assets/lib/@plotdb/sheet/main/index.min.js"
|
|
16
|
-
}, {
|
|
17
|
-
url: "/assets/lib/@plotdb/sheet/main/index.min.css"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
1
|
+
<div><div plug="layout"></div><style type="text/css"></style><script type="@plotdb/block">var mod;
|
|
2
|
+
module.exports = {
|
|
3
|
+
pkg: {
|
|
4
|
+
name: 'bar',
|
|
5
|
+
version: '0.0.1',
|
|
6
|
+
extend: {
|
|
7
|
+
name: "base",
|
|
8
|
+
version: "0.0.1"
|
|
20
9
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
dependencies: [
|
|
11
|
+
{
|
|
12
|
+
url: "/assets/lib/@plotdb/sheet/main/index.min.js"
|
|
13
|
+
}, {
|
|
14
|
+
url: "/assets/lib/@plotdb/sheet/main/index.min.css"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
init: function(arg$){
|
|
19
|
+
var root, context, t, pubsub;
|
|
20
|
+
root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
|
|
21
|
+
return pubsub.fire('init', {
|
|
22
|
+
mod: mod({
|
|
23
|
+
context: context,
|
|
24
|
+
t: t
|
|
25
|
+
}),
|
|
26
|
+
prepareSvg: false,
|
|
27
|
+
layout: false
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
mod = function(arg$){
|
|
32
|
+
var context, t, chart, sheet;
|
|
33
|
+
context = arg$.context, t = arg$.t;
|
|
34
|
+
chart = context.chart, sheet = context.sheet;
|
|
35
|
+
return {
|
|
36
|
+
sample: function(){
|
|
37
|
+
return {
|
|
38
|
+
raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20].map(function(val){
|
|
39
|
+
return Object.fromEntries([1, 2, 3, 4, 5].map(function(it){
|
|
40
|
+
return ["col" + it, (Math.random() * 100).toFixed(2)];
|
|
41
|
+
}));
|
|
28
42
|
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var context, t, chart, sheet;
|
|
36
|
-
context = arg$.context, t = arg$.t;
|
|
37
|
-
chart = context.chart, sheet = context.sheet;
|
|
38
|
-
return {
|
|
39
|
-
sample: function(){
|
|
40
|
-
return {
|
|
41
|
-
raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20].map(function(val){
|
|
42
|
-
return Object.fromEntries([1, 2, 3, 4, 5].map(function(it){
|
|
43
|
-
return ["col" + it, (Math.random() * 100).toFixed(2)];
|
|
44
|
-
}));
|
|
45
|
-
}),
|
|
46
|
-
binding: {
|
|
47
|
-
column: [1, 2, 3, 4, 5].map(function(it){
|
|
48
|
-
return {
|
|
49
|
-
key: "col" + it
|
|
50
|
-
};
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
config: {},
|
|
56
|
-
dimension: {
|
|
57
|
-
column: {
|
|
58
|
-
type: 'NCOR',
|
|
59
|
-
multiple: true,
|
|
60
|
-
name: 'column'
|
|
43
|
+
binding: {
|
|
44
|
+
column: [1, 2, 3, 4, 5].map(function(it){
|
|
45
|
+
return {
|
|
46
|
+
key: "col" + it
|
|
47
|
+
};
|
|
48
|
+
})
|
|
61
49
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
head = this.binding.column.map(function(it){
|
|
91
|
-
return it.name || it.key;
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
config: {},
|
|
53
|
+
dimension: {
|
|
54
|
+
column: {
|
|
55
|
+
type: 'NCOR',
|
|
56
|
+
multiple: true,
|
|
57
|
+
name: 'column'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
init: function(){
|
|
61
|
+
var this$ = this;
|
|
62
|
+
this.sheet = new sheet({
|
|
63
|
+
root: this.root.querySelector('[plug=layout]'),
|
|
64
|
+
frozen: {
|
|
65
|
+
row: 1
|
|
66
|
+
},
|
|
67
|
+
editing: false,
|
|
68
|
+
idx: {
|
|
69
|
+
row: true,
|
|
70
|
+
col: true
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.data = [this.binding.column.map(function(it){
|
|
74
|
+
return it.name || it.key;
|
|
75
|
+
})].concat(this.raw.map(function(r){
|
|
76
|
+
return this$.binding.column.map(function(c){
|
|
77
|
+
return r[c.key];
|
|
92
78
|
});
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
79
|
+
}));
|
|
80
|
+
return this.sheet.data(this.data);
|
|
81
|
+
},
|
|
82
|
+
filter: function(filters, internal){
|
|
83
|
+
internal == null && (internal = false);
|
|
84
|
+
},
|
|
85
|
+
parse: function(){
|
|
86
|
+
var head;
|
|
87
|
+
head = this.binding.column.map(function(it){
|
|
88
|
+
return it.name || it.key;
|
|
89
|
+
});
|
|
90
|
+
this.parsed = [head].concat(this.data.map(function(it){
|
|
91
|
+
return it.column;
|
|
92
|
+
}));
|
|
93
|
+
return this.sheet.data(this.parsed);
|
|
94
|
+
},
|
|
95
|
+
resize: function(){},
|
|
96
|
+
render: function(){}
|
|
101
97
|
};
|
|
102
|
-
|
|
103
|
-
});</script></div>
|
|
98
|
+
};</script></div>
|