@plotdb/chart 0.0.3 → 1.0.1

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 (71) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/build +11 -5
  3. package/dist/index.css +8 -0
  4. package/dist/index.js +607 -0
  5. package/dist/index.min.css +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/package.json +12 -9
  8. package/src/{chart.ls → index.ls} +0 -0
  9. package/src/{chart.styl → index.styl} +0 -0
  10. package/web/src/pug/base.pug +1 -0
  11. package/web/src/pug/block/axis/0.0.1/index.ls +1 -7
  12. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +1 -5
  13. package/web/src/pug/block/bar/0.0.1/index.ls +1 -5
  14. package/web/src/pug/block/bar-list/0.0.1/index.ls +1 -5
  15. package/web/src/pug/block/bar-race/0.0.1/index.ls +1 -5
  16. package/web/src/pug/block/base/0.0.1/index.ls +63 -64
  17. package/web/src/pug/block/blank/0.0.1/index.ls +1 -5
  18. package/web/src/pug/block/bubble/0.0.1/index.ls +4 -6
  19. package/web/src/pug/block/bubble/0.0.1/index.pug +14 -0
  20. package/web/src/pug/block/curve-bar/0.0.1/index.ls +1 -5
  21. package/web/src/pug/block/dumbbell/0.0.1/index.ls +1 -5
  22. package/web/src/pug/block/empty/0.0.1/index.ls +25 -24
  23. package/web/src/pug/block/gauge/0.0.1/index.ls +1 -5
  24. package/web/src/pug/block/line/0.0.1/index.ls +1 -6
  25. package/web/src/pug/block/number/0.0.1/index.ls +1 -5
  26. package/web/src/pug/block/percent-list/0.0.1/index.ls +1 -7
  27. package/web/src/pug/block/pie/0.0.1/index.ls +1 -5
  28. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +1 -5
  29. package/web/src/pug/block/radar/0.0.1/index.ls +1 -5
  30. package/web/src/pug/block/scatter/0.0.1/index.ls +1 -5
  31. package/web/src/pug/block/sheet/0.0.1/index.ls +1 -5
  32. package/web/src/pug/block/table/0.0.1/index.ls +1 -5
  33. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +1 -5
  34. package/web/src/pug/block/taiwantown/0.0.1/index.ls +1 -5
  35. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +1 -5
  36. package/web/src/pug/block/treemap/0.0.1/index.ls +1 -5
  37. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +1 -5
  38. package/web/src/pug/block/wordcloud/0.0.1/index.ls +1 -5
  39. package/web/src/pug/block/worldmap/0.0.1/index.ls +1 -5
  40. package/web/src/styl/index.styl +6 -0
  41. package/web/static/block/axis/0.0.1/index.html +68 -73
  42. package/web/static/block/axis-bubble/0.0.1/index.html +205 -210
  43. package/web/static/block/bar/0.0.1/index.html +484 -489
  44. package/web/static/block/bar-list/0.0.1/index.html +188 -193
  45. package/web/static/block/bar-race/0.0.1/index.html +155 -160
  46. package/web/static/block/base/0.0.1/index.html +2 -2
  47. package/web/static/block/blank/0.0.1/index.html +35 -40
  48. package/web/static/block/bubble/0.0.1/index.html +377 -357
  49. package/web/static/block/curve-bar/0.0.1/index.html +126 -131
  50. package/web/static/block/dumbbell/0.0.1/index.html +160 -165
  51. package/web/static/block/empty/0.0.1/index.html +2 -2
  52. package/web/static/block/gauge/0.0.1/index.html +116 -121
  53. package/web/static/block/line/0.0.1/index.html +502 -507
  54. package/web/static/block/number/0.0.1/index.html +123 -128
  55. package/web/static/block/percent-list/0.0.1/index.html +263 -268
  56. package/web/static/block/pie/0.0.1/index.html +241 -246
  57. package/web/static/block/pie-bubble/0.0.1/index.html +295 -300
  58. package/web/static/block/radar/0.0.1/index.html +137 -142
  59. package/web/static/block/scatter/0.0.1/index.html +207 -212
  60. package/web/static/block/sheet/0.0.1/index.html +93 -98
  61. package/web/static/block/table/0.0.1/index.html +64 -70
  62. package/web/static/block/taiwancounty/0.0.1/index.html +180 -185
  63. package/web/static/block/taiwantown/0.0.1/index.html +104 -109
  64. package/web/static/block/taiwanvillage/0.0.1/index.html +114 -119
  65. package/web/static/block/treemap/0.0.1/index.html +296 -301
  66. package/web/static/block/voronoi-treemap/0.0.1/index.html +311 -316
  67. package/web/static/block/wordcloud/0.0.1/index.html +82 -87
  68. package/web/static/block/worldmap/0.0.1/index.html +186 -191
  69. package/web/static/css/index.css +6 -0
  70. package/web/static/css/index.min.css +1 -0
  71. package/web/static/index.html +1 -1
@@ -16,214 +16,209 @@
16
16
  height: 0.5em;
17
17
  border-radius: 2px;
18
18
  }
19
- </style><script type="@plotdb/block">(function(it){
20
- return it();
21
- })(function(){
22
- var blockFactory, mod;
23
- blockFactory = {
24
- pkg: {
25
- name: 'bar-list',
26
- version: '0.0.1',
27
- extend: {
28
- name: "base",
29
- version: "0.0.1"
30
- },
31
- dependencies: [{
32
- url: "/assets/lib/ldview/main/index.min.js"
33
- }]
19
+ </style><script type="@plotdb/block">var mod;
20
+ module.exports = {
21
+ pkg: {
22
+ name: 'bar-list',
23
+ version: '0.0.1',
24
+ extend: {
25
+ name: "base",
26
+ version: "0.0.1"
34
27
  },
35
- init: function(arg$){
36
- var root, context, t, pubsub;
37
- root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
38
- return pubsub.fire('init', {
39
- mod: mod({
40
- root: root,
41
- context: context,
42
- t: t
28
+ dependencies: [{
29
+ url: "/assets/lib/ldview/main/index.min.js"
30
+ }]
31
+ },
32
+ init: function(arg$){
33
+ var root, context, t, pubsub;
34
+ root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
35
+ return pubsub.fire('init', {
36
+ mod: mod({
37
+ root: root,
38
+ context: context,
39
+ t: t
40
+ }),
41
+ prepareSvg: false,
42
+ layout: false,
43
+ dataAccessor: function(it){
44
+ return it._data._raw;
45
+ }
46
+ });
47
+ }
48
+ };
49
+ mod = function(arg$){
50
+ var root, context, t, chart, d3, debounce;
51
+ root = arg$.root, context = arg$.context, t = arg$.t;
52
+ chart = context.chart, d3 = context.d3, debounce = context.debounce;
53
+ return {
54
+ sample: function(){
55
+ return {
56
+ raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function(it){
57
+ return {
58
+ name: it,
59
+ value: (Math.random() * 100).toFixed(2)
60
+ };
43
61
  }),
44
- prepareSvg: false,
45
- layout: false,
46
- dataAccessor: function(it){
47
- return it._data._raw;
48
- }
49
- });
50
- }
51
- };
52
- mod = function(arg$){
53
- var root, context, t, chart, d3, debounce;
54
- root = arg$.root, context = arg$.context, t = arg$.t;
55
- chart = context.chart, d3 = context.d3, debounce = context.debounce;
56
- return {
57
- sample: function(){
58
- return {
59
- raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function(it){
60
- return {
61
- name: it,
62
- value: (Math.random() * 100).toFixed(2)
63
- };
64
- }),
65
- binding: {
66
- size: {
67
- key: "value"
68
- },
69
- name: {
70
- key: "name"
71
- }
62
+ binding: {
63
+ size: {
64
+ key: "value"
65
+ },
66
+ name: {
67
+ key: "name"
72
68
  }
73
- };
74
- },
75
- config: {},
76
- dimension: {
77
- size: {
78
- type: 'R',
79
- name: "size"
80
- },
81
- name: {
82
- type: 'NO',
83
- name: "name"
84
69
  }
70
+ };
71
+ },
72
+ config: {},
73
+ dimension: {
74
+ size: {
75
+ type: 'R',
76
+ name: "size"
85
77
  },
86
- init: function(){
87
- var tint, scale, getList, this$ = this;
88
- this.picked = {};
89
- this.tint = tint = new chart.utils.tint();
90
- this.scale = scale = {};
91
- this.extent = {};
92
- getList = function(){
93
- var k, v;
94
- return (function(){
95
- var ref$, results$ = [];
96
- for (k in ref$ = this.picked) {
97
- v = ref$[k];
98
- results$.push([k, v]);
99
- }
100
- return results$;
101
- }.call(this$)).filter(function(it){
102
- return !it[1];
103
- }).map(function(it){
104
- return it[0];
105
- });
106
- };
107
- return this.view = new ldview({
108
- root: root,
109
- initRender: false,
110
- action: {
111
- click: {
112
- select: function(arg$){
113
- var views, node, name;
114
- views = arg$.views, node = arg$.node;
115
- name = node.getAttribute('data-name');
116
- if (name === 'none') {
117
- this$.parsed.map(function(it){
118
- return this$.picked[it.name] = false;
119
- });
120
- } else {
121
- this$.picked = {};
78
+ name: {
79
+ type: 'NO',
80
+ name: "name"
81
+ }
82
+ },
83
+ init: function(){
84
+ var tint, scale, getList, this$ = this;
85
+ this.picked = {};
86
+ this.tint = tint = new chart.utils.tint();
87
+ this.scale = scale = {};
88
+ this.extent = {};
89
+ getList = function(){
90
+ var k, v;
91
+ return (function(){
92
+ var ref$, results$ = [];
93
+ for (k in ref$ = this.picked) {
94
+ v = ref$[k];
95
+ results$.push([k, v]);
96
+ }
97
+ return results$;
98
+ }.call(this$)).filter(function(it){
99
+ return !it[1];
100
+ }).map(function(it){
101
+ return it[0];
102
+ });
103
+ };
104
+ return this.view = new ldview({
105
+ root: root,
106
+ initRender: false,
107
+ action: {
108
+ click: {
109
+ select: function(arg$){
110
+ var views, node, name;
111
+ views = arg$.views, node = arg$.node;
112
+ name = node.getAttribute('data-name');
113
+ if (name === 'none') {
114
+ this$.parsed.map(function(it){
115
+ return this$.picked[it.name] = false;
116
+ });
117
+ } else {
118
+ this$.picked = {};
119
+ }
120
+ this$.filter({
121
+ name: {
122
+ type: 'exclude',
123
+ value: getList()
122
124
  }
123
- this$.filter({
125
+ }, true);
126
+ return views[0].render('data');
127
+ }
128
+ }
129
+ },
130
+ handler: {
131
+ data: {
132
+ list: function(){
133
+ return this$.parsed;
134
+ },
135
+ key: function(it){
136
+ return it._idx;
137
+ },
138
+ action: {
139
+ click: function(arg$){
140
+ var views, node, data;
141
+ views = arg$.views, node = arg$.node, data = arg$.data;
142
+ this$.picked[data.name] = this$.picked[data.name] != null ? !this$.picked[data.name] : false;
143
+ views[0].render('data', data._idx);
144
+ return this$.filter({
124
145
  name: {
125
146
  type: 'exclude',
126
147
  value: getList()
127
148
  }
128
149
  }, true);
129
- return views[0].render('data');
130
- }
131
- }
132
- },
133
- handler: {
134
- data: {
135
- list: function(){
136
- return this$.parsed;
137
- },
138
- key: function(it){
139
- return it._idx;
140
- },
141
- action: {
142
- click: function(arg$){
143
- var views, node, data;
144
- views = arg$.views, node = arg$.node, data = arg$.data;
145
- this$.picked[data.name] = this$.picked[data.name] != null ? !this$.picked[data.name] : false;
146
- views[0].render('data', data._idx);
147
- return this$.filter({
148
- name: {
149
- type: 'exclude',
150
- value: getList()
151
- }
152
- }, true);
153
- }
154
- },
155
- handler: function(arg$){
156
- var node, data, nn, nb, unit, ref$;
157
- node = arg$.node, data = arg$.data;
158
- nn = node.querySelector('[ld=name]');
159
- nb = node.querySelector('[ld=bar]');
160
- unit = ((ref$ = this$.binding).size || (ref$.size = {})).unit || '';
161
- nn.textContent = data.name + " / " + data.size + unit;
162
- ref$ = nb.style;
163
- ref$.width = this$.scale.x(data.size) + "%";
164
- ref$.background = this$.tint.get('size');
165
- return node.style.opacity = this$.picked[data.name] === false ? 0.3 : 1;
166
150
  }
151
+ },
152
+ handler: function(arg$){
153
+ var node, data, nn, nb, unit, ref$;
154
+ node = arg$.node, data = arg$.data;
155
+ nn = node.querySelector('[ld=name]');
156
+ nb = node.querySelector('[ld=bar]');
157
+ unit = ((ref$ = this$.binding).size || (ref$.size = {})).unit || '';
158
+ nn.textContent = data.name + " / " + data.size + unit;
159
+ ref$ = nb.style;
160
+ ref$.width = this$.scale.x(data.size) + "%";
161
+ ref$.background = this$.tint.get('size');
162
+ return node.style.opacity = this$.picked[data.name] === false ? 0.3 : 1;
167
163
  }
168
164
  }
169
- });
170
- },
171
- filter: function(filters, internal){
172
- internal == null && (internal = false);
173
- },
174
- parse: function(){
175
- var names, k, this$ = this;
176
- this.parsed = this.data.map(function(it){
177
- return it;
178
- });
179
- names = this.parsed.map(function(it){
180
- return it.name;
181
- });
182
- this.parsed = this.parsed.concat((function(){
183
- var results$ = [];
184
- for (k in this.picked) {
185
- results$.push(k);
186
- }
187
- return results$;
188
- }.call(this)).filter(function(it){
189
- return !in$(it, names);
190
- }).map(function(it){
191
- return {
192
- name: it,
193
- size: 0
194
- };
195
- }));
196
- this.parsed.sort(function(a, b){
197
- var pb, pa, that;
198
- pb = !(this$.picked[b.name] != null) || this$.picked[b.name];
199
- pa = !(this$.picked[a.name] != null) || this$.picked[a.name];
200
- if (pb && !pa) {
201
- return 1;
202
- } else if (!pb && pa) {
203
- return -1;
204
- }
205
- if (that = b.size - a.size) {
206
- return that;
207
- }
208
- return 0;
209
- });
210
- return this.parsed.map(function(d, i){
211
- return d._idx = i;
212
- });
213
- },
214
- resize: function(){
215
- this.extent = d3.extent(this.parsed.map(function(it){
216
- return it.size;
217
- }));
218
- return this.scale.x = d3.scaleLinear().domain([0, this.extent[1]]).range([0, 100]);
219
- },
220
- render: function(){
221
- return this.view.render();
222
- }
223
- };
165
+ }
166
+ });
167
+ },
168
+ filter: function(filters, internal){
169
+ internal == null && (internal = false);
170
+ },
171
+ parse: function(){
172
+ var names, k, this$ = this;
173
+ this.parsed = this.data.map(function(it){
174
+ return it;
175
+ });
176
+ names = this.parsed.map(function(it){
177
+ return it.name;
178
+ });
179
+ this.parsed = this.parsed.concat((function(){
180
+ var results$ = [];
181
+ for (k in this.picked) {
182
+ results$.push(k);
183
+ }
184
+ return results$;
185
+ }.call(this)).filter(function(it){
186
+ return !in$(it, names);
187
+ }).map(function(it){
188
+ return {
189
+ name: it,
190
+ size: 0
191
+ };
192
+ }));
193
+ this.parsed.sort(function(a, b){
194
+ var pb, pa, that;
195
+ pb = !(this$.picked[b.name] != null) || this$.picked[b.name];
196
+ pa = !(this$.picked[a.name] != null) || this$.picked[a.name];
197
+ if (pb && !pa) {
198
+ return 1;
199
+ } else if (!pb && pa) {
200
+ return -1;
201
+ }
202
+ if (that = b.size - a.size) {
203
+ return that;
204
+ }
205
+ return 0;
206
+ });
207
+ return this.parsed.map(function(d, i){
208
+ return d._idx = i;
209
+ });
210
+ },
211
+ resize: function(){
212
+ this.extent = d3.extent(this.parsed.map(function(it){
213
+ return it.size;
214
+ }));
215
+ return this.scale.x = d3.scaleLinear().domain([0, this.extent[1]]).range([0, 100]);
216
+ },
217
+ render: function(){
218
+ return this.view.render();
219
+ }
224
220
  };
225
- return blockFactory;
226
- });
221
+ };
227
222
  function in$(x, xs){
228
223
  var i = -1, l = xs.length >>> 0;
229
224
  while (++i < l) if (x === xs[i]) return true;