@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,92 +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: 'wordcloud',
8
- version: '0.0.1',
9
- extend: {
10
- name: "base",
11
- version: "0.0.1"
12
- },
13
- dependencies: [{
14
- url: "https://unpkg.com/d3-cloud@1.2.5/build/d3.layout.cloud.js"
15
- }]
16
- },
17
- init: function(arg$){
18
- var root, context, pubsub;
19
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
20
- return pubsub.fire('init', {
21
- mod: mod({
22
- context: context
23
- })
24
- }).then(function(it){
25
- return it[0];
26
- });
27
- }
28
- };
29
- mod = function(arg$){
30
- var context, root, d3, forceBoundary, ldColor, repeatString$;
31
- context = arg$.context, root = arg$.root;
32
- d3 = context.d3, forceBoundary = context.forceBoundary, ldColor = context.ldColor, repeatString$ = context.repeatString$;
33
- return {
34
- sample: function(){
35
- return {
36
- raw: [],
37
- binding: {}
38
- };
39
- },
40
- config: {},
41
- dimension: {},
42
- init: function(){
43
- var this$ = this;
44
- this.dd = ['cover', 'scandal', 'seem', 'consumption', 'garbage', 'hunter', 'pepper', 'west', 'guilt', 'conspiracy', 'pupil', 'boat', 'muscle', 'nightmare', 'gene', 'royalty', 'salon', 'difficult', 'management', 'brainstorm', 'aid', 'moving', 'plaster', 'cake', 'issue', 'realism', 'subject', 'speed', 'railcar', 'break', 'grass', 'collapse', 'is', 'leave', 'retiree', 'looting', 'transaction', 'copyright', 'serve', 'guard', 'colony', 'spell', 'ask', 'ranch', 'cell', 'sensation', 'name', 'default', 'reflection'].map(function(d, i){
45
- return {
46
- text: d,
47
- value: 1.5 * i + 10
48
- };
49
- });
50
- this.cloud = d3.layout.cloud();
51
- return this.cloud.font('arial').padding(2).fontSize(function(it){
52
- return it.value;
53
- }).on('end', function(){
54
- return this$.render();
55
- });
56
- },
57
- parse: function(){},
58
- resize: function(){
59
- return this.cloud.size([this.box.width, this.box.height].map(function(it){
60
- return Math.round(it);
61
- })).words(this.dd).start();
62
- },
63
- render: function(){
64
- var color, vext, vscale, x$, this$ = this;
65
- color = d3.interpolateTurbo;
66
- if (this.cfg != null && this.cfg.palette) {
67
- color = d3.interpolateDiscrete(this.cfg.palette.colors.map(function(it){
68
- return ldColor.web(it.value || it);
69
- }));
70
- }
71
- vext = d3.extent(this.dd.map(function(it){
72
- return it.value;
73
- }));
74
- vscale = d3.scaleLinear().domain(vext).range([0, 1]);
75
- x$ = d3.select(this.svg).selectAll('text').data(this.dd);
76
- x$.exit().remove();
77
- x$.enter().append('text');
78
- return d3.select(this.svg).selectAll('text').attr('transform', function(it){
79
- return "translate(" + (it.x + this$.box.width / 2) + " " + (it.y + this$.box.height / 2) + ") rotate(" + it.rotate + ")";
80
- }).attr('text-anchor', 'middle').attr('font-size', function(it){
81
- return it.size;
82
- }).attr('font-family', 'arial').attr('fill', function(it){
83
- return color(vscale(it.value));
84
- }).text(function(it){
85
- return it.text;
86
- });
87
- },
88
- tick: function(){}
89
- };
90
- };
91
- return blockFactory;
92
- });</script></div>
@@ -1,207 +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="legend">123</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: 1fr fit-content(5em);
4
- }
5
- </style><script type="@plotdb/block">(function(it){
6
- return it();
7
- })(function(){
8
- var blockFactory, mod;
9
- blockFactory = {
10
- pkg: {
11
- name: 'worldmap',
12
- version: '0.0.1',
13
- extend: {
14
- name: "base",
15
- version: "0.0.1"
16
- },
17
- dependencies: [
18
- {
19
- url: "https://d3js.org/d3-geo.v2.min.js",
20
- async: false
21
- }, {
22
- url: "https://d3js.org/topojson.v2.min.js",
23
- async: false
24
- }, {
25
- url: "/assets/lib/@plotdb/pdmap-world/main/index.js"
26
- }
27
- ]
28
- },
29
- init: function(arg$){
30
- var root, context, pubsub;
31
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
32
- return pubsub.fire('init', {
33
- mod: mod({
34
- context: context
35
- })
36
- });
37
- }
38
- };
39
- mod = function(arg$){
40
- var context, chart, d3, ldcolor, pdmapWorld, topojson;
41
- context = arg$.context;
42
- chart = context.chart, d3 = context.d3, ldcolor = context.ldcolor, pdmapWorld = context.pdmapWorld, topojson = context.topojson;
43
- return {
44
- sample: function(){
45
- return {
46
- raw: pdmapWorld.meta.alpha2.map(function(it){
47
- return {
48
- country: it,
49
- val: Math.random()
50
- };
51
- }),
52
- binding: {
53
- color: {
54
- key: 'val'
55
- },
56
- name: {
57
- key: 'country'
58
- }
59
- }
60
- };
61
- },
62
- config: {},
63
- dimension: {
64
- name: {
65
- type: 'N',
66
- name: "國家"
67
- },
68
- color: {
69
- type: 'R',
70
- name: "顏色"
71
- }
72
- },
73
- init: function(){
74
- var scale, this$ = this;
75
- this.g = this.layout.getGroup('view');
76
- this.obj = new pdmapWorld({
77
- root: this.g
78
- });
79
- this.scale = scale = {
80
- color: d3.interpolateTurbo
81
- };
82
- this.legend = new chart.utils.legend({
83
- root: this.root,
84
- name: 'legend',
85
- layout: this.layout,
86
- shape: function(d){
87
- return d3.select(this).attr('fill', scale.color(d.key));
88
- }
89
- });
90
- this.tip = new chart.utils.tip({
91
- root: this.root,
92
- accessor: function(arg$){
93
- var evt, data, ret, k, v, name;
94
- evt = arg$.evt;
95
- if (!(evt.target && (data = d3.select(evt.target).datum()))) {
96
- return null;
97
- }
98
- ret = (function(){
99
- var ref$, results$ = [];
100
- for (k in ref$ = pdmapWorld.meta.zhalpha2) {
101
- v = ref$[k];
102
- results$.push([k, v]);
103
- }
104
- return results$;
105
- }()).filter(function(it){
106
- return it[1].toLowerCase() === data.properties.alpha2;
107
- })[0];
108
- name = ret
109
- ? ret[0]
110
- : data.properties.shortname || data.data.name;
111
- v = isNaN(data.data.color)
112
- ? '-'
113
- : data.data.color.toFixed(2) + "" + (this$.binding.color.unit || '');
114
- return {
115
- name: name,
116
- value: v
117
- };
118
- },
119
- range: function(){
120
- return this$.layout.getNode('view').getBoundingClientRect();
121
- }
122
- });
123
- return this.obj.init().then(function(){
124
- return this$.obj.fit();
125
- });
126
- },
127
- destroy: function(){
128
- return this.tip.destroy();
129
- },
130
- parse: function(){
131
- var geoData, this$ = this;
132
- geoData = d3.select(this.g).selectAll('path').data();
133
- geoData.map(function(d){
134
- d.data = null;
135
- d.properties.value = 0;
136
- return d.properties.data = {};
137
- });
138
- this.data.map(function(it){
139
- return {
140
- c: this$.obj.findCountry(it.name),
141
- v: it
142
- };
143
- }).filter(function(it){
144
- return it.c;
145
- }).map(function(it){
146
- var ref$;
147
- return ref$ = it.c, ref$.value = it.v.color, ref$.data = it.v, ref$;
148
- });
149
- geoData.map(function(d){
150
- return d.data = d.properties.data || {};
151
- });
152
- return this.extent = {
153
- c: d3.extent(geoData, function(it){
154
- return it.properties.value;
155
- })
156
- };
157
- },
158
- resize: function(){
159
- var ref$, pal, len, this$ = this;
160
- this.tip.toggle(((ref$ = this.cfg).tip || (ref$.tip = {})).enabled != null ? this.cfg.tip.enabled : true);
161
- this.obj.fit(this.layout.getBox('view'));
162
- pal = this.cfg.palette
163
- ? this.cfg.palette.colors
164
- : ['#f00', '#999', '#00f'];
165
- len = pal.length;
166
- this.ticks = d3.quantize(function(it){
167
- return (1 - it) * (this$.extent.c[1] - this$.extent.c[0]) + this$.extent.c[0];
168
- }, len).map(function(it){
169
- var that;
170
- return {
171
- key: it,
172
- text: d3.format(this$.cfg.legendFormat || '.2f')(it) + ((that = this$.binding.color.unit) ? that : '')
173
- };
174
- });
175
- this.ticks.sort(function(a, b){
176
- return a.key - b.key;
177
- });
178
- if (this.cfg.palette) {
179
- this.scale.color = d3.scaleLinear().domain(this.ticks.map(function(it){
180
- return it.key;
181
- })).range(pal.map(function(it){
182
- return ldcolor.web(it.value || it);
183
- }));
184
- }
185
- return this.legend.data(this.ticks);
186
- },
187
- render: function(){
188
- var this$ = this;
189
- this.legend.render();
190
- return d3.select(this.g).selectAll('path').transition().duration(350).attr('fill', function(d, i){
191
- return this$.scale.color(d.properties.value);
192
- }).attr('fill-opacity', function(d, i){
193
- if (this$.cfg.dimEmpty) {
194
- if (d.properties.value) {
195
- return 1;
196
- } else {
197
- return 0.2;
198
- }
199
- } else {
200
- return 1;
201
- }
202
- });
203
- }
204
- };
205
- };
206
- return blockFactory;
207
- });</script></div>
File without changes
File without changes
File without changes
@@ -1,153 +0,0 @@
1
- <!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="/assets/lib/bootstrap/main/css/bootstrap.min.css"><link rel="stylesheet" type="text/css" href="/assets/lib/@loadingio/bootstrap.ext/main/index.min.css"><link rel="stylesheet" type="text/css" href="/assets/lib/@loadingio/loading.css/main/loading.min.css"><link rel="stylesheet" type="text/css" href="/css/index.css"><link rel="stylesheet" type="text/css" href="/assets/lib/ldpalettepicker/main/index.min.css"><style type="text/css">html,
2
- body {
3
- width: 100%;
4
- height: 100%;
5
- color: #345;
6
- }
7
- </style></head><body><div class="w-100 h-100" ld-scope="viewer"><div class="w-100 h-100 p-4 d-flex flex-column"><div><h5>Chart Testing Suite</h5><div class="d-flex flex-grow-1 mb-4"><select class="form-control" ld="choice"><option value="" disabled selected>選擇圖表 ...</option><option value="bar-race">bar-race</option><option value="bar-list">bar-list</option><option value="sheet">sheet</option><option value="percent-list">percent-list</option><option value="table">table</option><option value="scatter">scatter</option><option value="gauge">gauge</option><option value="number">number</option><option value="curve-bar">curve-bar</option><option value="dumbbell">dumbbell</option><option value="pie">pie</option><option value="axis">axis</option><option value="wordcloud">wordcloud</option><option value="axis-bubble">axis-bubble</option><option value="bubble">bubble</option><option value="treemap">treemap</option><option value="worldmap">worldmap</option><option value="taiwantown">taiwantown</option><option value="taiwanvillage">taiwanvillage</option><option value="pie-bubble">pie-bubble</option><option value="bar">bar</option><option value="voronoi-treemap">voronoi-treemap</option><option value="radar">radar</option><option value="line">line</option></select><div class="ml-2 btn btn-outline-secondary" ld="palette">Palette</div><div class="ml-2 btn btn-outline-secondary" ld="filter">Filter</div></div></div><div class="flex-grow-1 d-flex overflow-hidden"><div class="w-100 h-100 bg-light border shadow-sm rounded"><div class="w-100 h-100 rounded" id="root"></div></div><div class="border ml-4 bg-light border shadow-sm rounded p-4" style="width:320px;font-size:14px;overflow-y:scroll" ld="konfig"><div class="d-none"><div ld-scope="" ld="template"><div class="font-weight-bold text-lg mb-2" ld="name"></div><div class="mb-3" ld-each="ctrl"></div><div class="mb-4" ld-each="tab"></div></div></div></div></div></div></div><script type="text/javascript" src="/assets/lib/bootstrap.native/main/bootstrap-native-v4.min.js"></script><script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script><script type="text/javascript" src="/assets/lib/@loadingio/ldquery/main/ldq.min.js"></script><script type="text/javascript" src="/assets/lib/ldview/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/proxise/main/proxise.js"></script><script type="text/javascript" src="/assets/lib/@loadingio/debounce.js/main/debounce.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/csscope/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/rescope/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/block/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/konfig/main/index.min.js"></script><script type="text/javascript" src="/assets/lib/@plotdb/konfig/main/konfig.widget.bootstrap.js"></script><script type="text/javascript" src="/assets/lib/ldpalettepicker/main/ldpp.min.js"></script><script type="text/javascript" src="/assets/lib/ldpalettepicker/main/all.palettes.js"></script><script>(function(it){
8
- return it.apply({});
9
- })(function(){
10
- var lc, blockPrepare, manager;
11
- lc = this;
12
- blockPrepare = function(name, root, data){
13
- if (!data) {
14
- data = {
15
- config: {
16
- palette: {
17
- "colors": ['#b32317', '#f58025', '#3a6e8f', '#87b2d8', '#8d8b00', '#c1d72f']
18
- }
19
- },
20
- delayRender: false
21
- };
22
- }
23
- if (lc.chart) {
24
- lc.chart.destroy();
25
- }
26
- root.innerHTML = "";
27
- console.log("[" + name + "] loading");
28
- return manager.get({
29
- name: name,
30
- version: "0.0.1"
31
- }).then(function(it){
32
- return it.create({
33
- data: data
34
- });
35
- }).then(function(bi){
36
- console.log("[" + name + "] created");
37
- return bi.attach({
38
- root: root
39
- }).then(function(){
40
- return bi['interface']();
41
- });
42
- }).then(function(chart){
43
- console.log("[" + name + "] attached");
44
- window.chart = chart;
45
- lc.chart = chart;
46
- chart.config({
47
- legend: {
48
- selectable: true
49
- }
50
- });
51
- chart.resize();
52
- chart.render();
53
- chart.on(['select', 'hover'], function(it){
54
- return console.log("[select/hover] ", it);
55
- });
56
- console.log(chart.mod.config);
57
- return lc.kfg.meta({
58
- meta: chart.mod.config
59
- });
60
- });
61
- };
62
- manager = new block.manager({
63
- registry: function(arg$){
64
- var name, version, path, type;
65
- name = arg$.name, version = arg$.version, path = arg$.path, type = arg$.type;
66
- if (type === 'block') {
67
- return "/block/" + name + "/" + version + "/" + (path || 'index.html');
68
- }
69
- if (!/^d3/.exec(name)) {
70
- return "/assets/lib/" + name + "/" + version + "/" + path;
71
- }
72
- return "/assets/custom-lib/d3/" + name + ".v" + version + ".min.js";
73
- }
74
- });
75
- return manager.init().then(function(){
76
- return manager.get({
77
- name: "base",
78
- version: "0.0.1"
79
- });
80
- }).then(function(){
81
- var pals;
82
- pals = ldpp.get('all');
83
- return lc.view = new ldview({
84
- root: '[ld-scope=viewer]',
85
- action: {
86
- change: {
87
- choice: function(arg$){
88
- var node;
89
- node = arg$.node;
90
- return blockPrepare(node.value, root);
91
- }
92
- },
93
- click: {
94
- palette: function(){
95
- lc.chart.config({
96
- palette: {
97
- colors: pals[Math.floor(pals.length * Math.random())]
98
- }
99
- });
100
- lc.chart.resize();
101
- return lc.chart.render();
102
- },
103
- filter: function(){
104
- return lc.chart.filter({
105
- name: [2, 5]
106
- });
107
- }
108
- }
109
- }
110
- });
111
- }).then(function(){
112
- var query;
113
- query = Object.fromEntries((window.location.search || "").substring(1).split('&').map(function(it){
114
- return it.split('=');
115
- }));
116
- if (!query.chart) {
117
- query.chart = lc.view.get('choice').value;
118
- }
119
- if (query.chart) {
120
- blockPrepare(query.chart, root);
121
- return lc.view.get('choice').value = query.chart;
122
- }
123
- }).then(function(){
124
- lc.kfg = new konfig({
125
- root: lc.view.get('konfig'),
126
- manager: manager,
127
- view: 'recurse',
128
- useBundle: true,
129
- debounce: false,
130
- autotab: true,
131
- typemap: function(name){
132
- return {
133
- name: "@plotdb/konfig.widget.bootstrap",
134
- version: "master",
135
- path: name
136
- };
137
- }
138
- });
139
- lc.kfg.init().then(function(it){
140
- return console.log(">", it);
141
- });
142
- return lc.kfg.on('change', function(cfg){
143
- lc.cfg = cfg;
144
- if (!lc.chart) {
145
- return;
146
- }
147
- lc.chart.config(lc.cfg);
148
- lc.chart.bind();
149
- lc.chart.resize();
150
- return lc.chart.render();
151
- });
152
- });
153
- });</script></body></html>