@plotdb/chart 0.0.2 → 1.0.3

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