@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.
Files changed (164) hide show
  1. package/package.json +3 -1
  2. package/CHANGELOG.md +0 -29
  3. package/build +0 -45
  4. package/doc/charts.md +0 -58
  5. package/doc/config.md +0 -44
  6. package/doc/draft/chart.md +0 -146
  7. package/doc/draft/data.md +0 -8
  8. package/doc/draft/definition.md +0 -0
  9. package/doc/draft/events.md +0 -0
  10. package/doc/draft/filter.md +0 -0
  11. package/doc/draft/lifecycle.md +0 -89
  12. package/doc/spec.md +0 -89
  13. package/doc/todo.md +0 -27
  14. package/doc/utils/tip.md +0 -84
  15. package/src/data/en-US/category +0 -20
  16. package/src/data/en-US/fruit +0 -39
  17. package/src/data/en-US/movie +0 -125
  18. package/src/data/en-US/name +0 -58
  19. package/src/data/index.ls +0 -34
  20. package/src/data/zh-TW/category +0 -20
  21. package/src/data/zh-TW/fruits +0 -38
  22. package/src/data/zh-TW/movie +0 -125
  23. package/src/data/zh-TW/names +0 -105
  24. package/src/index.ls +0 -323
  25. package/src/index.styl +0 -6
  26. package/src/utils/axis.ls +0 -229
  27. package/src/utils/config.ls +0 -11
  28. package/src/utils/data.ls +0 -104
  29. package/src/utils/format.ls +0 -30
  30. package/src/utils/legend.ls +0 -134
  31. package/src/utils/legend.styl +0 -37
  32. package/src/utils/tint.ls +0 -66
  33. package/src/utils/tip.ls +0 -97
  34. package/web/src/pug/base.pug +0 -21
  35. package/web/src/pug/block/axis/0.0.1/index.ls +0 -32
  36. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  37. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -137
  38. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  39. package/web/src/pug/block/bar/0.0.1/index.ls +0 -270
  40. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  41. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -81
  42. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  43. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -79
  44. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  45. package/web/src/pug/block/base/0.0.1/index.ls +0 -66
  46. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  47. package/web/src/pug/block/blank/0.0.1/index.ls +0 -21
  48. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  49. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -218
  50. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -42
  51. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -85
  52. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  53. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  54. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -86
  55. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  56. package/web/src/pug/block/empty/0.0.1/index.ls +0 -28
  57. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  58. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -96
  59. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  60. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  61. package/web/src/pug/block/line/0.0.1/index.ls +0 -297
  62. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  63. package/web/src/pug/block/number/0.0.1/index.ls +0 -65
  64. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  65. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -161
  66. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  67. package/web/src/pug/block/pie/0.0.1/index.ls +0 -121
  68. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  69. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  70. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -181
  71. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  72. package/web/src/pug/block/radar/0.0.1/index.ls +0 -109
  73. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  74. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  75. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -124
  76. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  77. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -34
  78. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  79. package/web/src/pug/block/table/0.0.1/index.ls +0 -36
  80. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  81. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -70
  82. package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
  83. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -44
  84. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  85. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -49
  86. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  87. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -168
  88. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  89. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -170
  90. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  91. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  92. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -57
  93. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  94. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -77
  95. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  96. package/web/src/pug/index.ls +0 -72
  97. package/web/src/pug/index.pug +0 -51
  98. package/web/src/styl/index.styl +0 -6
  99. package/web/static/assets/block/cache.js +0 -4
  100. package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
  101. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  102. package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
  103. package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
  104. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  105. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  106. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  107. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  108. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  109. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  110. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  111. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  112. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  113. package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
  114. package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
  115. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  116. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  117. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  118. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  119. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  120. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  121. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  122. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  123. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  124. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  125. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  126. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  127. package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
  128. package/web/static/assets/data/countrycode.json +0 -1
  129. package/web/static/assets/data/world-110m.json +0 -1
  130. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  131. package/web/static/assets/img/fluid.svg +0 -16
  132. package/web/static/block/axis/0.0.1/index.html +0 -74
  133. package/web/static/block/axis-bubble/0.0.1/index.html +0 -217
  134. package/web/static/block/bar/0.0.1/index.html +0 -576
  135. package/web/static/block/bar-list/0.0.1/index.html +0 -226
  136. package/web/static/block/bar-race/0.0.1/index.html +0 -179
  137. package/web/static/block/base/0.0.1/index.html +0 -197
  138. package/web/static/block/blank/0.0.1/index.html +0 -37
  139. package/web/static/block/bubble/0.0.1/index.html +0 -422
  140. package/web/static/block/bubble/0.0.1/test.html +0 -0
  141. package/web/static/block/curve-bar/0.0.1/index.html +0 -143
  142. package/web/static/block/dumbbell/0.0.1/index.html +0 -173
  143. package/web/static/block/empty/0.0.1/index.html +0 -76
  144. package/web/static/block/gauge/0.0.1/index.html +0 -145
  145. package/web/static/block/line/0.0.1/index.html +0 -566
  146. package/web/static/block/number/0.0.1/index.html +0 -147
  147. package/web/static/block/percent-list/0.0.1/index.html +0 -311
  148. package/web/static/block/pie/0.0.1/index.html +0 -276
  149. package/web/static/block/pie-bubble/0.0.1/index.html +0 -353
  150. package/web/static/block/radar/0.0.1/index.html +0 -144
  151. package/web/static/block/scatter/0.0.1/index.html +0 -246
  152. package/web/static/block/sheet/0.0.1/index.html +0 -98
  153. package/web/static/block/table/0.0.1/index.html +0 -67
  154. package/web/static/block/taiwancounty/0.0.1/index.html +0 -197
  155. package/web/static/block/taiwantown/0.0.1/index.html +0 -205
  156. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -215
  157. package/web/static/block/treemap/0.0.1/index.html +0 -355
  158. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -345
  159. package/web/static/block/wordcloud/0.0.1/index.html +0 -87
  160. package/web/static/block/worldmap/0.0.1/index.html +0 -202
  161. package/web/static/css/index.css +0 -6
  162. package/web/static/css/index.min.css +0 -1
  163. package/web/static/favicon.ico +0 -0
  164. package/web/static/index.html +0 -153
@@ -1,217 +0,0 @@
1
- <div><script type="@plotdb/block">var mod;
2
- module.exports = {
3
- pkg: {
4
- name: 'axis-bubble',
5
- version: '0.0.1',
6
- extend: {
7
- name: "base",
8
- version: "0.0.1"
9
- },
10
- dependencies: []
11
- },
12
- init: function(arg$){
13
- var root, context, pubsub;
14
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
15
- return pubsub.fire('init', {
16
- mod: mod({
17
- context: context
18
- })
19
- }).then(function(it){
20
- return it[0];
21
- });
22
- }
23
- };
24
- mod = function(arg$){
25
- var context, d3, forceBoundary, ldcolor, repeatString$;
26
- context = arg$.context;
27
- d3 = context.d3, forceBoundary = context.forceBoundary, ldcolor = context.ldcolor, repeatString$ = context.repeatString$;
28
- return {
29
- sample: function(){
30
- return {
31
- 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, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200].map(function(val){
32
- return {
33
- val: Math.random() * 50 + 10,
34
- x: Math.random(),
35
- cat: Math.ceil(5 * Math.random())
36
- };
37
- }),
38
- binding: {
39
- color: {
40
- key: 'cat'
41
- },
42
- radius: {
43
- key: 'val'
44
- },
45
- xpos: {
46
- key: 'x'
47
- }
48
- }
49
- };
50
- },
51
- config: {},
52
- dimension: {
53
- color: {
54
- type: 'R',
55
- name: "顏色"
56
- },
57
- radius: {
58
- type: 'R',
59
- name: "半徑"
60
- },
61
- xpos: {
62
- type: 'R',
63
- name: "X座標"
64
- }
65
- },
66
- init: function(){
67
- var t, this$ = this;
68
- this.svg.addEventListener('click', function(){
69
- this$.type = !this$.type;
70
- this$.resize();
71
- this$.render();
72
- this$.sim.stop();
73
- return this$.sim.alpha(0.9);
74
- });
75
- this.svg.appendChild(t = document.createElementNS('http://www.w3.org/2000/svg', 'text'));
76
- this.text = d3.select(t);
77
- return this.text.attr('x', 20).attr('y', 20);
78
- },
79
- parse: function(){
80
- this.xextent = d3.extent(this.data.map(function(it){
81
- return it.xpos;
82
- }));
83
- this.rextent = d3.extent(this.data.map(function(it){
84
- return it.radius;
85
- }));
86
- return this.cextent = d3.extent(this.data.map(function(it){
87
- return it.color;
88
- }));
89
- },
90
- resize: function(){
91
- var rng, this$ = this;
92
- rng = d3.randomUniform.source(d3.randomLcg(root.seed))(0, 1);
93
- this.scaleX = d3.scaleLinear().domain(this.xextent).range([0, this.box.width]);
94
- if (this.type) {
95
- this.scaleY = d3.scaleLinear().domain(this.cextent).range([0, this.box.height]);
96
- } else {
97
- this.scaleY = function(){
98
- return this$.box.height / 2;
99
- };
100
- }
101
- this.data.map(function(v){
102
- return v.x = v.x || this$.scaleX(v.xpos), v.y = v.y || this$.box.height / 2, v.ty = this$.scaleY(v.color), v.val = v.radius, v.r = v.radius, v.c = v.color, v;
103
- });
104
- this.area = this.box.width * this.box.height;
105
- return this.rate = 0.5;
106
- },
107
- render: function(){
108
- var rate, pal, intColor, x$, y$, this$ = this;
109
- rate = this.rate;
110
- this.scale = {
111
- color: d3.interpolateTurbo,
112
- r: d3.scaleLinear().domain(this.rextent).range([0, 1]),
113
- c: d3.scaleLinear().domain(this.cextent).range([0, 1])
114
- };
115
- pal = this.cfg.palette
116
- ? this.cfg.palette.colors.map(function(it){
117
- return ldcolor.web(it.value || it);
118
- })
119
- : ['#f00', '#0f0', '#00f', '#f90', '#9f0', '#0f9'];
120
- intColor = d3.interpolateDiscrete(pal);
121
- this.scale.color = function(it){
122
- return intColor(this$.scale.c(it));
123
- };
124
- x$ = d3.select(this.svg).selectAll('circle.bubble').data(this.data);
125
- x$.exit().remove();
126
- x$.enter().append('circle').attr('class', 'bubble').attr('r', function(d, i){
127
- return 0;
128
- }).attr('fill', function(d, i){
129
- return this$.scale.color(d.c);
130
- });
131
- d3.select(this.svg).selectAll('circle.bubble').attr('cx', function(d, i){
132
- return d.x;
133
- }).attr('cy', function(d, i){
134
- return d.y;
135
- }).attr('fill', function(d, i){
136
- return this$.scale.color(d.c);
137
- }).attr('r', function(d, i){
138
- var ref$;
139
- return ((ref$ = d.r) > 2 ? ref$ : 2) * this$.rate;
140
- });
141
- y$ = d3.select(this.svg).selectAll('g.label').data(this.data);
142
- y$.exit().remove();
143
- y$.enter().append('g').attr('class', 'label').each(function(d, i){
144
- var this$ = this;
145
- return [0].map(function(){
146
- return d3.select(this$).append('text');
147
- }).map(function(it){
148
- return it.attr('dy', '-.28em').attr('text-anchor', 'middle').attr('font-size', '.7em').attr('font-family', 'Rubik').style('pointer-event', 'none');
149
- });
150
- });
151
- return d3.select(this.svg).selectAll('g.label').attr('transform', function(d, i){
152
- return "translate(" + d.x + "," + d.y + ")";
153
- }).each(function(d, i){
154
- return d3.select(this).selectAll('text').attr('opacity', d.r * 2 * rate < (d.val.toFixed(2) + "").length * 7 ? 0 : 1).attr('dy', function(e, i){
155
- return '.38em';
156
- }).text(function(e, i){
157
- if (i === 0) {
158
- if (d.val > 1000000) {
159
- return (d.val / 1000000).toFixed(2) + "M";
160
- } else if (d.val > 1000) {
161
- return (d.val / 1000).toFixed(2) + "K";
162
- } else {
163
- return d.val.toFixed(2);
164
- }
165
- } else {
166
- return d._idx;
167
- }
168
- });
169
- });
170
- },
171
- tick: function(){
172
- var kickoff, fc, alpha, this$ = this;
173
- if (!this.sim) {
174
- kickoff = true;
175
- this.fc = fc = d3.forceCollide();
176
- this.sim = d3.forceSimulation().force('center', this.fg = d3.forceCenter(this.box.width / 2, this.box.height / 2)).force('x', this.fx = d3.forceX(this.box.width / 2).strength(0.15)).force('y', this.fy = d3.forceY(this.box.height / 2).strength(0.1)).force('b', this.fb = forceBoundary(function(it){
177
- return it.r;
178
- }, function(it){
179
- return it.r;
180
- }, function(it){
181
- return this$.box.width - it.r;
182
- }, function(it){
183
- return this$.box.height - it.r;
184
- })).force('collide', fc);
185
- this.sim.stop();
186
- this.sim.alpha(0.9);
187
- this.sim.nodes(this.data);
188
- }
189
- this.fc.strength(1.0);
190
- this.fc.radius(function(it){
191
- return this$.rate * it.r + 2;
192
- });
193
- this.fg.x(this.box.width / 2);
194
- this.fg.y(this.box.height / 2);
195
- this.fx.strength(0.15);
196
- this.fy.strength(0.01);
197
- this.sim.tick(kickoff ? 20 : 1);
198
- alpha = this.sim.alpha();
199
- this.text.text(alpha);
200
- if (alpha < 0.001) {
201
- this.stop();
202
- }
203
- this.data.map(function(it){
204
- return it.y = it.y + (it.ty - it.y) * alpha * 0.1;
205
- });
206
- d3.select(this.svg).selectAll('circle.bubble').attr('cx', function(d, i){
207
- return d.x;
208
- }).attr('cy', function(d, i){
209
- return d.y;
210
- });
211
- d3.select(this.svg).selectAll('g.label').attr('transform', function(d, i){
212
- return "translate(" + d.x + "," + d.y + ")";
213
- });
214
- return this.render();
215
- }
216
- };
217
- };</script></div>