@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
@@ -21,130 +21,125 @@
21
21
  .pdl-layout > div[data-type=layout] [data-name=unit] {
22
22
  line-height: 1em;
23
23
  }
24
- </style><script type="@plotdb/block">(function(it){
25
- return it();
26
- })(function(){
27
- var blockFactory, mod;
28
- blockFactory = {
29
- pkg: {
30
- name: 'gauge',
31
- version: '0.0.1',
32
- extend: {
33
- name: "base",
34
- version: "0.0.1"
35
- },
36
- dependencies: []
24
+ </style><script type="@plotdb/block">var mod;
25
+ module.exports = {
26
+ pkg: {
27
+ name: 'gauge',
28
+ version: '0.0.1',
29
+ extend: {
30
+ name: "base",
31
+ version: "0.0.1"
37
32
  },
38
- init: function(arg$){
39
- var root, context, pubsub;
40
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
41
- return pubsub.fire('init', {
42
- mod: mod({
43
- context: context
44
- })
45
- });
46
- }
47
- };
48
- mod = function(arg$){
49
- var context, d3, chart;
50
- context = arg$.context;
51
- d3 = context.d3, chart = context.chart;
52
- return {
53
- sample: function(){
54
- return {
55
- raw: [{
56
- value: Math.random(),
57
- max: 1
58
- }],
59
- binding: {
60
- value: {
61
- key: 'value'
62
- },
63
- max: {
64
- key: 'max'
65
- }
33
+ dependencies: []
34
+ },
35
+ init: function(arg$){
36
+ var root, context, pubsub;
37
+ root = arg$.root, context = arg$.context, pubsub = arg$.pubsub;
38
+ return pubsub.fire('init', {
39
+ mod: mod({
40
+ context: context
41
+ })
42
+ });
43
+ }
44
+ };
45
+ mod = function(arg$){
46
+ var context, d3, chart;
47
+ context = arg$.context;
48
+ d3 = context.d3, chart = context.chart;
49
+ return {
50
+ sample: function(){
51
+ return {
52
+ raw: [{
53
+ value: Math.random(),
54
+ max: 1
55
+ }],
56
+ binding: {
57
+ value: {
58
+ key: 'value'
59
+ },
60
+ max: {
61
+ key: 'max'
66
62
  }
67
- };
68
- },
69
- config: {},
70
- dimension: {
71
- value: {
72
- type: 'R',
73
- name: "value"
74
- },
75
- max: {
76
- type: 'R',
77
- name: "max"
78
63
  }
64
+ };
65
+ },
66
+ config: {},
67
+ dimension: {
68
+ value: {
69
+ type: 'R',
70
+ name: "value"
79
71
  },
80
- init: function(){
81
- var tint;
82
- this.tint = tint = new chart.utils.tint();
83
- this.arc = d3.arc();
84
- return this.g = {
85
- view: d3.select(this.layout.getGroup('view')),
86
- number: d3.select(this.layout.getGroup('number')),
87
- unit: d3.select(this.layout.getGroup('unit'))
88
- };
89
- },
90
- parse: function(){
91
- var x$, y$, z$, z1$, z2$;
92
- x$ = this.g.view.selectAll('path.wedge').data([0, 1]);
93
- x$.exit().remove();
94
- x$.enter().append('path').attr('class', 'wedge');
95
- y$ = this.g.view.selectAll('path.pin').data([0]);
96
- y$.exit().remove();
97
- y$.enter().append('path').attr('class', 'pin');
98
- z$ = this.g.view.selectAll('citcle').data([0]);
99
- z$.exit().remove();
100
- z$.enter().append('circle');
101
- z1$ = this.g.number.selectAll('text').data([0]);
102
- z1$.exit().remove();
103
- z1$.enter().append('text');
104
- z2$ = this.g.unit.selectAll('text').data([0]);
105
- z2$.exit().remove();
106
- z2$.enter().append('text');
107
- return z2$;
108
- },
109
- resize: function(){
110
- var n, b, x$;
111
- n = this.layout.getNode('view');
112
- b = this.layout.getBox('view');
113
- x$ = n.style;
114
- x$.width = b.height + "px";
115
- return this.layout.update(false);
116
- },
117
- render: function(){
118
- var d, percent, ref$, ref1$, angle, start, end, box, size, offset, this$ = this;
119
- if (this.cfg != null && this.cfg.palette) {
120
- this.tint.set(this.cfg.palette.colors.map(function(it){
121
- return it.value || it;
122
- }));
123
- }
124
- d = this.data[0] || {};
125
- percent = (ref$ = (ref1$ = (d.value || 0) / (d.max || 1)) < 1 ? ref1$ : 1) > 0 ? ref$ : 0;
126
- angle = percent * (Math.PI * 6 / 4) + Math.PI / 4;
127
- start = Math.PI / 4;
128
- end = Math.PI * 7 / 4;
129
- box = this.layout.getBox('view');
130
- size = Math.min(box.width, box.height) / 2;
131
- this.arc.innerRadius(size * 0.5).outerRadius(size);
132
- offset = size * (1 - 1 / Math.sqrt(2)) / 2;
133
- this.g.view.selectAll('path.wedge').attr('transform', "translate(" + box.width / 2 + "," + (offset + box.height / 2) + ") rotate(180)").attr('d', function(d, i){
134
- this$.arc.startAngle(i === 0 ? start : angle).endAngle(i === 0 ? angle : end);
135
- return this$.arc();
136
- }).attr('fill', function(d, i){
137
- return this$.tint.get(d);
138
- });
139
- this.g.view.selectAll('path.pin').attr('transform', "translate(" + box.width / 2 + " " + (offset + box.height / 2) + ") rotate(" + (45 + 270 * percent) + ")").attr('d', "M0 " + size * 0.4 + "L0 " + size).attr('fill', 'none').attr('stroke', '#000').attr('stroke-width', 2);
140
- this.g.number.selectAll('text').text(function(){
141
- return 3000;
142
- }).attr('font-size', 24).attr('dominant-baseline', 'hanging');
143
- return this.g.unit.selectAll('text').text(function(){
144
- return "新臺幣";
145
- }).attr('dominant-baseline', 'hanging');
72
+ max: {
73
+ type: 'R',
74
+ name: "max"
75
+ }
76
+ },
77
+ init: function(){
78
+ var tint;
79
+ this.tint = tint = new chart.utils.tint();
80
+ this.arc = d3.arc();
81
+ return this.g = {
82
+ view: d3.select(this.layout.getGroup('view')),
83
+ number: d3.select(this.layout.getGroup('number')),
84
+ unit: d3.select(this.layout.getGroup('unit'))
85
+ };
86
+ },
87
+ parse: function(){
88
+ var x$, y$, z$, z1$, z2$;
89
+ x$ = this.g.view.selectAll('path.wedge').data([0, 1]);
90
+ x$.exit().remove();
91
+ x$.enter().append('path').attr('class', 'wedge');
92
+ y$ = this.g.view.selectAll('path.pin').data([0]);
93
+ y$.exit().remove();
94
+ y$.enter().append('path').attr('class', 'pin');
95
+ z$ = this.g.view.selectAll('citcle').data([0]);
96
+ z$.exit().remove();
97
+ z$.enter().append('circle');
98
+ z1$ = this.g.number.selectAll('text').data([0]);
99
+ z1$.exit().remove();
100
+ z1$.enter().append('text');
101
+ z2$ = this.g.unit.selectAll('text').data([0]);
102
+ z2$.exit().remove();
103
+ z2$.enter().append('text');
104
+ return z2$;
105
+ },
106
+ resize: function(){
107
+ var n, b, x$;
108
+ n = this.layout.getNode('view');
109
+ b = this.layout.getBox('view');
110
+ x$ = n.style;
111
+ x$.width = b.height + "px";
112
+ return this.layout.update(false);
113
+ },
114
+ render: function(){
115
+ var d, percent, ref$, ref1$, angle, start, end, box, size, offset, this$ = this;
116
+ if (this.cfg != null && this.cfg.palette) {
117
+ this.tint.set(this.cfg.palette.colors.map(function(it){
118
+ return it.value || it;
119
+ }));
146
120
  }
147
- };
121
+ d = this.data[0] || {};
122
+ percent = (ref$ = (ref1$ = (d.value || 0) / (d.max || 1)) < 1 ? ref1$ : 1) > 0 ? ref$ : 0;
123
+ angle = percent * (Math.PI * 6 / 4) + Math.PI / 4;
124
+ start = Math.PI / 4;
125
+ end = Math.PI * 7 / 4;
126
+ box = this.layout.getBox('view');
127
+ size = Math.min(box.width, box.height) / 2;
128
+ this.arc.innerRadius(size * 0.5).outerRadius(size);
129
+ offset = size * (1 - 1 / Math.sqrt(2)) / 2;
130
+ this.g.view.selectAll('path.wedge').attr('transform', "translate(" + box.width / 2 + "," + (offset + box.height / 2) + ") rotate(180)").attr('d', function(d, i){
131
+ this$.arc.startAngle(i === 0 ? start : angle).endAngle(i === 0 ? angle : end);
132
+ return this$.arc();
133
+ }).attr('fill', function(d, i){
134
+ return this$.tint.get(d);
135
+ });
136
+ this.g.view.selectAll('path.pin').attr('transform', "translate(" + box.width / 2 + " " + (offset + box.height / 2) + ") rotate(" + (45 + 270 * percent) + ")").attr('d', "M0 " + size * 0.4 + "L0 " + size).attr('fill', 'none').attr('stroke', '#000').attr('stroke-width', 2);
137
+ this.g.number.selectAll('text').text(function(){
138
+ return 3000;
139
+ }).attr('font-size', 24).attr('dominant-baseline', 'hanging');
140
+ return this.g.unit.selectAll('text').text(function(){
141
+ return "新臺幣";
142
+ }).attr('dominant-baseline', 'hanging');
143
+ }
148
144
  };
149
- return blockFactory;
150
- });</script></div>
145
+ };</script></div>