@plotdb/chart 0.0.3 → 2.0.0
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 +34 -1
- package/README.md +3 -3
- package/{dist/data → data}/index.js +0 -0
- package/{dist/chart.css → index.css} +0 -0
- package/{dist/chart.js → index.js} +3 -1
- package/{dist/chart.min.css → index.min.css} +0 -0
- package/index.min.js +1 -0
- package/package.json +1 -89
- package/{dist/utils → utils}/axis.js +6 -0
- package/utils/axis.min.js +1 -0
- package/{dist/utils → utils}/config.js +0 -0
- package/utils/config.min.js +1 -0
- package/{dist/utils → utils}/data.js +0 -0
- package/utils/data.min.js +1 -0
- package/{dist/utils → utils}/format.js +0 -0
- package/utils/format.min.js +1 -0
- package/{dist/utils → utils}/legend.css +0 -0
- package/{dist/utils → utils}/legend.js +0 -0
- package/{dist/utils → utils}/legend.min.css +0 -0
- package/utils/legend.min.js +1 -0
- package/{dist/utils → utils}/tint.js +0 -0
- package/utils/tint.min.js +1 -0
- package/{dist/utils → utils}/tip.js +0 -0
- package/utils/tip.min.js +1 -0
- package/build +0 -39
- package/dist/chart.min.js +0 -1
- package/dist/utils/axis.min.js +0 -1
- package/dist/utils/config.min.js +0 -1
- package/dist/utils/data.min.js +0 -1
- package/dist/utils/format.min.js +0 -1
- package/dist/utils/legend.min.js +0 -1
- package/dist/utils/tint.min.js +0 -1
- package/dist/utils/tip.min.js +0 -1
- package/doc/charts.md +0 -58
- package/doc/config.md +0 -44
- package/doc/draft/chart.md +0 -146
- package/doc/draft/data.md +0 -8
- package/doc/draft/definition.md +0 -0
- package/doc/draft/events.md +0 -0
- package/doc/draft/filter.md +0 -0
- package/doc/draft/lifecycle.md +0 -89
- package/doc/spec.md +0 -89
- package/doc/todo.md +0 -27
- package/doc/utils/tip.md +0 -84
- package/src/chart.ls +0 -323
- package/src/chart.styl +0 -6
- package/src/data/en-US/category +0 -20
- package/src/data/en-US/fruit +0 -39
- package/src/data/en-US/movie +0 -125
- package/src/data/en-US/name +0 -58
- package/src/data/index.ls +0 -34
- package/src/data/zh-TW/category +0 -20
- package/src/data/zh-TW/fruits +0 -38
- package/src/data/zh-TW/movie +0 -125
- package/src/data/zh-TW/names +0 -105
- package/src/utils/axis.ls +0 -229
- package/src/utils/config.ls +0 -11
- package/src/utils/data.ls +0 -104
- package/src/utils/format.ls +0 -30
- package/src/utils/legend.ls +0 -134
- package/src/utils/legend.styl +0 -37
- package/src/utils/tint.ls +0 -66
- package/src/utils/tip.ls +0 -97
- package/web/src/pug/base.pug +0 -20
- package/web/src/pug/block/axis/0.0.1/index.ls +0 -38
- package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
- package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -141
- package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
- package/web/src/pug/block/bar/0.0.1/index.ls +0 -274
- package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
- package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -85
- package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
- package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -83
- package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
- package/web/src/pug/block/base/0.0.1/index.ls +0 -67
- package/web/src/pug/block/base/0.0.1/index.pug +0 -5
- package/web/src/pug/block/blank/0.0.1/index.ls +0 -25
- package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
- package/web/src/pug/block/bubble/0.0.1/index.ls +0 -220
- package/web/src/pug/block/bubble/0.0.1/index.pug +0 -28
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -89
- package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
- package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
- package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -90
- package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
- package/web/src/pug/block/empty/0.0.1/index.ls +0 -27
- package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
- package/web/src/pug/block/gauge/0.0.1/index.ls +0 -100
- package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
- package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
- package/web/src/pug/block/line/0.0.1/index.ls +0 -302
- package/web/src/pug/block/line/0.0.1/index.pug +0 -33
- package/web/src/pug/block/number/0.0.1/index.ls +0 -69
- package/web/src/pug/block/number/0.0.1/index.pug +0 -20
- package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -167
- package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
- package/web/src/pug/block/pie/0.0.1/index.ls +0 -125
- package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
- package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
- package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -185
- package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
- package/web/src/pug/block/radar/0.0.1/index.ls +0 -113
- package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
- package/web/src/pug/block/radar/0.0.1/xx +0 -285
- package/web/src/pug/block/scatter/0.0.1/index.ls +0 -128
- package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
- package/web/src/pug/block/sheet/0.0.1/index.ls +0 -38
- package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
- package/web/src/pug/block/table/0.0.1/index.ls +0 -40
- package/web/src/pug/block/table/0.0.1/index.pug +0 -3
- package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -74
- package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
- package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -48
- package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
- package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -53
- package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
- package/web/src/pug/block/treemap/0.0.1/index.ls +0 -172
- package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -174
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
- package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
- package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -61
- package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
- package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -81
- package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
- package/web/src/pug/index.ls +0 -72
- package/web/src/pug/index.pug +0 -51
- package/web/src/styl/index.styl +0 -0
- package/web/static/assets/block/cache.js +0 -4
- package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
- package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
- package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
- package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
- package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
- package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
- package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
- package/web/static/assets/data/countrycode.json +0 -1
- package/web/static/assets/data/world-110m.json +0 -1
- package/web/static/assets/data/zh-to-alpha2.json +0 -1
- package/web/static/assets/img/fluid.svg +0 -16
- package/web/static/block/axis/0.0.1/index.html +0 -79
- package/web/static/block/axis-bubble/0.0.1/index.html +0 -222
- package/web/static/block/bar/0.0.1/index.html +0 -581
- package/web/static/block/bar-list/0.0.1/index.html +0 -231
- package/web/static/block/bar-race/0.0.1/index.html +0 -184
- package/web/static/block/base/0.0.1/index.html +0 -197
- package/web/static/block/blank/0.0.1/index.html +0 -42
- package/web/static/block/bubble/0.0.1/index.html +0 -402
- package/web/static/block/bubble/0.0.1/test.html +0 -0
- package/web/static/block/curve-bar/0.0.1/index.html +0 -148
- package/web/static/block/dumbbell/0.0.1/index.html +0 -178
- package/web/static/block/empty/0.0.1/index.html +0 -76
- package/web/static/block/gauge/0.0.1/index.html +0 -150
- package/web/static/block/line/0.0.1/index.html +0 -571
- package/web/static/block/number/0.0.1/index.html +0 -152
- package/web/static/block/percent-list/0.0.1/index.html +0 -316
- package/web/static/block/pie/0.0.1/index.html +0 -281
- package/web/static/block/pie-bubble/0.0.1/index.html +0 -358
- package/web/static/block/radar/0.0.1/index.html +0 -149
- package/web/static/block/scatter/0.0.1/index.html +0 -251
- package/web/static/block/sheet/0.0.1/index.html +0 -103
- package/web/static/block/table/0.0.1/index.html +0 -73
- package/web/static/block/taiwancounty/0.0.1/index.html +0 -202
- package/web/static/block/taiwantown/0.0.1/index.html +0 -210
- package/web/static/block/taiwanvillage/0.0.1/index.html +0 -220
- package/web/static/block/treemap/0.0.1/index.html +0 -360
- package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -350
- package/web/static/block/wordcloud/0.0.1/index.html +0 -92
- package/web/static/block/worldmap/0.0.1/index.html +0 -207
- package/web/static/css/index.css +0 -0
- package/web/static/css/index.min.css +0 -0
- package/web/static/favicon.ico +0 -0
- package/web/static/index.html +0 -153
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
<div><div plug="layout"><div class="pdl-layout"><div data-type="layout"><div class="pdl-cell" data-name="view"></div><div class="pdl-cell" data-name="legend">123</div></div><div data-type="render"></div></div></div><style type="text/css">.pdl-layout > div[data-type=layout] {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: 1fr fit-content(5em);
|
|
4
|
-
}
|
|
5
|
-
</style><script type="@plotdb/block">(function(it){
|
|
6
|
-
return it();
|
|
7
|
-
})(function(){
|
|
8
|
-
var blockFactory, mod;
|
|
9
|
-
blockFactory = {
|
|
10
|
-
pkg: {
|
|
11
|
-
name: 'taiwancounty',
|
|
12
|
-
version: '0.0.1',
|
|
13
|
-
extend: {
|
|
14
|
-
name: "base",
|
|
15
|
-
version: "0.0.1"
|
|
16
|
-
},
|
|
17
|
-
dependencies: [
|
|
18
|
-
{
|
|
19
|
-
url: "https://d3js.org/topojson.v2.min.js",
|
|
20
|
-
async: false
|
|
21
|
-
}, {
|
|
22
|
-
url: "https://d3js.org/d3-geo.v2.min.js",
|
|
23
|
-
async: false
|
|
24
|
-
}, {
|
|
25
|
-
name: "pdmaptw",
|
|
26
|
-
version: "local",
|
|
27
|
-
path: "index.min.js",
|
|
28
|
-
async: false
|
|
29
|
-
}, {
|
|
30
|
-
name: "pdmaptw",
|
|
31
|
-
version: "local",
|
|
32
|
-
path: "county.map.js"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
init: function(arg$){
|
|
37
|
-
var root, context, pubsub;
|
|
38
|
-
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
39
|
-
return pubsub.fire('init', {
|
|
40
|
-
mod: mod({
|
|
41
|
-
context: context
|
|
42
|
-
})
|
|
43
|
-
}).then(function(it){
|
|
44
|
-
return it[0];
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
mod = function(arg$){
|
|
49
|
-
var context, chart, d3, ldcolor, pdmaptw, topojson;
|
|
50
|
-
context = arg$.context;
|
|
51
|
-
chart = context.chart, d3 = context.d3, ldcolor = context.ldcolor, pdmaptw = context.pdmaptw, topojson = context.topojson;
|
|
52
|
-
return {
|
|
53
|
-
sample: function(){
|
|
54
|
-
return pdmaptw.get('county').then(function(arg$){
|
|
55
|
-
var meta, topo;
|
|
56
|
-
meta = arg$.meta, topo = arg$.topo;
|
|
57
|
-
return {
|
|
58
|
-
raw: meta.name.map(function(it){
|
|
59
|
-
return {
|
|
60
|
-
val: Math.random(),
|
|
61
|
-
name: pdmaptw.normalize(it)
|
|
62
|
-
};
|
|
63
|
-
}),
|
|
64
|
-
binding: {
|
|
65
|
-
color: {
|
|
66
|
-
key: 'val'
|
|
67
|
-
},
|
|
68
|
-
name: {
|
|
69
|
-
key: 'name'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
config: {
|
|
76
|
-
palette: {
|
|
77
|
-
type: 'palette'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
dimension: {
|
|
81
|
-
name: {
|
|
82
|
-
type: 'N',
|
|
83
|
-
name: "國家"
|
|
84
|
-
},
|
|
85
|
-
color: {
|
|
86
|
-
type: 'R',
|
|
87
|
-
name: "顏色"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
init: function(){
|
|
91
|
-
var scale, this$ = this;
|
|
92
|
-
this.g = this.layout.getGroup('view');
|
|
93
|
-
this.obj = new pdmaptw({
|
|
94
|
-
root: this.g,
|
|
95
|
-
type: 'county'
|
|
96
|
-
});
|
|
97
|
-
this.scale = scale = {
|
|
98
|
-
color: d3.interpolateTurbo
|
|
99
|
-
};
|
|
100
|
-
this.legend = new chart.utils.legend({
|
|
101
|
-
root: this.root,
|
|
102
|
-
name: 'legend',
|
|
103
|
-
layout: this.layout,
|
|
104
|
-
shape: function(d){
|
|
105
|
-
return d3.select(this).attr('fill', scale.color(d.key));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
this.tip = new chart.utils.tip({
|
|
109
|
-
root: this.root,
|
|
110
|
-
accessor: function(arg$){
|
|
111
|
-
var evt, data;
|
|
112
|
-
evt = arg$.evt;
|
|
113
|
-
if (!(evt.target && (data = d3.select(evt.target).datum()))) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
name: data.data.name,
|
|
118
|
-
value: data.data.color
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
range: function(){
|
|
122
|
-
return this$.layout.getNode('view').getBoundingClientRect();
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return this.obj.init().then(function(){
|
|
126
|
-
return this$.obj.fit({
|
|
127
|
-
node: this$.g,
|
|
128
|
-
box: this$.layout.getNode('view').getBoundingClientRect()
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
parse: function(){
|
|
133
|
-
var this$ = this;
|
|
134
|
-
this.extent = {
|
|
135
|
-
c: [undefined, undefined]
|
|
136
|
-
};
|
|
137
|
-
return d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
138
|
-
d.data = this$.data.filter(function(it){
|
|
139
|
-
return it.name === d.properties.name;
|
|
140
|
-
})[0] || {};
|
|
141
|
-
if (!(this$.extent.c[0] != null) || d.data.color < this$.extent.c[0]) {
|
|
142
|
-
this$.extent.c[0] = d.data.color;
|
|
143
|
-
}
|
|
144
|
-
if (!(this$.extent.c[1] != null) || d.data.color > this$.extent.c[1]) {
|
|
145
|
-
return this$.extent.c[1] = d.data.color;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
resize: function(){
|
|
150
|
-
var ref$, pal, len, this$ = this;
|
|
151
|
-
this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
|
|
152
|
-
this.obj.fit(this.layout.getBox('view'));
|
|
153
|
-
pal = this.cfg.palette
|
|
154
|
-
? this.cfg.palette.colors
|
|
155
|
-
: ['#f00', '#999', '#00f'];
|
|
156
|
-
len = pal.length;
|
|
157
|
-
this.ticks = d3.quantize(function(it){
|
|
158
|
-
return (1 - it) * (this$.extent.c[1] - this$.extent.c[0]) + this$.extent.c[0];
|
|
159
|
-
}, len).map(function(it){
|
|
160
|
-
var that;
|
|
161
|
-
return {
|
|
162
|
-
key: it,
|
|
163
|
-
text: d3.format(this$.cfg.legendFormat || '.2f')(it) + ((that = this$.binding.color.unit) ? that : '')
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
this.ticks.sort(function(a, b){
|
|
167
|
-
return a.key - b.key;
|
|
168
|
-
});
|
|
169
|
-
if (this.cfg.palette) {
|
|
170
|
-
this.scale.color = d3.scaleLinear().domain(this.ticks.map(function(it){
|
|
171
|
-
return it.key;
|
|
172
|
-
})).range(pal.map(function(it){
|
|
173
|
-
return ldcolor.web(it.value || it);
|
|
174
|
-
}));
|
|
175
|
-
}
|
|
176
|
-
this.legend.data(this.ticks);
|
|
177
|
-
return this.obj.fit({
|
|
178
|
-
node: this.g,
|
|
179
|
-
box: this.layout.getBox('view')
|
|
180
|
-
});
|
|
181
|
-
},
|
|
182
|
-
render: function(){
|
|
183
|
-
var this$ = this;
|
|
184
|
-
d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
185
|
-
return this$.scale.color(d.data.color);
|
|
186
|
-
}).attr('fill-opacity', function(d, i){
|
|
187
|
-
if (this$.cfg.dimEmpty) {
|
|
188
|
-
if (d.data.color != null) {
|
|
189
|
-
return 1;
|
|
190
|
-
} else {
|
|
191
|
-
return 0.2;
|
|
192
|
-
}
|
|
193
|
-
} else {
|
|
194
|
-
return 1;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
return this.legend.render();
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
return blockFactory;
|
|
202
|
-
});</script></div>
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
<div><script type="@plotdb/block">(function(it){
|
|
2
|
-
return it();
|
|
3
|
-
})(function(){
|
|
4
|
-
var blockFactory, mod;
|
|
5
|
-
blockFactory = {
|
|
6
|
-
pkg: {
|
|
7
|
-
name: 'taiwantown',
|
|
8
|
-
version: '0.0.1',
|
|
9
|
-
extend: {
|
|
10
|
-
name: "base",
|
|
11
|
-
version: "0.0.1"
|
|
12
|
-
},
|
|
13
|
-
dependencies: [
|
|
14
|
-
{
|
|
15
|
-
url: "https://d3js.org/topojson.v2.min.js",
|
|
16
|
-
async: false
|
|
17
|
-
}, {
|
|
18
|
-
url: "/js/work/map.list.js",
|
|
19
|
-
async: false
|
|
20
|
-
}, {
|
|
21
|
-
url: "https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist/pdmaptw.min.js"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
init: function(arg$){
|
|
26
|
-
var root, context, pubsub;
|
|
27
|
-
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
28
|
-
return pubsub.fire('init', {
|
|
29
|
-
mod: mod({
|
|
30
|
-
context: context
|
|
31
|
-
})
|
|
32
|
-
}).then(function(it){
|
|
33
|
-
return it[0];
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
mod = function(arg$){
|
|
38
|
-
var context, d3, forceBoundary, ldColor, repeatString$, pdmaptw, counties, towns;
|
|
39
|
-
context = arg$.context;
|
|
40
|
-
d3 = context.d3, forceBoundary = context.forceBoundary, ldColor = context.ldColor, repeatString$ = context.repeatString$, pdmaptw = context.pdmaptw, counties = context.counties, towns = context.towns;
|
|
41
|
-
return {
|
|
42
|
-
sample: function(){
|
|
43
|
-
var val;
|
|
44
|
-
val = {
|
|
45
|
-
counties: counties.map(function(d, i){
|
|
46
|
-
return {
|
|
47
|
-
val: Math.random(),
|
|
48
|
-
county: d
|
|
49
|
-
};
|
|
50
|
-
}),
|
|
51
|
-
towns: towns.map(function(d, i){
|
|
52
|
-
return {
|
|
53
|
-
val: Math.random(),
|
|
54
|
-
town: d
|
|
55
|
-
};
|
|
56
|
-
})
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
raw: val.towns,
|
|
60
|
-
binding: {
|
|
61
|
-
color: {
|
|
62
|
-
key: 'val'
|
|
63
|
-
},
|
|
64
|
-
name: {
|
|
65
|
-
key: 'town'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
config: {},
|
|
71
|
-
dimension: {
|
|
72
|
-
name: {
|
|
73
|
-
type: 'N',
|
|
74
|
-
name: "國家"
|
|
75
|
-
},
|
|
76
|
-
color: {
|
|
77
|
-
type: 'R',
|
|
78
|
-
name: "顏色"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
init: function(){
|
|
82
|
-
var this$ = this;
|
|
83
|
-
this.obj = pdmaptw.create({
|
|
84
|
-
root: this.svg,
|
|
85
|
-
type: 'town',
|
|
86
|
-
baseurl: 'https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist'
|
|
87
|
-
});
|
|
88
|
-
return this.obj.init().then(function(){
|
|
89
|
-
return this$.obj.fit();
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
parse: function(){
|
|
93
|
-
var this$ = this;
|
|
94
|
-
return d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
95
|
-
return d.data = this$.data.filter(function(it){
|
|
96
|
-
return it.name === d.properties.name;
|
|
97
|
-
})[0] || {};
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
resize: function(){},
|
|
101
|
-
render: function(){
|
|
102
|
-
var this$ = this;
|
|
103
|
-
this.color = d3.interpolateTurbo;
|
|
104
|
-
if (this.cfg != null && this.cfg.palette) {
|
|
105
|
-
this.color = d3.interpolateDiscrete(this.cfg.palette.colors.map(function(it){
|
|
106
|
-
return ldColor.web(it.value || it);
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
return d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
110
|
-
return this$.color(d.data.color);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
return blockFactory;
|
|
116
|
-
});</script></div><div><script type="@plotdb/block">({
|
|
117
|
-
pkg: {
|
|
118
|
-
name: 'taiwantown',
|
|
119
|
-
version: '0.0.1',
|
|
120
|
-
dependencies: [
|
|
121
|
-
{
|
|
122
|
-
url: "https://d3js.org/d3.v4.js",
|
|
123
|
-
async: false
|
|
124
|
-
}, "https://d3js.org/d3-format.v2.min.js", "https://d3js.org/d3-array.v2.min.js", "https://d3js.org/topojson.v2.min.js", {
|
|
125
|
-
url: "https://d3js.org/d3-color.v1.min.js",
|
|
126
|
-
async: false
|
|
127
|
-
}, {
|
|
128
|
-
url: "https://d3js.org/d3-interpolate.v1.min.js",
|
|
129
|
-
async: false
|
|
130
|
-
}, {
|
|
131
|
-
url: "https://d3js.org/d3-scale-chromatic.v1.min.js",
|
|
132
|
-
async: false
|
|
133
|
-
}, "/js/map.list.js", "https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist/pdmaptw.min.js"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
init: function(arg$){
|
|
137
|
-
var root, context, counties, towns, c;
|
|
138
|
-
root = arg$.root, context = arg$.context;
|
|
139
|
-
counties = context.counties.map(function(d, i){
|
|
140
|
-
return {
|
|
141
|
-
val: Math.random(),
|
|
142
|
-
county: d
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
towns = context.towns.map(function(d, i){
|
|
146
|
-
return {
|
|
147
|
-
val: Math.random(),
|
|
148
|
-
town: d
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
c = new chart({
|
|
152
|
-
root: root,
|
|
153
|
-
raw: towns,
|
|
154
|
-
mod: this.mod({
|
|
155
|
-
context: context
|
|
156
|
-
}),
|
|
157
|
-
binding: {
|
|
158
|
-
color: {
|
|
159
|
-
name: 'val'
|
|
160
|
-
},
|
|
161
|
-
name: {
|
|
162
|
-
name: 'town'
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
c.init().then(function(){
|
|
167
|
-
return c.render();
|
|
168
|
-
});
|
|
169
|
-
return this.c = c;
|
|
170
|
-
},
|
|
171
|
-
'interface': function(){
|
|
172
|
-
return this.c;
|
|
173
|
-
},
|
|
174
|
-
mod: function(arg$){
|
|
175
|
-
var context;
|
|
176
|
-
context = arg$.context;
|
|
177
|
-
return {
|
|
178
|
-
init: function(){
|
|
179
|
-
var this$ = this;
|
|
180
|
-
this.obj = context.pdmaptw.create({
|
|
181
|
-
root: this.svg,
|
|
182
|
-
type: 'town',
|
|
183
|
-
baseurl: 'https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist'
|
|
184
|
-
});
|
|
185
|
-
return this.obj.init().then(function(){
|
|
186
|
-
return this$.obj.fit();
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
parse: function(){
|
|
190
|
-
var this$ = this;
|
|
191
|
-
return d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
192
|
-
return d.data = this$.data.filter(function(it){
|
|
193
|
-
return it.name === d.properties.name;
|
|
194
|
-
})[0] || {};
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
resize: function(){},
|
|
198
|
-
render: function(){
|
|
199
|
-
var this$ = this;
|
|
200
|
-
this.color = d3.interpolateTurbo;
|
|
201
|
-
if (config.pal) {
|
|
202
|
-
this.color = d3.interpolateDiscrete(config.pal);
|
|
203
|
-
}
|
|
204
|
-
return d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
205
|
-
return this$.color(d.data.color);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
});</script></div>
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
<div><script type="@plotdb/block">(function(it){
|
|
2
|
-
return it();
|
|
3
|
-
})(function(){
|
|
4
|
-
var blockFactory, mod;
|
|
5
|
-
blockFactory = {
|
|
6
|
-
pkg: {
|
|
7
|
-
name: 'taiwanvillage',
|
|
8
|
-
version: '0.0.1',
|
|
9
|
-
extend: {
|
|
10
|
-
name: "base",
|
|
11
|
-
version: "0.0.1"
|
|
12
|
-
},
|
|
13
|
-
dependencies: [
|
|
14
|
-
{
|
|
15
|
-
url: "https://d3js.org/topojson.v2.min.js",
|
|
16
|
-
async: false
|
|
17
|
-
}, {
|
|
18
|
-
url: "/js/work/map.list.js",
|
|
19
|
-
async: false
|
|
20
|
-
}, {
|
|
21
|
-
url: "https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist/pdmaptw.min.js"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
init: function(arg$){
|
|
26
|
-
var root, context, pubsub;
|
|
27
|
-
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
28
|
-
return pubsub.fire('init', {
|
|
29
|
-
mod: mod({
|
|
30
|
-
context: context
|
|
31
|
-
})
|
|
32
|
-
}).then(function(it){
|
|
33
|
-
return it[0];
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
mod = function(arg$){
|
|
38
|
-
var context, d3, forceBoundary, ldColor, repeatString$, pdmaptw, counties, towns, villages;
|
|
39
|
-
context = arg$.context;
|
|
40
|
-
d3 = context.d3, forceBoundary = context.forceBoundary, ldColor = context.ldColor, repeatString$ = context.repeatString$, pdmaptw = context.pdmaptw, counties = context.counties, towns = context.towns, villages = context.villages;
|
|
41
|
-
return {
|
|
42
|
-
sample: function(){
|
|
43
|
-
var val;
|
|
44
|
-
val = {
|
|
45
|
-
counties: counties.map(function(d, i){
|
|
46
|
-
return {
|
|
47
|
-
val: Math.random(),
|
|
48
|
-
county: d
|
|
49
|
-
};
|
|
50
|
-
}),
|
|
51
|
-
towns: towns.map(function(d, i){
|
|
52
|
-
return {
|
|
53
|
-
val: Math.random(),
|
|
54
|
-
town: d
|
|
55
|
-
};
|
|
56
|
-
}),
|
|
57
|
-
villages: villages.map(function(d, i){
|
|
58
|
-
return {
|
|
59
|
-
val: Math.random(),
|
|
60
|
-
village: d
|
|
61
|
-
};
|
|
62
|
-
})
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
raw: val.villages,
|
|
66
|
-
binding: {
|
|
67
|
-
color: {
|
|
68
|
-
key: 'val'
|
|
69
|
-
},
|
|
70
|
-
name: {
|
|
71
|
-
key: 'village'
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
config: {},
|
|
77
|
-
dimension: {
|
|
78
|
-
name: {
|
|
79
|
-
type: 'N',
|
|
80
|
-
name: "國家"
|
|
81
|
-
},
|
|
82
|
-
color: {
|
|
83
|
-
type: 'R',
|
|
84
|
-
name: "顏色"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
init: function(){
|
|
88
|
-
var this$ = this;
|
|
89
|
-
this.obj = pdmaptw.create({
|
|
90
|
-
root: this.svg,
|
|
91
|
-
type: 'village',
|
|
92
|
-
baseurl: 'https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist'
|
|
93
|
-
});
|
|
94
|
-
return this.obj.init().then(function(){
|
|
95
|
-
return this$.obj.fit();
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
parse: function(){
|
|
99
|
-
var this$ = this;
|
|
100
|
-
d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
101
|
-
return d.data = this$.data.filter(function(it){
|
|
102
|
-
return it.name === d.properties.name;
|
|
103
|
-
})[0] || {};
|
|
104
|
-
});
|
|
105
|
-
d3.select(this.svg).selectAll('path').filter(function(d, i){
|
|
106
|
-
return !/彰化縣/.exec(d.properties.name);
|
|
107
|
-
}).remove();
|
|
108
|
-
return this.obj.fit();
|
|
109
|
-
},
|
|
110
|
-
resize: function(){},
|
|
111
|
-
render: function(){
|
|
112
|
-
var this$ = this;
|
|
113
|
-
this.color = d3.interpolateTurbo;
|
|
114
|
-
if (this.cfg != null && this.cfg.palette) {
|
|
115
|
-
this.color = d3.interpolateDiscrete(this.cfg.palette.colors.map(function(it){
|
|
116
|
-
return ldColor.web(it.value || it);
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
return d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
120
|
-
return this$.color(d.data.color);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
return blockFactory;
|
|
126
|
-
});</script></div><div><script type="@plotdb/block">({
|
|
127
|
-
pkg: {
|
|
128
|
-
name: 'taiwantown',
|
|
129
|
-
version: '0.0.1',
|
|
130
|
-
dependencies: [
|
|
131
|
-
{
|
|
132
|
-
url: "https://d3js.org/d3.v4.js",
|
|
133
|
-
async: false
|
|
134
|
-
}, "https://d3js.org/d3-format.v2.min.js", "https://d3js.org/d3-array.v2.min.js", "https://d3js.org/topojson.v2.min.js", {
|
|
135
|
-
url: "https://d3js.org/d3-color.v1.min.js",
|
|
136
|
-
async: false
|
|
137
|
-
}, {
|
|
138
|
-
url: "https://d3js.org/d3-interpolate.v1.min.js",
|
|
139
|
-
async: false
|
|
140
|
-
}, {
|
|
141
|
-
url: "https://d3js.org/d3-scale-chromatic.v1.min.js",
|
|
142
|
-
async: false
|
|
143
|
-
}, "/js/map.list.js", "https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist/pdmaptw.min.js"
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
init: function(arg$){
|
|
147
|
-
var root, context, counties, towns, c;
|
|
148
|
-
root = arg$.root, context = arg$.context;
|
|
149
|
-
counties = context.counties.map(function(d, i){
|
|
150
|
-
return {
|
|
151
|
-
val: Math.random(),
|
|
152
|
-
county: d
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
towns = context.towns.map(function(d, i){
|
|
156
|
-
return {
|
|
157
|
-
val: Math.random(),
|
|
158
|
-
town: d
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
c = new chart({
|
|
162
|
-
root: root,
|
|
163
|
-
raw: towns,
|
|
164
|
-
mod: this.mod({
|
|
165
|
-
context: context
|
|
166
|
-
}),
|
|
167
|
-
binding: {
|
|
168
|
-
color: {
|
|
169
|
-
name: 'val'
|
|
170
|
-
},
|
|
171
|
-
name: {
|
|
172
|
-
name: 'town'
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
c.init().then(function(){
|
|
177
|
-
return c.render();
|
|
178
|
-
});
|
|
179
|
-
return this.c = c;
|
|
180
|
-
},
|
|
181
|
-
'interface': function(){
|
|
182
|
-
return this.c;
|
|
183
|
-
},
|
|
184
|
-
mod: function(arg$){
|
|
185
|
-
var context;
|
|
186
|
-
context = arg$.context;
|
|
187
|
-
return {
|
|
188
|
-
init: function(){
|
|
189
|
-
var this$ = this;
|
|
190
|
-
this.obj = context.pdmaptw.create({
|
|
191
|
-
root: this.svg,
|
|
192
|
-
type: 'town',
|
|
193
|
-
baseurl: 'https://cdn.jsdelivr.net/npm/pdmaptw@0.0.2/dist'
|
|
194
|
-
});
|
|
195
|
-
return this.obj.init().then(function(){
|
|
196
|
-
return this$.obj.fit();
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
parse: function(){
|
|
200
|
-
var this$ = this;
|
|
201
|
-
return d3.select(this.svg).selectAll('path').each(function(d, i){
|
|
202
|
-
return d.data = this$.data.filter(function(it){
|
|
203
|
-
return it.name === d.properties.name;
|
|
204
|
-
})[0] || {};
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
resize: function(){},
|
|
208
|
-
render: function(){
|
|
209
|
-
var this$ = this;
|
|
210
|
-
this.color = d3.interpolateTurbo;
|
|
211
|
-
if (config.pal) {
|
|
212
|
-
this.color = d3.interpolateDiscrete(config.pal);
|
|
213
|
-
}
|
|
214
|
-
return d3.select(this.svg).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
215
|
-
return this$.color(d.data.color);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
});</script></div>
|