@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
@@ -11,174 +11,169 @@
11
11
  grid-row: 1/span 2;
12
12
  padding-left: 1em;
13
13
  }
14
- </style><script type="@plotdb/block">(function(it){
15
- return it();
16
- })(function(){
17
- var blockFactory, mod;
18
- blockFactory = {
19
- pkg: {
20
- name: 'bar-race',
21
- version: '0.0.1',
22
- extend: {
23
- name: "base",
24
- version: "0.0.1"
25
- },
26
- dependencies: [],
27
- i18n: {
28
- "zh-TW": {
29
- "height": "高度"
30
- }
31
- }
14
+ </style><script type="@plotdb/block">var mod;
15
+ module.exports = {
16
+ pkg: {
17
+ name: 'bar-race',
18
+ version: '0.0.1',
19
+ extend: {
20
+ name: "base",
21
+ version: "0.0.1"
32
22
  },
33
- init: function(arg$){
34
- var root, context, t, pubsub;
35
- root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
36
- return pubsub.fire('init', {
37
- mod: mod({
38
- context: context,
39
- t: t
40
- })
41
- });
23
+ dependencies: [],
24
+ i18n: {
25
+ "zh-TW": {
26
+ "height": "高度"
27
+ }
42
28
  }
43
- };
44
- mod = function(arg$){
45
- var context, t, chart, d3, debounce;
46
- context = arg$.context, t = arg$.t;
47
- chart = context.chart, d3 = context.d3, debounce = context.debounce;
48
- return {
49
- sample: function(){
50
- return {
51
- 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){
52
- var ref$, n, o, ret;
53
- ref$ = [val % 10, Math.floor(val / 10)], n = ref$[0], o = ref$[1];
54
- ret = {
55
- name: n,
56
- value: Math.random(),
57
- order: o
58
- };
59
- return ret;
60
- }),
61
- binding: {
62
- order: {
63
- key: "order"
64
- },
65
- value: {
66
- key: "value"
67
- },
68
- name: {
69
- key: "name"
70
- }
29
+ },
30
+ init: function(arg$){
31
+ var root, context, t, pubsub;
32
+ root = arg$.root, context = arg$.context, t = arg$.t, pubsub = arg$.pubsub;
33
+ return pubsub.fire('init', {
34
+ mod: mod({
35
+ context: context,
36
+ t: t
37
+ })
38
+ });
39
+ }
40
+ };
41
+ mod = function(arg$){
42
+ var context, t, chart, d3, debounce;
43
+ context = arg$.context, t = arg$.t;
44
+ chart = context.chart, d3 = context.d3, debounce = context.debounce;
45
+ return {
46
+ sample: function(){
47
+ return {
48
+ 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){
49
+ var ref$, n, o, ret;
50
+ ref$ = [val % 10, Math.floor(val / 10)], n = ref$[0], o = ref$[1];
51
+ ret = {
52
+ name: n,
53
+ value: Math.random(),
54
+ order: o
55
+ };
56
+ return ret;
57
+ }),
58
+ binding: {
59
+ order: {
60
+ key: "order"
61
+ },
62
+ value: {
63
+ key: "value"
64
+ },
65
+ name: {
66
+ key: "name"
71
67
  }
72
- };
73
- },
74
- config: {},
75
- dimension: {
76
- order: {
77
- type: 'O',
78
- name: "order",
79
- priority: 1
80
- },
81
- value: {
82
- type: 'R',
83
- name: "value",
84
- priority: 2
85
- },
86
- name: {
87
- type: 'N',
88
- name: "name"
89
68
  }
69
+ };
70
+ },
71
+ config: {},
72
+ dimension: {
73
+ order: {
74
+ type: 'O',
75
+ name: "order",
76
+ priority: 1
90
77
  },
91
- init: function(){
92
- var tint, scale;
93
- this.tint = tint = new chart.utils.tint();
94
- this.g = {
95
- view: d3.select(this.layout.getGroup('view')),
96
- axis: d3.select(this.layout.getGroup('axis'))
97
- };
98
- this.scale = scale = {};
99
- this.axisBottom = d3.axisBottom();
100
- return this.legend = new chart.utils.legend({
101
- layout: this.layout,
102
- name: 'legend',
103
- root: this.root,
104
- shape: function(d){
105
- return d3.select(this).attr('fill', tint.get(d.key));
106
- }
107
- });
108
- },
109
- parse: function(){
110
- this.data.map(function(d){
111
- return d.value = d.value.map(function(it){
112
- if (isNaN(it)) {
113
- return 0;
114
- } else {
115
- return +it;
116
- }
117
- });
118
- });
119
- return this.names = Array.from(new Set(this.data.map(function(it){
120
- return it.name;
121
- })));
78
+ value: {
79
+ type: 'R',
80
+ name: "value",
81
+ priority: 2
122
82
  },
123
- resize: function(){
124
- var ref$, i, max, box, this$ = this;
125
- this.layout.getNode('legend').style.width = !(((ref$ = this.cfg).legend || (ref$.legend = {})).enabled != null) || this.cfg.legend.enabled ? '' : '0';
126
- this.layout.update(false);
127
- this.maxPerGroup = this.binding.height.map(function(d, i){
128
- return Math.max.apply(Math, this$.data.map(function(it){
129
- return it.height[i];
130
- }));
131
- });
132
- this.order = this.data.map(function(d, i){
133
- return {
134
- key: d._idx,
135
- idx: i,
136
- name: d.order
137
- };
138
- });
139
- this.order.sort(function(a, b){
140
- if (b.name > a.name) {
141
- return 1;
142
- } else if (b.name < a.name) {
143
- return -1;
144
- } else {
83
+ name: {
84
+ type: 'N',
85
+ name: "name"
86
+ }
87
+ },
88
+ init: function(){
89
+ var tint, scale;
90
+ this.tint = tint = new chart.utils.tint();
91
+ this.g = {
92
+ view: d3.select(this.layout.getGroup('view')),
93
+ axis: d3.select(this.layout.getGroup('axis'))
94
+ };
95
+ this.scale = scale = {};
96
+ this.axisBottom = d3.axisBottom();
97
+ return this.legend = new chart.utils.legend({
98
+ layout: this.layout,
99
+ name: 'legend',
100
+ root: this.root,
101
+ shape: function(d){
102
+ return d3.select(this).attr('fill', tint.get(d.key));
103
+ }
104
+ });
105
+ },
106
+ parse: function(){
107
+ this.data.map(function(d){
108
+ return d.value = d.value.map(function(it){
109
+ if (isNaN(it)) {
145
110
  return 0;
111
+ } else {
112
+ return +it;
146
113
  }
147
114
  });
148
- this.tint.set(this.cfg.palette);
149
- this.legend.data((function(){
150
- var i$, to$, results$ = [];
151
- for (i$ = 0, to$ = this.names.length; i$ < to$; ++i$) {
152
- i = i$;
153
- results$.push({
154
- key: i,
155
- text: this.names[i]
156
- });
157
- }
158
- return results$;
159
- }.call(this)));
160
- this.layout.update(false);
161
- max = Math.max(this.data.map(function(it){
162
- return it.value;
115
+ });
116
+ return this.names = Array.from(new Set(this.data.map(function(it){
117
+ return it.name;
118
+ })));
119
+ },
120
+ resize: function(){
121
+ var ref$, i, max, box, this$ = this;
122
+ this.layout.getNode('legend').style.width = !(((ref$ = this.cfg).legend || (ref$.legend = {})).enabled != null) || this.cfg.legend.enabled ? '' : '0';
123
+ this.layout.update(false);
124
+ this.maxPerGroup = this.binding.height.map(function(d, i){
125
+ return Math.max.apply(Math, this$.data.map(function(it){
126
+ return it.height[i];
163
127
  }));
164
- box = this.layout.getBox('view');
165
- return ref$ = this.scale, ref$.y = d3.scaleLinear().domain([0, max]).range([box.width, 0]), ref$.x = d3.scaleBand().domain(this.order.map(function(it){
166
- return it.name || it.key;
167
- })).range([0, box.height]), ref$;
168
- },
169
- render: function(){
170
- var binding, scale, range, delta, cfg, tint, data, x$;
171
- binding = this.binding, scale = this.scale, range = this.range, delta = this.delta, cfg = this.cfg, tint = this.tint, data = this.data;
172
- x$ = this.g.view.selectAll('g.bar').data(this.data);
173
- x$.exit().remove();
174
- x$.enter().append('g').attr('class', 'bar');
175
- this.g.view.selectAll('g.bar').attr('transform', function(d, i){
176
- return "translate(" + scale.x(d.name) + ",0)";
177
- });
178
- return this.g.axis.call(this.axisBottom).attr('font-size', '');
179
- },
180
- tick: function(){}
181
- };
128
+ });
129
+ this.order = this.data.map(function(d, i){
130
+ return {
131
+ key: d._idx,
132
+ idx: i,
133
+ name: d.order
134
+ };
135
+ });
136
+ this.order.sort(function(a, b){
137
+ if (b.name > a.name) {
138
+ return 1;
139
+ } else if (b.name < a.name) {
140
+ return -1;
141
+ } else {
142
+ return 0;
143
+ }
144
+ });
145
+ this.tint.set(this.cfg.palette);
146
+ this.legend.data((function(){
147
+ var i$, to$, results$ = [];
148
+ for (i$ = 0, to$ = this.names.length; i$ < to$; ++i$) {
149
+ i = i$;
150
+ results$.push({
151
+ key: i,
152
+ text: this.names[i]
153
+ });
154
+ }
155
+ return results$;
156
+ }.call(this)));
157
+ this.layout.update(false);
158
+ max = Math.max(this.data.map(function(it){
159
+ return it.value;
160
+ }));
161
+ box = this.layout.getBox('view');
162
+ return ref$ = this.scale, ref$.y = d3.scaleLinear().domain([0, max]).range([box.width, 0]), ref$.x = d3.scaleBand().domain(this.order.map(function(it){
163
+ return it.name || it.key;
164
+ })).range([0, box.height]), ref$;
165
+ },
166
+ render: function(){
167
+ var binding, scale, range, delta, cfg, tint, data, x$;
168
+ binding = this.binding, scale = this.scale, range = this.range, delta = this.delta, cfg = this.cfg, tint = this.tint, data = this.data;
169
+ x$ = this.g.view.selectAll('g.bar').data(this.data);
170
+ x$.exit().remove();
171
+ x$.enter().append('g').attr('class', 'bar');
172
+ this.g.view.selectAll('g.bar').attr('transform', function(d, i){
173
+ return "translate(" + scale.x(d.name) + ",0)";
174
+ });
175
+ return this.g.axis.call(this.axisBottom).attr('font-size', '');
176
+ },
177
+ tick: function(){}
182
178
  };
183
- return blockFactory;
184
- });</script></div>
179
+ };</script></div>
@@ -1,7 +1,7 @@
1
1
  <div class="base" style="width:100%;height:100%"><plug name="layout"></plug><style type="text/css">*[plug=layout] {
2
2
  fill: currentColor;
3
3
  }
4
- </style><script type="@plotdb/block">({
4
+ </style><script type="@plotdb/block">module.exports = {
5
5
  pkg: {
6
6
  name: 'base',
7
7
  version: '0.0.1',
@@ -189,7 +189,7 @@
189
189
  render: function(){}
190
190
  };
191
191
  }
192
- });
192
+ };
193
193
  function import$(obj, src){
194
194
  var own = {}.hasOwnProperty;
195
195
  for (var key in src) if (own.call(src, key)) obj[key] = src[key];
@@ -1,42 +1,37 @@
1
- <div style="width:100%;height:100%"><script type="@plotdb/block">(function(it){
2
- return it();
3
- })(function(){
4
- var blockFactory, mod;
5
- blockFactory = {
6
- pkg: {
7
- name: 'blank',
8
- version: '0.0.1',
9
- extend: {
10
- name: 'base',
11
- version: '0.0.1'
12
- },
13
- dependencies: []
1
+ <div style="width:100%;height:100%"><script type="@plotdb/block">var mod;
2
+ module.exports = {
3
+ pkg: {
4
+ name: 'blank',
5
+ version: '0.0.1',
6
+ extend: {
7
+ name: 'base',
8
+ version: '0.0.1'
14
9
  },
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
- 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],
23
- binding: {}
24
- });
25
- }
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
+ 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],
20
+ binding: {}
21
+ });
22
+ }
23
+ };
24
+ mod = function(arg$){
25
+ var context;
26
+ context = arg$.context;
27
+ context;
28
+ return {
29
+ config: {},
30
+ dimension: {},
31
+ init: function(){},
32
+ parse: function(){},
33
+ resize: function(){},
34
+ render: function(){},
35
+ tick: function(){}
26
36
  };
27
- mod = function(arg$){
28
- var context;
29
- context = arg$.context;
30
- context;
31
- return {
32
- config: {},
33
- dimension: {},
34
- init: function(){},
35
- parse: function(){},
36
- resize: function(){},
37
- render: function(){},
38
- tick: function(){}
39
- };
40
- };
41
- return blockFactory;
42
- });</script></div>
37
+ };</script></div>