@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.
Files changed (194) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +3 -3
  3. package/{dist/data → data}/index.js +0 -0
  4. package/{dist/chart.css → index.css} +0 -0
  5. package/{dist/chart.js → index.js} +3 -1
  6. package/{dist/chart.min.css → index.min.css} +0 -0
  7. package/index.min.js +1 -0
  8. package/package.json +1 -89
  9. package/{dist/utils → utils}/axis.js +6 -0
  10. package/utils/axis.min.js +1 -0
  11. package/{dist/utils → utils}/config.js +0 -0
  12. package/utils/config.min.js +1 -0
  13. package/{dist/utils → utils}/data.js +0 -0
  14. package/utils/data.min.js +1 -0
  15. package/{dist/utils → utils}/format.js +0 -0
  16. package/utils/format.min.js +1 -0
  17. package/{dist/utils → utils}/legend.css +0 -0
  18. package/{dist/utils → utils}/legend.js +0 -0
  19. package/{dist/utils → utils}/legend.min.css +0 -0
  20. package/utils/legend.min.js +1 -0
  21. package/{dist/utils → utils}/tint.js +0 -0
  22. package/utils/tint.min.js +1 -0
  23. package/{dist/utils → utils}/tip.js +0 -0
  24. package/utils/tip.min.js +1 -0
  25. package/build +0 -39
  26. package/dist/chart.min.js +0 -1
  27. package/dist/utils/axis.min.js +0 -1
  28. package/dist/utils/config.min.js +0 -1
  29. package/dist/utils/data.min.js +0 -1
  30. package/dist/utils/format.min.js +0 -1
  31. package/dist/utils/legend.min.js +0 -1
  32. package/dist/utils/tint.min.js +0 -1
  33. package/dist/utils/tip.min.js +0 -1
  34. package/doc/charts.md +0 -58
  35. package/doc/config.md +0 -44
  36. package/doc/draft/chart.md +0 -146
  37. package/doc/draft/data.md +0 -8
  38. package/doc/draft/definition.md +0 -0
  39. package/doc/draft/events.md +0 -0
  40. package/doc/draft/filter.md +0 -0
  41. package/doc/draft/lifecycle.md +0 -89
  42. package/doc/spec.md +0 -89
  43. package/doc/todo.md +0 -27
  44. package/doc/utils/tip.md +0 -84
  45. package/src/chart.ls +0 -323
  46. package/src/chart.styl +0 -6
  47. package/src/data/en-US/category +0 -20
  48. package/src/data/en-US/fruit +0 -39
  49. package/src/data/en-US/movie +0 -125
  50. package/src/data/en-US/name +0 -58
  51. package/src/data/index.ls +0 -34
  52. package/src/data/zh-TW/category +0 -20
  53. package/src/data/zh-TW/fruits +0 -38
  54. package/src/data/zh-TW/movie +0 -125
  55. package/src/data/zh-TW/names +0 -105
  56. package/src/utils/axis.ls +0 -229
  57. package/src/utils/config.ls +0 -11
  58. package/src/utils/data.ls +0 -104
  59. package/src/utils/format.ls +0 -30
  60. package/src/utils/legend.ls +0 -134
  61. package/src/utils/legend.styl +0 -37
  62. package/src/utils/tint.ls +0 -66
  63. package/src/utils/tip.ls +0 -97
  64. package/web/src/pug/base.pug +0 -20
  65. package/web/src/pug/block/axis/0.0.1/index.ls +0 -38
  66. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  67. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -141
  68. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  69. package/web/src/pug/block/bar/0.0.1/index.ls +0 -274
  70. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  71. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -85
  72. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  73. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -83
  74. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  75. package/web/src/pug/block/base/0.0.1/index.ls +0 -67
  76. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  77. package/web/src/pug/block/blank/0.0.1/index.ls +0 -25
  78. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  79. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -220
  80. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -28
  81. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -89
  82. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  83. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  84. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -90
  85. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  86. package/web/src/pug/block/empty/0.0.1/index.ls +0 -27
  87. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  88. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -100
  89. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  90. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  91. package/web/src/pug/block/line/0.0.1/index.ls +0 -302
  92. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  93. package/web/src/pug/block/number/0.0.1/index.ls +0 -69
  94. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  95. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -167
  96. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  97. package/web/src/pug/block/pie/0.0.1/index.ls +0 -125
  98. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  99. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  100. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -185
  101. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  102. package/web/src/pug/block/radar/0.0.1/index.ls +0 -113
  103. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  104. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  105. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -128
  106. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  107. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -38
  108. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  109. package/web/src/pug/block/table/0.0.1/index.ls +0 -40
  110. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  111. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -74
  112. package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
  113. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -48
  114. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  115. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -53
  116. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  117. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -172
  118. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  119. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -174
  120. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  121. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  122. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -61
  123. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  124. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -81
  125. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  126. package/web/src/pug/index.ls +0 -72
  127. package/web/src/pug/index.pug +0 -51
  128. package/web/src/styl/index.styl +0 -0
  129. package/web/static/assets/block/cache.js +0 -4
  130. package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
  131. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  132. package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
  133. package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
  134. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  135. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  136. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  137. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  138. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  139. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  140. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  141. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  142. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  143. package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
  144. package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
  145. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  146. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  147. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  148. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  149. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  150. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  151. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  152. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  153. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  154. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  155. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  156. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  157. package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
  158. package/web/static/assets/data/countrycode.json +0 -1
  159. package/web/static/assets/data/world-110m.json +0 -1
  160. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  161. package/web/static/assets/img/fluid.svg +0 -16
  162. package/web/static/block/axis/0.0.1/index.html +0 -79
  163. package/web/static/block/axis-bubble/0.0.1/index.html +0 -222
  164. package/web/static/block/bar/0.0.1/index.html +0 -581
  165. package/web/static/block/bar-list/0.0.1/index.html +0 -231
  166. package/web/static/block/bar-race/0.0.1/index.html +0 -184
  167. package/web/static/block/base/0.0.1/index.html +0 -197
  168. package/web/static/block/blank/0.0.1/index.html +0 -42
  169. package/web/static/block/bubble/0.0.1/index.html +0 -402
  170. package/web/static/block/bubble/0.0.1/test.html +0 -0
  171. package/web/static/block/curve-bar/0.0.1/index.html +0 -148
  172. package/web/static/block/dumbbell/0.0.1/index.html +0 -178
  173. package/web/static/block/empty/0.0.1/index.html +0 -76
  174. package/web/static/block/gauge/0.0.1/index.html +0 -150
  175. package/web/static/block/line/0.0.1/index.html +0 -571
  176. package/web/static/block/number/0.0.1/index.html +0 -152
  177. package/web/static/block/percent-list/0.0.1/index.html +0 -316
  178. package/web/static/block/pie/0.0.1/index.html +0 -281
  179. package/web/static/block/pie-bubble/0.0.1/index.html +0 -358
  180. package/web/static/block/radar/0.0.1/index.html +0 -149
  181. package/web/static/block/scatter/0.0.1/index.html +0 -251
  182. package/web/static/block/sheet/0.0.1/index.html +0 -103
  183. package/web/static/block/table/0.0.1/index.html +0 -73
  184. package/web/static/block/taiwancounty/0.0.1/index.html +0 -202
  185. package/web/static/block/taiwantown/0.0.1/index.html +0 -210
  186. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -220
  187. package/web/static/block/treemap/0.0.1/index.html +0 -360
  188. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -350
  189. package/web/static/block/wordcloud/0.0.1/index.html +0 -92
  190. package/web/static/block/worldmap/0.0.1/index.html +0 -207
  191. package/web/static/css/index.css +0 -0
  192. package/web/static/css/index.min.css +0 -0
  193. package/web/static/favicon.ico +0 -0
  194. package/web/static/index.html +0 -153
@@ -1,231 +0,0 @@
1
- <div><div plug="layout"><div class="pdl-layout"><div data-type="layout"></div><div data-type="render"><div class="d-flex"><div class="flex-grow-1"><div class="data" ld-each="data"><div ld="name"></div><div ld="bar"></div></div></div><div style="position:sticky;margin-left:1em;margin-right:.25em;cursor:pointer;white-space:nowrap;top:0;right:0;align-self:flex-start;height:auto;"><div ld="select" data-name="all">全選</div><div ld="select" data-name="none">全不選</div></div></div></div></div></div><style type="text/css">.data {
2
- padding-bottom: 1em;
3
- }
4
- .pdl-layout {
5
- overflow-y: scroll;
6
- user-select: none;
7
- }
8
- .pdl-layout [data-type=render] {
9
- overflow-y: visible;
10
- height: auto;
11
- }
12
- .pdl-layout .data {
13
- cursor: pointer;
14
- }
15
- .pdl-layout div[ld=bar] {
16
- height: 0.5em;
17
- border-radius: 2px;
18
- }
19
- </style><script type="@plotdb/block">(function(it){
20
- return it();
21
- })(function(){
22
- var blockFactory, mod;
23
- blockFactory = {
24
- pkg: {
25
- name: 'bar-list',
26
- version: '0.0.1',
27
- extend: {
28
- name: "base",
29
- version: "0.0.1"
30
- },
31
- dependencies: [{
32
- url: "/assets/lib/ldview/main/index.min.js"
33
- }]
34
- },
35
- init: function(arg$){
36
- var root, context, t, pubsub;
37
- root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
38
- return pubsub.fire('init', {
39
- mod: mod({
40
- root: root,
41
- context: context,
42
- t: t
43
- }),
44
- prepareSvg: false,
45
- layout: false,
46
- dataAccessor: function(it){
47
- return it._data._raw;
48
- }
49
- });
50
- }
51
- };
52
- mod = function(arg$){
53
- var root, context, t, chart, d3, debounce;
54
- root = arg$.root, context = arg$.context, t = arg$.t;
55
- chart = context.chart, d3 = context.d3, debounce = context.debounce;
56
- return {
57
- sample: function(){
58
- return {
59
- raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function(it){
60
- return {
61
- name: it,
62
- value: (Math.random() * 100).toFixed(2)
63
- };
64
- }),
65
- binding: {
66
- size: {
67
- key: "value"
68
- },
69
- name: {
70
- key: "name"
71
- }
72
- }
73
- };
74
- },
75
- config: {},
76
- dimension: {
77
- size: {
78
- type: 'R',
79
- name: "size"
80
- },
81
- name: {
82
- type: 'NO',
83
- name: "name"
84
- }
85
- },
86
- init: function(){
87
- var tint, scale, getList, this$ = this;
88
- this.picked = {};
89
- this.tint = tint = new chart.utils.tint();
90
- this.scale = scale = {};
91
- this.extent = {};
92
- getList = function(){
93
- var k, v;
94
- return (function(){
95
- var ref$, results$ = [];
96
- for (k in ref$ = this.picked) {
97
- v = ref$[k];
98
- results$.push([k, v]);
99
- }
100
- return results$;
101
- }.call(this$)).filter(function(it){
102
- return !it[1];
103
- }).map(function(it){
104
- return it[0];
105
- });
106
- };
107
- return this.view = new ldview({
108
- root: root,
109
- initRender: false,
110
- action: {
111
- click: {
112
- select: function(arg$){
113
- var views, node, name;
114
- views = arg$.views, node = arg$.node;
115
- name = node.getAttribute('data-name');
116
- if (name === 'none') {
117
- this$.parsed.map(function(it){
118
- return this$.picked[it.name] = false;
119
- });
120
- } else {
121
- this$.picked = {};
122
- }
123
- this$.filter({
124
- name: {
125
- type: 'exclude',
126
- value: getList()
127
- }
128
- }, true);
129
- return views[0].render('data');
130
- }
131
- }
132
- },
133
- handler: {
134
- data: {
135
- list: function(){
136
- return this$.parsed;
137
- },
138
- key: function(it){
139
- return it._idx;
140
- },
141
- action: {
142
- click: function(arg$){
143
- var views, node, data;
144
- views = arg$.views, node = arg$.node, data = arg$.data;
145
- this$.picked[data.name] = this$.picked[data.name] != null ? !this$.picked[data.name] : false;
146
- views[0].render('data', data._idx);
147
- return this$.filter({
148
- name: {
149
- type: 'exclude',
150
- value: getList()
151
- }
152
- }, true);
153
- }
154
- },
155
- handler: function(arg$){
156
- var node, data, nn, nb, unit, ref$;
157
- node = arg$.node, data = arg$.data;
158
- nn = node.querySelector('[ld=name]');
159
- nb = node.querySelector('[ld=bar]');
160
- unit = ((ref$ = this$.binding).size || (ref$.size = {})).unit || '';
161
- nn.textContent = data.name + " / " + data.size + unit;
162
- ref$ = nb.style;
163
- ref$.width = this$.scale.x(data.size) + "%";
164
- ref$.background = this$.tint.get('size');
165
- return node.style.opacity = this$.picked[data.name] === false ? 0.3 : 1;
166
- }
167
- }
168
- }
169
- });
170
- },
171
- filter: function(filters, internal){
172
- internal == null && (internal = false);
173
- },
174
- parse: function(){
175
- var names, k, this$ = this;
176
- this.parsed = this.data.map(function(it){
177
- return it;
178
- });
179
- names = this.parsed.map(function(it){
180
- return it.name;
181
- });
182
- this.parsed = this.parsed.concat((function(){
183
- var results$ = [];
184
- for (k in this.picked) {
185
- results$.push(k);
186
- }
187
- return results$;
188
- }.call(this)).filter(function(it){
189
- return !in$(it, names);
190
- }).map(function(it){
191
- return {
192
- name: it,
193
- size: 0
194
- };
195
- }));
196
- this.parsed.sort(function(a, b){
197
- var pb, pa, that;
198
- pb = !(this$.picked[b.name] != null) || this$.picked[b.name];
199
- pa = !(this$.picked[a.name] != null) || this$.picked[a.name];
200
- if (pb && !pa) {
201
- return 1;
202
- } else if (!pb && pa) {
203
- return -1;
204
- }
205
- if (that = b.size - a.size) {
206
- return that;
207
- }
208
- return 0;
209
- });
210
- return this.parsed.map(function(d, i){
211
- return d._idx = i;
212
- });
213
- },
214
- resize: function(){
215
- this.extent = d3.extent(this.parsed.map(function(it){
216
- return it.size;
217
- }));
218
- return this.scale.x = d3.scaleLinear().domain([0, this.extent[1]]).range([0, 100]);
219
- },
220
- render: function(){
221
- return this.view.render();
222
- }
223
- };
224
- };
225
- return blockFactory;
226
- });
227
- function in$(x, xs){
228
- var i = -1, l = xs.length >>> 0;
229
- while (++i < l) if (x === xs[i]) return true;
230
- return false;
231
- }</script></div>
@@ -1,184 +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="axis">&nbsp;</div><div class="pdl-cell" data-name="legend">&nbsp;</div></div><div data-type="render"></div></div></div><style type="text/css">g[data-name=axis] {
2
- font-size: 11px;
3
- }
4
- .pdl-layout > div[data-type=layout] {
5
- display: grid;
6
- grid-template-columns: 1fr fit-content(10em);
7
- grid-template-rows: 1fr fit-content(1em);
8
- }
9
- .pdl-layout > div[data-type=layout] > .pdl-cell[data-name=legend] {
10
- grid-column: 2;
11
- grid-row: 1/span 2;
12
- padding-left: 1em;
13
- }
14
- </style><script type="@plotdb/block">(function(it){
15
- return it();
16
- })(function(){
17
- var blockFactory, mod;
18
- blockFactory = {
19
- pkg: {
20
- name: 'bar-race',
21
- version: '0.0.1',
22
- extend: {
23
- name: "base",
24
- version: "0.0.1"
25
- },
26
- dependencies: [],
27
- i18n: {
28
- "zh-TW": {
29
- "height": "高度"
30
- }
31
- }
32
- },
33
- init: function(arg$){
34
- var root, context, t, pubsub;
35
- root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
36
- return pubsub.fire('init', {
37
- mod: mod({
38
- context: context,
39
- t: t
40
- })
41
- });
42
- }
43
- };
44
- mod = function(arg$){
45
- var context, t, chart, d3, debounce;
46
- context = arg$.context, t = arg$.t;
47
- chart = context.chart, d3 = context.d3, debounce = context.debounce;
48
- return {
49
- sample: function(){
50
- return {
51
- 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){
52
- var ref$, n, o, ret;
53
- ref$ = [val % 10, Math.floor(val / 10)], n = ref$[0], o = ref$[1];
54
- ret = {
55
- name: n,
56
- value: Math.random(),
57
- order: o
58
- };
59
- return ret;
60
- }),
61
- binding: {
62
- order: {
63
- key: "order"
64
- },
65
- value: {
66
- key: "value"
67
- },
68
- name: {
69
- key: "name"
70
- }
71
- }
72
- };
73
- },
74
- config: {},
75
- dimension: {
76
- order: {
77
- type: 'O',
78
- name: "order",
79
- priority: 1
80
- },
81
- value: {
82
- type: 'R',
83
- name: "value",
84
- priority: 2
85
- },
86
- name: {
87
- type: 'N',
88
- name: "name"
89
- }
90
- },
91
- init: function(){
92
- var tint, scale;
93
- this.tint = tint = new chart.utils.tint();
94
- this.g = {
95
- view: d3.select(this.layout.getGroup('view')),
96
- axis: d3.select(this.layout.getGroup('axis'))
97
- };
98
- this.scale = scale = {};
99
- this.axisBottom = d3.axisBottom();
100
- return this.legend = new chart.utils.legend({
101
- layout: this.layout,
102
- name: 'legend',
103
- root: this.root,
104
- shape: function(d){
105
- return d3.select(this).attr('fill', tint.get(d.key));
106
- }
107
- });
108
- },
109
- parse: function(){
110
- this.data.map(function(d){
111
- return d.value = d.value.map(function(it){
112
- if (isNaN(it)) {
113
- return 0;
114
- } else {
115
- return +it;
116
- }
117
- });
118
- });
119
- return this.names = Array.from(new Set(this.data.map(function(it){
120
- return it.name;
121
- })));
122
- },
123
- resize: function(){
124
- var ref$, i, max, box, this$ = this;
125
- this.layout.getNode('legend').style.width = !(((ref$ = this.cfg).legend || (ref$.legend = {})).enabled != null) || this.cfg.legend.enabled ? '' : '0';
126
- this.layout.update(false);
127
- this.maxPerGroup = this.binding.height.map(function(d, i){
128
- return Math.max.apply(Math, this$.data.map(function(it){
129
- return it.height[i];
130
- }));
131
- });
132
- this.order = this.data.map(function(d, i){
133
- return {
134
- key: d._idx,
135
- idx: i,
136
- name: d.order
137
- };
138
- });
139
- this.order.sort(function(a, b){
140
- if (b.name > a.name) {
141
- return 1;
142
- } else if (b.name < a.name) {
143
- return -1;
144
- } else {
145
- return 0;
146
- }
147
- });
148
- this.tint.set(this.cfg.palette);
149
- this.legend.data((function(){
150
- var i$, to$, results$ = [];
151
- for (i$ = 0, to$ = this.names.length; i$ < to$; ++i$) {
152
- i = i$;
153
- results$.push({
154
- key: i,
155
- text: this.names[i]
156
- });
157
- }
158
- return results$;
159
- }.call(this)));
160
- this.layout.update(false);
161
- max = Math.max(this.data.map(function(it){
162
- return it.value;
163
- }));
164
- box = this.layout.getBox('view');
165
- return ref$ = this.scale, ref$.y = d3.scaleLinear().domain([0, max]).range([box.width, 0]), ref$.x = d3.scaleBand().domain(this.order.map(function(it){
166
- return it.name || it.key;
167
- })).range([0, box.height]), ref$;
168
- },
169
- render: function(){
170
- var binding, scale, range, delta, cfg, tint, data, x$;
171
- binding = this.binding, scale = this.scale, range = this.range, delta = this.delta, cfg = this.cfg, tint = this.tint, data = this.data;
172
- x$ = this.g.view.selectAll('g.bar').data(this.data);
173
- x$.exit().remove();
174
- x$.enter().append('g').attr('class', 'bar');
175
- this.g.view.selectAll('g.bar').attr('transform', function(d, i){
176
- return "translate(" + scale.x(d.name) + ",0)";
177
- });
178
- return this.g.axis.call(this.axisBottom).attr('font-size', '');
179
- },
180
- tick: function(){}
181
- };
182
- };
183
- return blockFactory;
184
- });</script></div>
@@ -1,197 +0,0 @@
1
- <div class="base" style="width:100%;height:100%"><plug name="layout"></plug><style type="text/css">*[plug=layout] {
2
- fill: currentColor;
3
- }
4
- </style><script type="@plotdb/block">({
5
- pkg: {
6
- name: 'base',
7
- version: '0.0.1',
8
- dependencies: [
9
- {
10
- name: "d3",
11
- version: "4",
12
- async: false
13
- }, {
14
- name: "d3-selection",
15
- version: "2",
16
- async: false
17
- }, {
18
- name: "d3-random",
19
- version: "2"
20
- }, {
21
- name: "d3-dispatch",
22
- version: "2",
23
- async: false
24
- }, {
25
- name: "d3-transition",
26
- version: "2"
27
- }, {
28
- name: "d3-format",
29
- version: "2"
30
- }, {
31
- name: "d3-array",
32
- version: "2",
33
- async: false
34
- }, {
35
- name: "d3-color",
36
- version: "2"
37
- }, {
38
- name: "d3-path",
39
- version: "2"
40
- }, {
41
- name: "d3-shape",
42
- version: "2"
43
- }, {
44
- name: "d3-interpolate",
45
- version: "2",
46
- async: false
47
- }, {
48
- name: "d3-scale-chromatic",
49
- version: "1"
50
- }, {
51
- name: "d3-ease",
52
- version: "2"
53
- }, {
54
- name: "d3-quadtree",
55
- version: "2"
56
- }, {
57
- name: "d3-timer",
58
- version: "2"
59
- }, {
60
- name: "d3-force",
61
- version: "2",
62
- async: false
63
- }, {
64
- name: "d3-hierarchy",
65
- version: "2"
66
- }, {
67
- name: "d3-force-boundary",
68
- version: "0.0.1"
69
- }, {
70
- name: "d3-drag",
71
- version: "2"
72
- }, {
73
- name: "d3-brush",
74
- version: "2"
75
- }, {
76
- name: "d3-axis",
77
- version: "2"
78
- }, {
79
- name: "@loadingio/debounce.js",
80
- version: "main",
81
- path: "debounce.min.js"
82
- }, {
83
- name: "wrap-svg-text",
84
- version: "main",
85
- path: "index.min.js",
86
- async: false
87
- }, {
88
- name: "@plotdb/layout",
89
- version: "main",
90
- path: "index.min.js",
91
- async: false
92
- }, {
93
- name: "@plotdb/layout",
94
- version: "main",
95
- path: "index.min.css",
96
- type: 'css'
97
- }, {
98
- name: "ldcolor",
99
- version: "main",
100
- path: "ldcolor.min.js",
101
- async: false
102
- }, {
103
- name: "@plotdb/chart",
104
- version: "main",
105
- path: "chart.js",
106
- async: false
107
- }, {
108
- name: "@plotdb/chart",
109
- version: "main",
110
- path: "chart.min.css",
111
- type: 'css'
112
- }, {
113
- name: "@plotdb/chart",
114
- version: "main",
115
- path: "utils/config.js"
116
- }, {
117
- name: "@plotdb/chart",
118
- version: "main",
119
- path: "utils/legend.js"
120
- }, {
121
- name: "@plotdb/chart",
122
- version: "main",
123
- path: "utils/legend.css",
124
- type: 'css'
125
- }, {
126
- name: "@plotdb/chart",
127
- version: "main",
128
- path: "utils/tint.js"
129
- }, {
130
- name: "@plotdb/chart",
131
- version: "main",
132
- path: "utils/format.js",
133
- async: false
134
- }, {
135
- name: "@plotdb/chart",
136
- version: "main",
137
- path: "utils/axis.js"
138
- }, {
139
- name: "@plotdb/chart",
140
- version: "main",
141
- path: "utils/tip.js"
142
- }
143
- ],
144
- i18n: {
145
- "zh-TW": {
146
- "x axis": "X軸",
147
- name: "名稱"
148
- }
149
- }
150
- },
151
- init: function(arg$){
152
- var root, context, pubsub, data, d3, chart, this$ = this;
153
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub, data = arg$.data;
154
- d3 = context.d3, chart = context.chart;
155
- pubsub.on('init', function(opt){
156
- var originalInit, c;
157
- opt == null && (opt = {});
158
- opt = import$({
159
- root: root,
160
- delayRender: true,
161
- autoSelect: true,
162
- dataAccessor: function(it){
163
- return d3.select(it).datum()._raw;
164
- }
165
- }, opt);
166
- originalInit = opt.mod.init;
167
- opt.mod.init = function(){
168
- var ret;
169
- this.random = d3.randomUniform.source(d3.randomLcg(123))(0, 1);
170
- ret = originalInit.apply(this);
171
- return Promise.resolve();
172
- };
173
- this$.chart = c = new chart(import$(opt, data));
174
- return c.init().then(function(){
175
- return c;
176
- });
177
- });
178
- return this;
179
- },
180
- 'interface': function(){
181
- return this.chart;
182
- },
183
- mod: function(root){
184
- return {
185
- config: {},
186
- dimension: {},
187
- init: function(){},
188
- resize: function(){},
189
- render: function(){}
190
- };
191
- }
192
- });
193
- function import$(obj, src){
194
- var own = {}.hasOwnProperty;
195
- for (var key in src) if (own.call(src, key)) obj[key] = src[key];
196
- return obj;
197
- }</script></div>
@@ -1,42 +0,0 @@
1
- <div style="width:100%;height:100%"><script type="@plotdb/block">(function(it){
2
- return it();
3
- })(function(){
4
- var blockFactory, mod;
5
- blockFactory = {
6
- pkg: {
7
- name: 'blank',
8
- version: '0.0.1',
9
- extend: {
10
- name: 'base',
11
- version: '0.0.1'
12
- },
13
- dependencies: []
14
- },
15
- init: function(arg$){
16
- var root, context, pubsub;
17
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
18
- return pubsub.fire('init', {
19
- mod: mod({
20
- context: context
21
- }),
22
- 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],
23
- binding: {}
24
- });
25
- }
26
- };
27
- mod = function(arg$){
28
- var context;
29
- context = arg$.context;
30
- context;
31
- return {
32
- config: {},
33
- dimension: {},
34
- init: function(){},
35
- parse: function(){},
36
- resize: function(){},
37
- render: function(){},
38
- tick: function(){}
39
- };
40
- };
41
- return blockFactory;
42
- });</script></div>