@plotdb/chart 1.0.1 → 1.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/package.json +3 -1
- package/CHANGELOG.md +0 -29
- package/build +0 -45
- 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/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/index.ls +0 -323
- package/src/index.styl +0 -6
- 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 -21
- package/web/src/pug/block/axis/0.0.1/index.ls +0 -32
- 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 -137
- 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 -270
- 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 -81
- 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 -79
- 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 -66
- 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 -21
- 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 -218
- package/web/src/pug/block/bubble/0.0.1/index.pug +0 -42
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -85
- 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 -86
- 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 -28
- 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 -96
- 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 -297
- 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 -65
- 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 -161
- 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 -121
- 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 -181
- 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 -109
- 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 -124
- 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 -34
- 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 -36
- 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 -70
- 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 -44
- 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 -49
- 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 -168
- 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 -170
- 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 -57
- 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 -77
- 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 -6
- 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 -74
- package/web/static/block/axis-bubble/0.0.1/index.html +0 -217
- package/web/static/block/bar/0.0.1/index.html +0 -576
- package/web/static/block/bar-list/0.0.1/index.html +0 -226
- package/web/static/block/bar-race/0.0.1/index.html +0 -179
- package/web/static/block/base/0.0.1/index.html +0 -197
- package/web/static/block/blank/0.0.1/index.html +0 -37
- package/web/static/block/bubble/0.0.1/index.html +0 -422
- package/web/static/block/bubble/0.0.1/test.html +0 -0
- package/web/static/block/curve-bar/0.0.1/index.html +0 -143
- package/web/static/block/dumbbell/0.0.1/index.html +0 -173
- package/web/static/block/empty/0.0.1/index.html +0 -76
- package/web/static/block/gauge/0.0.1/index.html +0 -145
- package/web/static/block/line/0.0.1/index.html +0 -566
- package/web/static/block/number/0.0.1/index.html +0 -147
- package/web/static/block/percent-list/0.0.1/index.html +0 -311
- package/web/static/block/pie/0.0.1/index.html +0 -276
- package/web/static/block/pie-bubble/0.0.1/index.html +0 -353
- package/web/static/block/radar/0.0.1/index.html +0 -144
- package/web/static/block/scatter/0.0.1/index.html +0 -246
- package/web/static/block/sheet/0.0.1/index.html +0 -98
- package/web/static/block/table/0.0.1/index.html +0 -67
- package/web/static/block/taiwancounty/0.0.1/index.html +0 -197
- package/web/static/block/taiwantown/0.0.1/index.html +0 -205
- package/web/static/block/taiwanvillage/0.0.1/index.html +0 -215
- package/web/static/block/treemap/0.0.1/index.html +0 -355
- package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -345
- package/web/static/block/wordcloud/0.0.1/index.html +0 -87
- package/web/static/block/worldmap/0.0.1/index.html +0 -202
- package/web/static/css/index.css +0 -6
- package/web/static/css/index.min.css +0 -1
- package/web/static/favicon.ico +0 -0
- package/web/static/index.html +0 -153
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<div><script type="@plotdb/block">var mod;
|
|
2
|
-
module.exports = {
|
|
3
|
-
pkg: {
|
|
4
|
-
name: 'wordcloud',
|
|
5
|
-
version: '0.0.1',
|
|
6
|
-
extend: {
|
|
7
|
-
name: "base",
|
|
8
|
-
version: "0.0.1"
|
|
9
|
-
},
|
|
10
|
-
dependencies: [{
|
|
11
|
-
url: "https://unpkg.com/d3-cloud@1.2.5/build/d3.layout.cloud.js"
|
|
12
|
-
}]
|
|
13
|
-
},
|
|
14
|
-
init: function(arg$){
|
|
15
|
-
var root, context, pubsub;
|
|
16
|
-
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
17
|
-
return pubsub.fire('init', {
|
|
18
|
-
mod: mod({
|
|
19
|
-
context: context
|
|
20
|
-
})
|
|
21
|
-
}).then(function(it){
|
|
22
|
-
return it[0];
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
mod = function(arg$){
|
|
27
|
-
var context, root, d3, forceBoundary, ldColor, repeatString$;
|
|
28
|
-
context = arg$.context, root = arg$.root;
|
|
29
|
-
d3 = context.d3, forceBoundary = context.forceBoundary, ldColor = context.ldColor, repeatString$ = context.repeatString$;
|
|
30
|
-
return {
|
|
31
|
-
sample: function(){
|
|
32
|
-
return {
|
|
33
|
-
raw: [],
|
|
34
|
-
binding: {}
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
config: {},
|
|
38
|
-
dimension: {},
|
|
39
|
-
init: function(){
|
|
40
|
-
var this$ = this;
|
|
41
|
-
this.dd = ['cover', 'scandal', 'seem', 'consumption', 'garbage', 'hunter', 'pepper', 'west', 'guilt', 'conspiracy', 'pupil', 'boat', 'muscle', 'nightmare', 'gene', 'royalty', 'salon', 'difficult', 'management', 'brainstorm', 'aid', 'moving', 'plaster', 'cake', 'issue', 'realism', 'subject', 'speed', 'railcar', 'break', 'grass', 'collapse', 'is', 'leave', 'retiree', 'looting', 'transaction', 'copyright', 'serve', 'guard', 'colony', 'spell', 'ask', 'ranch', 'cell', 'sensation', 'name', 'default', 'reflection'].map(function(d, i){
|
|
42
|
-
return {
|
|
43
|
-
text: d,
|
|
44
|
-
value: 1.5 * i + 10
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
this.cloud = d3.layout.cloud();
|
|
48
|
-
return this.cloud.font('arial').padding(2).fontSize(function(it){
|
|
49
|
-
return it.value;
|
|
50
|
-
}).on('end', function(){
|
|
51
|
-
return this$.render();
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
parse: function(){},
|
|
55
|
-
resize: function(){
|
|
56
|
-
return this.cloud.size([this.box.width, this.box.height].map(function(it){
|
|
57
|
-
return Math.round(it);
|
|
58
|
-
})).words(this.dd).start();
|
|
59
|
-
},
|
|
60
|
-
render: function(){
|
|
61
|
-
var color, vext, vscale, x$, this$ = this;
|
|
62
|
-
color = d3.interpolateTurbo;
|
|
63
|
-
if (this.cfg != null && this.cfg.palette) {
|
|
64
|
-
color = d3.interpolateDiscrete(this.cfg.palette.colors.map(function(it){
|
|
65
|
-
return ldColor.web(it.value || it);
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
vext = d3.extent(this.dd.map(function(it){
|
|
69
|
-
return it.value;
|
|
70
|
-
}));
|
|
71
|
-
vscale = d3.scaleLinear().domain(vext).range([0, 1]);
|
|
72
|
-
x$ = d3.select(this.svg).selectAll('text').data(this.dd);
|
|
73
|
-
x$.exit().remove();
|
|
74
|
-
x$.enter().append('text');
|
|
75
|
-
return d3.select(this.svg).selectAll('text').attr('transform', function(it){
|
|
76
|
-
return "translate(" + (it.x + this$.box.width / 2) + " " + (it.y + this$.box.height / 2) + ") rotate(" + it.rotate + ")";
|
|
77
|
-
}).attr('text-anchor', 'middle').attr('font-size', function(it){
|
|
78
|
-
return it.size;
|
|
79
|
-
}).attr('font-family', 'arial').attr('fill', function(it){
|
|
80
|
-
return color(vscale(it.value));
|
|
81
|
-
}).text(function(it){
|
|
82
|
-
return it.text;
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
|
-
tick: function(){}
|
|
86
|
-
};
|
|
87
|
-
};</script></div>
|
|
@@ -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">var mod;
|
|
6
|
-
module.exports = {
|
|
7
|
-
pkg: {
|
|
8
|
-
name: 'worldmap',
|
|
9
|
-
version: '0.0.1',
|
|
10
|
-
extend: {
|
|
11
|
-
name: "base",
|
|
12
|
-
version: "0.0.1"
|
|
13
|
-
},
|
|
14
|
-
dependencies: [
|
|
15
|
-
{
|
|
16
|
-
url: "https://d3js.org/d3-geo.v2.min.js",
|
|
17
|
-
async: false
|
|
18
|
-
}, {
|
|
19
|
-
url: "https://d3js.org/topojson.v2.min.js",
|
|
20
|
-
async: false
|
|
21
|
-
}, {
|
|
22
|
-
url: "/assets/lib/@plotdb/pdmap-world/main/index.js"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
init: function(arg$){
|
|
27
|
-
var root, context, pubsub;
|
|
28
|
-
root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
|
|
29
|
-
return pubsub.fire('init', {
|
|
30
|
-
mod: mod({
|
|
31
|
-
context: context
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
mod = function(arg$){
|
|
37
|
-
var context, chart, d3, ldcolor, pdmapWorld, topojson;
|
|
38
|
-
context = arg$.context;
|
|
39
|
-
chart = context.chart, d3 = context.d3, ldcolor = context.ldcolor, pdmapWorld = context.pdmapWorld, topojson = context.topojson;
|
|
40
|
-
return {
|
|
41
|
-
sample: function(){
|
|
42
|
-
return {
|
|
43
|
-
raw: pdmapWorld.meta.alpha2.map(function(it){
|
|
44
|
-
return {
|
|
45
|
-
country: it,
|
|
46
|
-
val: Math.random()
|
|
47
|
-
};
|
|
48
|
-
}),
|
|
49
|
-
binding: {
|
|
50
|
-
color: {
|
|
51
|
-
key: 'val'
|
|
52
|
-
},
|
|
53
|
-
name: {
|
|
54
|
-
key: 'country'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
config: {},
|
|
60
|
-
dimension: {
|
|
61
|
-
name: {
|
|
62
|
-
type: 'N',
|
|
63
|
-
name: "國家"
|
|
64
|
-
},
|
|
65
|
-
color: {
|
|
66
|
-
type: 'R',
|
|
67
|
-
name: "顏色"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
init: function(){
|
|
71
|
-
var scale, this$ = this;
|
|
72
|
-
this.g = this.layout.getGroup('view');
|
|
73
|
-
this.obj = new pdmapWorld({
|
|
74
|
-
root: this.g
|
|
75
|
-
});
|
|
76
|
-
this.scale = scale = {
|
|
77
|
-
color: d3.interpolateTurbo
|
|
78
|
-
};
|
|
79
|
-
this.legend = new chart.utils.legend({
|
|
80
|
-
root: this.root,
|
|
81
|
-
name: 'legend',
|
|
82
|
-
layout: this.layout,
|
|
83
|
-
shape: function(d){
|
|
84
|
-
return d3.select(this).attr('fill', scale.color(d.key));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.tip = new chart.utils.tip({
|
|
88
|
-
root: this.root,
|
|
89
|
-
accessor: function(arg$){
|
|
90
|
-
var evt, data, ret, k, v, name;
|
|
91
|
-
evt = arg$.evt;
|
|
92
|
-
if (!(evt.target && (data = d3.select(evt.target).datum()))) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
ret = (function(){
|
|
96
|
-
var ref$, results$ = [];
|
|
97
|
-
for (k in ref$ = pdmapWorld.meta.zhalpha2) {
|
|
98
|
-
v = ref$[k];
|
|
99
|
-
results$.push([k, v]);
|
|
100
|
-
}
|
|
101
|
-
return results$;
|
|
102
|
-
}()).filter(function(it){
|
|
103
|
-
return it[1].toLowerCase() === data.properties.alpha2;
|
|
104
|
-
})[0];
|
|
105
|
-
name = ret
|
|
106
|
-
? ret[0]
|
|
107
|
-
: data.properties.shortname || data.data.name;
|
|
108
|
-
v = isNaN(data.data.color)
|
|
109
|
-
? '-'
|
|
110
|
-
: data.data.color.toFixed(2) + "" + (this$.binding.color.unit || '');
|
|
111
|
-
return {
|
|
112
|
-
name: name,
|
|
113
|
-
value: v
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
range: function(){
|
|
117
|
-
return this$.layout.getNode('view').getBoundingClientRect();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
return this.obj.init().then(function(){
|
|
121
|
-
return this$.obj.fit();
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
destroy: function(){
|
|
125
|
-
return this.tip.destroy();
|
|
126
|
-
},
|
|
127
|
-
parse: function(){
|
|
128
|
-
var geoData, this$ = this;
|
|
129
|
-
geoData = d3.select(this.g).selectAll('path').data();
|
|
130
|
-
geoData.map(function(d){
|
|
131
|
-
d.data = null;
|
|
132
|
-
d.properties.value = 0;
|
|
133
|
-
return d.properties.data = {};
|
|
134
|
-
});
|
|
135
|
-
this.data.map(function(it){
|
|
136
|
-
return {
|
|
137
|
-
c: this$.obj.findCountry(it.name),
|
|
138
|
-
v: it
|
|
139
|
-
};
|
|
140
|
-
}).filter(function(it){
|
|
141
|
-
return it.c;
|
|
142
|
-
}).map(function(it){
|
|
143
|
-
var ref$;
|
|
144
|
-
return ref$ = it.c, ref$.value = it.v.color, ref$.data = it.v, ref$;
|
|
145
|
-
});
|
|
146
|
-
geoData.map(function(d){
|
|
147
|
-
return d.data = d.properties.data || {};
|
|
148
|
-
});
|
|
149
|
-
return this.extent = {
|
|
150
|
-
c: d3.extent(geoData, function(it){
|
|
151
|
-
return it.properties.value;
|
|
152
|
-
})
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
resize: function(){
|
|
156
|
-
var ref$, pal, len, this$ = this;
|
|
157
|
-
this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
|
|
158
|
-
this.obj.fit(this.layout.getBox('view'));
|
|
159
|
-
pal = this.cfg.palette
|
|
160
|
-
? this.cfg.palette.colors
|
|
161
|
-
: ['#f00', '#999', '#00f'];
|
|
162
|
-
len = pal.length;
|
|
163
|
-
this.ticks = d3.quantize(function(it){
|
|
164
|
-
return (1 - it) * (this$.extent.c[1] - this$.extent.c[0]) + this$.extent.c[0];
|
|
165
|
-
}, len).map(function(it){
|
|
166
|
-
var that;
|
|
167
|
-
return {
|
|
168
|
-
key: it,
|
|
169
|
-
text: d3.format(this$.cfg.legendFormat || '.2f')(it) + ((that = this$.binding.color.unit) ? that : '')
|
|
170
|
-
};
|
|
171
|
-
});
|
|
172
|
-
this.ticks.sort(function(a, b){
|
|
173
|
-
return a.key - b.key;
|
|
174
|
-
});
|
|
175
|
-
if (this.cfg.palette) {
|
|
176
|
-
this.scale.color = d3.scaleLinear().domain(this.ticks.map(function(it){
|
|
177
|
-
return it.key;
|
|
178
|
-
})).range(pal.map(function(it){
|
|
179
|
-
return ldcolor.web(it.value || it);
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
return this.legend.data(this.ticks);
|
|
183
|
-
},
|
|
184
|
-
render: function(){
|
|
185
|
-
var this$ = this;
|
|
186
|
-
this.legend.render();
|
|
187
|
-
return d3.select(this.g).selectAll('path').transition().duration(350).attr('fill', function(d, i){
|
|
188
|
-
return this$.scale.color(d.properties.value);
|
|
189
|
-
}).attr('fill-opacity', function(d, i){
|
|
190
|
-
if (this$.cfg.dimEmpty) {
|
|
191
|
-
if (d.properties.value) {
|
|
192
|
-
return 1;
|
|
193
|
-
} else {
|
|
194
|
-
return 0.2;
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
return 1;
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
};</script></div>
|
package/web/static/css/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@font-face{font-family:'ldi';font-weight:normal;font-style:normal;src:url("/assets/lib/ldiconfont/main/ldif.ttf") format('truetype')}
|
package/web/static/favicon.ico
DELETED
|
File without changes
|
package/web/static/index.html
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="/assets/lib/bootstrap/main/css/bootstrap.min.css"><link rel="stylesheet" type="text/css" href="/assets/lib/@loadingio/bootstrap.ext/main/index.min.css"><link rel="stylesheet" type="text/css" href="/assets/lib/@loadingio/loading.css/main/loading.min.css"><link rel="stylesheet" type="text/css" href="/assets/lib/ldiconfont/main/ldif.min.css"><link rel="stylesheet" type="text/css" href="/css/index.css"><link rel="stylesheet" type="text/css" href="/assets/lib/ldpalettepicker/main/index.min.css"><style type="text/css">html,
|
|
2
|
-
body {
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
color: #345;
|
|
6
|
-
}
|
|
7
|
-
</style></head><body><div class="w-100 h-100" ld-scope="viewer"><div class="w-100 h-100 p-4 d-flex flex-column"><div><h5>Chart Testing Suite</h5><div class="d-flex flex-grow-1 mb-4"><select class="form-control" ld="choice"><option value="" disabled selected>選擇圖表 ...</option><option value="bar-race">bar-race</option><option value="bar-list">bar-list</option><option value="sheet">sheet</option><option value="percent-list">percent-list</option><option value="table">table</option><option value="scatter">scatter</option><option value="gauge">gauge</option><option value="number">number</option><option value="curve-bar">curve-bar</option><option value="dumbbell">dumbbell</option><option value="pie">pie</option><option value="axis">axis</option><option value="wordcloud">wordcloud</option><option value="axis-bubble">axis-bubble</option><option value="bubble">bubble</option><option value="treemap">treemap</option><option value="worldmap">worldmap</option><option value="taiwantown">taiwantown</option><option value="taiwanvillage">taiwanvillage</option><option value="pie-bubble">pie-bubble</option><option value="bar">bar</option><option value="voronoi-treemap">voronoi-treemap</option><option value="radar">radar</option><option value="line">line</option></select><div class="ml-2 btn btn-outline-secondary" ld="palette">Palette</div><div class="ml-2 btn btn-outline-secondary" ld="filter">Filter</div></div></div><div class="flex-grow-1 d-flex overflow-hidden"><div class="w-100 h-100 bg-light border shadow-sm rounded"><div class="w-100 h-100 rounded" id="root"></div></div><div class="border ml-4 bg-light border shadow-sm rounded p-4" style="width:320px;font-size:14px;overflow-y:scroll" ld="konfig"><div class="d-none"><div ld-scope="" ld="template"><div class="font-weight-bold text-lg mb-2" ld="name"></div><div class="mb-3" ld-each="ctrl"></div><div class="mb-4" ld-each="tab"></div></div></div></div></div></div></div><script type="text/javascript" src="/assets/lib/bootstrap.native/main/bootstrap-native-v4.min.js"></script><script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script><script type="text/javascript" src="/assets/lib/@loadingio/ldquery/main/ldq.min.js"></script><script type="text/javascript" src="/assets/lib/ldview/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/proxise/main/proxise.js"></script><script type="text/javascript" src="/assets/lib/@loadingio/debounce.js/main/debounce.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/csscope/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/rescope/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/block/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/konfig/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/konfig/main/konfig.widget.bootstrap.js"></script><script type="text/javascript" src="/assets/lib/ldpalettepicker/main/ldpp.min.js"></script><script type="text/javascript" src="/assets/lib/ldpalettepicker/main/all.palettes.js"></script><script>(function(it){
|
|
8
|
-
return it.apply({});
|
|
9
|
-
})(function(){
|
|
10
|
-
var lc, blockPrepare, manager;
|
|
11
|
-
lc = this;
|
|
12
|
-
blockPrepare = function(name, root, data){
|
|
13
|
-
if (!data) {
|
|
14
|
-
data = {
|
|
15
|
-
config: {
|
|
16
|
-
palette: {
|
|
17
|
-
"colors": ['#b32317', '#f58025', '#3a6e8f', '#87b2d8', '#8d8b00', '#c1d72f']
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
delayRender: false
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (lc.chart) {
|
|
24
|
-
lc.chart.destroy();
|
|
25
|
-
}
|
|
26
|
-
root.innerHTML = "";
|
|
27
|
-
console.log("[" + name + "] loading");
|
|
28
|
-
return manager.get({
|
|
29
|
-
name: name,
|
|
30
|
-
version: "0.0.1"
|
|
31
|
-
}).then(function(it){
|
|
32
|
-
return it.create({
|
|
33
|
-
data: data
|
|
34
|
-
});
|
|
35
|
-
}).then(function(bi){
|
|
36
|
-
console.log("[" + name + "] created");
|
|
37
|
-
return bi.attach({
|
|
38
|
-
root: root
|
|
39
|
-
}).then(function(){
|
|
40
|
-
return bi['interface']();
|
|
41
|
-
});
|
|
42
|
-
}).then(function(chart){
|
|
43
|
-
console.log("[" + name + "] attached");
|
|
44
|
-
window.chart = chart;
|
|
45
|
-
lc.chart = chart;
|
|
46
|
-
chart.config({
|
|
47
|
-
legend: {
|
|
48
|
-
selectable: true
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
chart.resize();
|
|
52
|
-
chart.render();
|
|
53
|
-
chart.on(['select', 'hover'], function(it){
|
|
54
|
-
return console.log("[select/hover] ", it);
|
|
55
|
-
});
|
|
56
|
-
console.log(chart.mod.config);
|
|
57
|
-
return lc.kfg.meta({
|
|
58
|
-
meta: chart.mod.config
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
manager = new block.manager({
|
|
63
|
-
registry: function(arg$){
|
|
64
|
-
var name, version, path, type;
|
|
65
|
-
name = arg$.name, version = arg$.version, path = arg$.path, type = arg$.type;
|
|
66
|
-
if (type === 'block') {
|
|
67
|
-
return "/block/" + name + "/" + version + "/" + (path || 'index.html');
|
|
68
|
-
}
|
|
69
|
-
if (!/^d3/.exec(name)) {
|
|
70
|
-
return "/assets/lib/" + name + "/" + version + "/" + path;
|
|
71
|
-
}
|
|
72
|
-
return "/assets/custom-lib/d3/" + name + ".v" + version + ".min.js";
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return manager.init().then(function(){
|
|
76
|
-
return manager.get({
|
|
77
|
-
name: "base",
|
|
78
|
-
version: "0.0.1"
|
|
79
|
-
});
|
|
80
|
-
}).then(function(){
|
|
81
|
-
var pals;
|
|
82
|
-
pals = ldpp.get('all');
|
|
83
|
-
return lc.view = new ldview({
|
|
84
|
-
root: '[ld-scope=viewer]',
|
|
85
|
-
action: {
|
|
86
|
-
change: {
|
|
87
|
-
choice: function(arg$){
|
|
88
|
-
var node;
|
|
89
|
-
node = arg$.node;
|
|
90
|
-
return blockPrepare(node.value, root);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
click: {
|
|
94
|
-
palette: function(){
|
|
95
|
-
lc.chart.config({
|
|
96
|
-
palette: {
|
|
97
|
-
colors: pals[Math.floor(pals.length * Math.random())]
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
lc.chart.resize();
|
|
101
|
-
return lc.chart.render();
|
|
102
|
-
},
|
|
103
|
-
filter: function(){
|
|
104
|
-
return lc.chart.filter({
|
|
105
|
-
name: [2, 5]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}).then(function(){
|
|
112
|
-
var query;
|
|
113
|
-
query = Object.fromEntries((window.location.search || "").substring(1).split('&').map(function(it){
|
|
114
|
-
return it.split('=');
|
|
115
|
-
}));
|
|
116
|
-
if (!query.chart) {
|
|
117
|
-
query.chart = lc.view.get('choice').value;
|
|
118
|
-
}
|
|
119
|
-
if (query.chart) {
|
|
120
|
-
blockPrepare(query.chart, root);
|
|
121
|
-
return lc.view.get('choice').value = query.chart;
|
|
122
|
-
}
|
|
123
|
-
}).then(function(){
|
|
124
|
-
lc.kfg = new konfig({
|
|
125
|
-
root: lc.view.get('konfig'),
|
|
126
|
-
manager: manager,
|
|
127
|
-
view: 'recurse',
|
|
128
|
-
useBundle: true,
|
|
129
|
-
debounce: false,
|
|
130
|
-
autotab: true,
|
|
131
|
-
typemap: function(name){
|
|
132
|
-
return {
|
|
133
|
-
name: "@plotdb/konfig.widget.bootstrap",
|
|
134
|
-
version: "master",
|
|
135
|
-
path: name
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
lc.kfg.init().then(function(it){
|
|
140
|
-
return console.log(">", it);
|
|
141
|
-
});
|
|
142
|
-
return lc.kfg.on('change', function(cfg){
|
|
143
|
-
lc.cfg = cfg;
|
|
144
|
-
if (!lc.chart) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
lc.chart.config(lc.cfg);
|
|
148
|
-
lc.chart.bind();
|
|
149
|
-
lc.chart.resize();
|
|
150
|
-
return lc.chart.render();
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
});</script></body></html>
|