@plotdb/chart 0.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/CHANGELOG.md +11 -0
- package/README.md +50 -0
- package/build +39 -0
- package/dist/chart.css +8 -0
- package/dist/chart.js +603 -0
- package/dist/chart.min.css +1 -0
- package/dist/chart.min.js +1 -0
- package/dist/data/index.js +73 -0
- package/dist/utils/axis.js +357 -0
- package/dist/utils/axis.min.js +1 -0
- package/dist/utils/config.js +33 -0
- package/dist/utils/config.min.js +1 -0
- package/dist/utils/data.js +238 -0
- package/dist/utils/data.min.js +1 -0
- package/dist/utils/format.js +70 -0
- package/dist/utils/format.min.js +1 -0
- package/dist/utils/legend.css +40 -0
- package/dist/utils/legend.js +263 -0
- package/dist/utils/legend.min.css +1 -0
- package/dist/utils/legend.min.js +1 -0
- package/dist/utils/tint.js +138 -0
- package/dist/utils/tint.min.js +1 -0
- package/dist/utils/tip.js +148 -0
- package/dist/utils/tip.min.js +1 -0
- package/doc/charts.md +58 -0
- package/doc/config.md +44 -0
- package/doc/draft/chart.md +146 -0
- package/doc/draft/data.md +8 -0
- 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 +89 -0
- package/doc/spec.md +89 -0
- package/doc/todo.md +27 -0
- package/doc/utils/tip.md +84 -0
- package/package.json +83 -0
- package/src/chart.ls +320 -0
- package/src/chart.styl +6 -0
- package/src/data/en-US/category +20 -0
- package/src/data/en-US/fruit +39 -0
- package/src/data/en-US/movie +125 -0
- package/src/data/en-US/name +58 -0
- package/src/data/index.ls +34 -0
- package/src/data/zh-TW/category +20 -0
- package/src/data/zh-TW/fruits +38 -0
- package/src/data/zh-TW/movie +125 -0
- package/src/data/zh-TW/names +105 -0
- package/src/utils/axis.ls +229 -0
- package/src/utils/config.ls +11 -0
- package/src/utils/data.ls +104 -0
- package/src/utils/format.ls +30 -0
- package/src/utils/legend.ls +134 -0
- package/src/utils/legend.styl +37 -0
- package/src/utils/tint.ls +66 -0
- package/src/utils/tip.ls +97 -0
- package/web/src/pug/base.pug +19 -0
- package/web/src/pug/block/axis/0.0.1/index.ls +38 -0
- package/web/src/pug/block/axis/0.0.1/index.pug +1 -0
- package/web/src/pug/block/axis-bubble/0.0.1/index.ls +141 -0
- package/web/src/pug/block/axis-bubble/0.0.1/index.pug +1 -0
- package/web/src/pug/block/bar/0.0.1/index.ls +274 -0
- package/web/src/pug/block/bar/0.0.1/index.pug +35 -0
- package/web/src/pug/block/bar-list/0.0.1/index.ls +85 -0
- package/web/src/pug/block/bar-list/0.0.1/index.pug +30 -0
- package/web/src/pug/block/bar-race/0.0.1/index.ls +83 -0
- package/web/src/pug/block/bar-race/0.0.1/index.pug +21 -0
- package/web/src/pug/block/base/0.0.1/index.ls +67 -0
- package/web/src/pug/block/base/0.0.1/index.pug +5 -0
- package/web/src/pug/block/blank/0.0.1/index.ls +25 -0
- package/web/src/pug/block/blank/0.0.1/index.pug +1 -0
- package/web/src/pug/block/bubble/0.0.1/index.ls +220 -0
- package/web/src/pug/block/bubble/0.0.1/index.pug +28 -0
- package/web/src/pug/block/curve-bar/0.0.1/index.ls +89 -0
- package/web/src/pug/block/curve-bar/0.0.1/index.pug +16 -0
- package/web/src/pug/block/curve-bar/0.0.1/sample.js +338 -0
- package/web/src/pug/block/dumbbell/0.0.1/index.ls +90 -0
- package/web/src/pug/block/dumbbell/0.0.1/index.pug +1 -0
- package/web/src/pug/block/empty/0.0.1/index.ls +27 -0
- package/web/src/pug/block/empty/0.0.1/index.pug +2 -0
- package/web/src/pug/block/gauge/0.0.1/index.ls +100 -0
- package/web/src/pug/block/gauge/0.0.1/index.pug +31 -0
- package/web/src/pug/block/gauge/0.0.1/sample.js +338 -0
- package/web/src/pug/block/line/0.0.1/index.ls +265 -0
- package/web/src/pug/block/line/0.0.1/index.pug +33 -0
- package/web/src/pug/block/number/0.0.1/index.ls +69 -0
- package/web/src/pug/block/number/0.0.1/index.pug +20 -0
- package/web/src/pug/block/percent-list/0.0.1/index.ls +167 -0
- package/web/src/pug/block/percent-list/0.0.1/index.pug +34 -0
- package/web/src/pug/block/pie/0.0.1/index.ls +125 -0
- package/web/src/pug/block/pie/0.0.1/index.pug +19 -0
- package/web/src/pug/block/pie/0.0.1/sample.js +338 -0
- package/web/src/pug/block/pie-bubble/0.0.1/index.ls +185 -0
- package/web/src/pug/block/pie-bubble/0.0.1/index.pug +40 -0
- package/web/src/pug/block/radar/0.0.1/index.ls +113 -0
- package/web/src/pug/block/radar/0.0.1/index.pug +1 -0
- package/web/src/pug/block/radar/0.0.1/xx +285 -0
- package/web/src/pug/block/scatter/0.0.1/index.ls +128 -0
- package/web/src/pug/block/scatter/0.0.1/index.pug +30 -0
- package/web/src/pug/block/sheet/0.0.1/index.ls +38 -0
- package/web/src/pug/block/sheet/0.0.1/index.pug +5 -0
- package/web/src/pug/block/table/0.0.1/index.ls +40 -0
- package/web/src/pug/block/table/0.0.1/index.pug +3 -0
- package/web/src/pug/block/taiwantown/0.0.1/index.ls +48 -0
- package/web/src/pug/block/taiwantown/0.0.1/index.pug +52 -0
- package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +53 -0
- package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +52 -0
- package/web/src/pug/block/treemap/0.0.1/index.ls +172 -0
- package/web/src/pug/block/treemap/0.0.1/index.pug +42 -0
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +174 -0
- package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +17 -0
- package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +241 -0
- package/web/src/pug/block/wordcloud/0.0.1/index.ls +61 -0
- package/web/src/pug/block/wordcloud/0.0.1/index.pug +1 -0
- package/web/src/pug/block/worldmap/0.0.1/index.ls +83 -0
- package/web/src/pug/block/worldmap/0.0.1/index.pug +12 -0
- package/web/src/pug/index.ls +72 -0
- package/web/src/pug/index.pug +52 -0
- package/web/src/styl/index.styl +0 -0
- package/web/static/assets/block/cache.js +4 -0
- package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +2 -0
- package/web/static/assets/custom-lib/d3/d3.v4.js +17178 -0
- package/web/static/assets/custom-lib/d3/d3.v4.min.js +2 -0
- package/web/static/assets/data/countrycode.json +1 -0
- package/web/static/assets/data/world-110m.json +1 -0
- package/web/static/assets/data/zh-to-alpha2.json +1 -0
- package/web/static/assets/img/fluid.svg +16 -0
- package/web/static/block/axis/0.0.1/index.html +79 -0
- package/web/static/block/axis-bubble/0.0.1/index.html +222 -0
- package/web/static/block/bar/0.0.1/index.html +581 -0
- package/web/static/block/bar-list/0.0.1/index.html +231 -0
- package/web/static/block/bar-race/0.0.1/index.html +184 -0
- package/web/static/block/base/0.0.1/index.html +197 -0
- package/web/static/block/blank/0.0.1/index.html +42 -0
- package/web/static/block/bubble/0.0.1/index.html +402 -0
- package/web/static/block/bubble/0.0.1/test.html +0 -0
- package/web/static/block/curve-bar/0.0.1/index.html +148 -0
- package/web/static/block/dumbbell/0.0.1/index.html +178 -0
- package/web/static/block/empty/0.0.1/index.html +76 -0
- package/web/static/block/gauge/0.0.1/index.html +150 -0
- package/web/static/block/line/0.0.1/index.html +540 -0
- package/web/static/block/number/0.0.1/index.html +152 -0
- package/web/static/block/percent-list/0.0.1/index.html +316 -0
- package/web/static/block/pie/0.0.1/index.html +281 -0
- package/web/static/block/pie-bubble/0.0.1/index.html +358 -0
- package/web/static/block/radar/0.0.1/index.html +149 -0
- package/web/static/block/scatter/0.0.1/index.html +251 -0
- package/web/static/block/sheet/0.0.1/index.html +103 -0
- package/web/static/block/table/0.0.1/index.html +73 -0
- package/web/static/block/taiwantown/0.0.1/index.html +210 -0
- package/web/static/block/taiwanvillage/0.0.1/index.html +220 -0
- package/web/static/block/treemap/0.0.1/index.html +360 -0
- package/web/static/block/voronoi-treemap/0.0.1/index.html +350 -0
- package/web/static/block/wordcloud/0.0.1/index.html +92 -0
- package/web/static/block/worldmap/0.0.1/index.html +207 -0
- 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 +153 -0
|
@@ -0,0 +1,153 @@
|
|
|
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/bootstrap.ldui/main/bootstrap.ldui.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="/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="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/csscope.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/rescope/main/rescope.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/block/main/block.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/konfig/main/konfig.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("/assets/block/cache.js")--><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>
|