@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,222 +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: 'axis-bubble',
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
- }).then(function(it){
23
- return it[0];
24
- });
25
- }
26
- };
27
- mod = function(arg$){
28
- var context, d3, forceBoundary, ldcolor, repeatString$;
29
- context = arg$.context;
30
- d3 = context.d3, forceBoundary = context.forceBoundary, ldcolor = context.ldcolor, repeatString$ = context.repeatString$;
31
- return {
32
- sample: function(){
33
- return {
34
- 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){
35
- return {
36
- val: Math.random() * 50 + 10,
37
- x: Math.random(),
38
- cat: Math.ceil(5 * Math.random())
39
- };
40
- }),
41
- binding: {
42
- color: {
43
- key: 'cat'
44
- },
45
- radius: {
46
- key: 'val'
47
- },
48
- xpos: {
49
- key: 'x'
50
- }
51
- }
52
- };
53
- },
54
- config: {},
55
- dimension: {
56
- color: {
57
- type: 'R',
58
- name: "顏色"
59
- },
60
- radius: {
61
- type: 'R',
62
- name: "半徑"
63
- },
64
- xpos: {
65
- type: 'R',
66
- name: "X座標"
67
- }
68
- },
69
- init: function(){
70
- var t, this$ = this;
71
- this.svg.addEventListener('click', function(){
72
- this$.type = !this$.type;
73
- this$.resize();
74
- this$.render();
75
- this$.sim.stop();
76
- return this$.sim.alpha(0.9);
77
- });
78
- this.svg.appendChild(t = document.createElementNS('http://www.w3.org/2000/svg', 'text'));
79
- this.text = d3.select(t);
80
- return this.text.attr('x', 20).attr('y', 20);
81
- },
82
- parse: function(){
83
- this.xextent = d3.extent(this.data.map(function(it){
84
- return it.xpos;
85
- }));
86
- this.rextent = d3.extent(this.data.map(function(it){
87
- return it.radius;
88
- }));
89
- return this.cextent = d3.extent(this.data.map(function(it){
90
- return it.color;
91
- }));
92
- },
93
- resize: function(){
94
- var rng, this$ = this;
95
- rng = d3.randomUniform.source(d3.randomLcg(root.seed))(0, 1);
96
- this.scaleX = d3.scaleLinear().domain(this.xextent).range([0, this.box.width]);
97
- if (this.type) {
98
- this.scaleY = d3.scaleLinear().domain(this.cextent).range([0, this.box.height]);
99
- } else {
100
- this.scaleY = function(){
101
- return this$.box.height / 2;
102
- };
103
- }
104
- this.data.map(function(v){
105
- 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;
106
- });
107
- this.area = this.box.width * this.box.height;
108
- return this.rate = 0.5;
109
- },
110
- render: function(){
111
- var rate, pal, intColor, x$, y$, this$ = this;
112
- rate = this.rate;
113
- this.scale = {
114
- color: d3.interpolateTurbo,
115
- r: d3.scaleLinear().domain(this.rextent).range([0, 1]),
116
- c: d3.scaleLinear().domain(this.cextent).range([0, 1])
117
- };
118
- pal = this.cfg.palette
119
- ? this.cfg.palette.colors.map(function(it){
120
- return ldcolor.web(it.value || it);
121
- })
122
- : ['#f00', '#0f0', '#00f', '#f90', '#9f0', '#0f9'];
123
- intColor = d3.interpolateDiscrete(pal);
124
- this.scale.color = function(it){
125
- return intColor(this$.scale.c(it));
126
- };
127
- x$ = d3.select(this.svg).selectAll('circle.bubble').data(this.data);
128
- x$.exit().remove();
129
- x$.enter().append('circle').attr('class', 'bubble').attr('r', function(d, i){
130
- return 0;
131
- }).attr('fill', function(d, i){
132
- return this$.scale.color(d.c);
133
- });
134
- d3.select(this.svg).selectAll('circle.bubble').attr('cx', function(d, i){
135
- return d.x;
136
- }).attr('cy', function(d, i){
137
- return d.y;
138
- }).attr('fill', function(d, i){
139
- return this$.scale.color(d.c);
140
- }).attr('r', function(d, i){
141
- var ref$;
142
- return ((ref$ = d.r) > 2 ? ref$ : 2) * this$.rate;
143
- });
144
- y$ = d3.select(this.svg).selectAll('g.label').data(this.data);
145
- y$.exit().remove();
146
- y$.enter().append('g').attr('class', 'label').each(function(d, i){
147
- var this$ = this;
148
- return [0].map(function(){
149
- return d3.select(this$).append('text');
150
- }).map(function(it){
151
- return it.attr('dy', '-.28em').attr('text-anchor', 'middle').attr('font-size', '.7em').attr('font-family', 'Rubik').style('pointer-event', 'none');
152
- });
153
- });
154
- return d3.select(this.svg).selectAll('g.label').attr('transform', function(d, i){
155
- return "translate(" + d.x + "," + d.y + ")";
156
- }).each(function(d, i){
157
- 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){
158
- return '.38em';
159
- }).text(function(e, i){
160
- if (i === 0) {
161
- if (d.val > 1000000) {
162
- return (d.val / 1000000).toFixed(2) + "M";
163
- } else if (d.val > 1000) {
164
- return (d.val / 1000).toFixed(2) + "K";
165
- } else {
166
- return d.val.toFixed(2);
167
- }
168
- } else {
169
- return d._idx;
170
- }
171
- });
172
- });
173
- },
174
- tick: function(){
175
- var kickoff, fc, alpha, this$ = this;
176
- if (!this.sim) {
177
- kickoff = true;
178
- this.fc = fc = d3.forceCollide();
179
- 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){
180
- return it.r;
181
- }, function(it){
182
- return it.r;
183
- }, function(it){
184
- return this$.box.width - it.r;
185
- }, function(it){
186
- return this$.box.height - it.r;
187
- })).force('collide', fc);
188
- this.sim.stop();
189
- this.sim.alpha(0.9);
190
- this.sim.nodes(this.data);
191
- }
192
- this.fc.strength(1.0);
193
- this.fc.radius(function(it){
194
- return this$.rate * it.r + 2;
195
- });
196
- this.fg.x(this.box.width / 2);
197
- this.fg.y(this.box.height / 2);
198
- this.fx.strength(0.15);
199
- this.fy.strength(0.01);
200
- this.sim.tick(kickoff ? 20 : 1);
201
- alpha = this.sim.alpha();
202
- this.text.text(alpha);
203
- if (alpha < 0.001) {
204
- this.stop();
205
- }
206
- this.data.map(function(it){
207
- return it.y = it.y + (it.ty - it.y) * alpha * 0.1;
208
- });
209
- d3.select(this.svg).selectAll('circle.bubble').attr('cx', function(d, i){
210
- return d.x;
211
- }).attr('cy', function(d, i){
212
- return d.y;
213
- });
214
- d3.select(this.svg).selectAll('g.label').attr('transform', function(d, i){
215
- return "translate(" + d.x + "," + d.y + ")";
216
- });
217
- return this.render();
218
- }
219
- };
220
- };
221
- return blockFactory;
222
- });</script></div>