@plotdb/chart 1.0.1 → 1.0.2

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 (164) hide show
  1. package/package.json +3 -1
  2. package/CHANGELOG.md +0 -29
  3. package/build +0 -45
  4. package/doc/charts.md +0 -58
  5. package/doc/config.md +0 -44
  6. package/doc/draft/chart.md +0 -146
  7. package/doc/draft/data.md +0 -8
  8. package/doc/draft/definition.md +0 -0
  9. package/doc/draft/events.md +0 -0
  10. package/doc/draft/filter.md +0 -0
  11. package/doc/draft/lifecycle.md +0 -89
  12. package/doc/spec.md +0 -89
  13. package/doc/todo.md +0 -27
  14. package/doc/utils/tip.md +0 -84
  15. package/src/data/en-US/category +0 -20
  16. package/src/data/en-US/fruit +0 -39
  17. package/src/data/en-US/movie +0 -125
  18. package/src/data/en-US/name +0 -58
  19. package/src/data/index.ls +0 -34
  20. package/src/data/zh-TW/category +0 -20
  21. package/src/data/zh-TW/fruits +0 -38
  22. package/src/data/zh-TW/movie +0 -125
  23. package/src/data/zh-TW/names +0 -105
  24. package/src/index.ls +0 -323
  25. package/src/index.styl +0 -6
  26. package/src/utils/axis.ls +0 -229
  27. package/src/utils/config.ls +0 -11
  28. package/src/utils/data.ls +0 -104
  29. package/src/utils/format.ls +0 -30
  30. package/src/utils/legend.ls +0 -134
  31. package/src/utils/legend.styl +0 -37
  32. package/src/utils/tint.ls +0 -66
  33. package/src/utils/tip.ls +0 -97
  34. package/web/src/pug/base.pug +0 -21
  35. package/web/src/pug/block/axis/0.0.1/index.ls +0 -32
  36. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  37. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -137
  38. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  39. package/web/src/pug/block/bar/0.0.1/index.ls +0 -270
  40. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  41. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -81
  42. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  43. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -79
  44. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  45. package/web/src/pug/block/base/0.0.1/index.ls +0 -66
  46. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  47. package/web/src/pug/block/blank/0.0.1/index.ls +0 -21
  48. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  49. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -218
  50. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -42
  51. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -85
  52. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  53. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  54. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -86
  55. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  56. package/web/src/pug/block/empty/0.0.1/index.ls +0 -28
  57. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  58. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -96
  59. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  60. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  61. package/web/src/pug/block/line/0.0.1/index.ls +0 -297
  62. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  63. package/web/src/pug/block/number/0.0.1/index.ls +0 -65
  64. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  65. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -161
  66. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  67. package/web/src/pug/block/pie/0.0.1/index.ls +0 -121
  68. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  69. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  70. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -181
  71. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  72. package/web/src/pug/block/radar/0.0.1/index.ls +0 -109
  73. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  74. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  75. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -124
  76. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  77. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -34
  78. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  79. package/web/src/pug/block/table/0.0.1/index.ls +0 -36
  80. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  81. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -70
  82. package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
  83. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -44
  84. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  85. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -49
  86. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  87. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -168
  88. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  89. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -170
  90. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  91. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  92. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -57
  93. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  94. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -77
  95. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  96. package/web/src/pug/index.ls +0 -72
  97. package/web/src/pug/index.pug +0 -51
  98. package/web/src/styl/index.styl +0 -6
  99. package/web/static/assets/block/cache.js +0 -4
  100. package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
  101. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  102. package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
  103. package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
  104. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  105. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  106. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  107. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  108. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  109. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  110. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  111. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  112. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  113. package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
  114. package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
  115. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  116. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  117. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  118. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  119. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  120. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  121. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  122. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  123. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  124. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  125. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  126. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  127. package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
  128. package/web/static/assets/data/countrycode.json +0 -1
  129. package/web/static/assets/data/world-110m.json +0 -1
  130. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  131. package/web/static/assets/img/fluid.svg +0 -16
  132. package/web/static/block/axis/0.0.1/index.html +0 -74
  133. package/web/static/block/axis-bubble/0.0.1/index.html +0 -217
  134. package/web/static/block/bar/0.0.1/index.html +0 -576
  135. package/web/static/block/bar-list/0.0.1/index.html +0 -226
  136. package/web/static/block/bar-race/0.0.1/index.html +0 -179
  137. package/web/static/block/base/0.0.1/index.html +0 -197
  138. package/web/static/block/blank/0.0.1/index.html +0 -37
  139. package/web/static/block/bubble/0.0.1/index.html +0 -422
  140. package/web/static/block/bubble/0.0.1/test.html +0 -0
  141. package/web/static/block/curve-bar/0.0.1/index.html +0 -143
  142. package/web/static/block/dumbbell/0.0.1/index.html +0 -173
  143. package/web/static/block/empty/0.0.1/index.html +0 -76
  144. package/web/static/block/gauge/0.0.1/index.html +0 -145
  145. package/web/static/block/line/0.0.1/index.html +0 -566
  146. package/web/static/block/number/0.0.1/index.html +0 -147
  147. package/web/static/block/percent-list/0.0.1/index.html +0 -311
  148. package/web/static/block/pie/0.0.1/index.html +0 -276
  149. package/web/static/block/pie-bubble/0.0.1/index.html +0 -353
  150. package/web/static/block/radar/0.0.1/index.html +0 -144
  151. package/web/static/block/scatter/0.0.1/index.html +0 -246
  152. package/web/static/block/sheet/0.0.1/index.html +0 -98
  153. package/web/static/block/table/0.0.1/index.html +0 -67
  154. package/web/static/block/taiwancounty/0.0.1/index.html +0 -197
  155. package/web/static/block/taiwantown/0.0.1/index.html +0 -205
  156. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -215
  157. package/web/static/block/treemap/0.0.1/index.html +0 -355
  158. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -345
  159. package/web/static/block/wordcloud/0.0.1/index.html +0 -87
  160. package/web/static/block/worldmap/0.0.1/index.html +0 -202
  161. package/web/static/css/index.css +0 -6
  162. package/web/static/css/index.min.css +0 -1
  163. package/web/static/favicon.ico +0 -0
  164. package/web/static/index.html +0 -153
@@ -1,173 +0,0 @@
1
- <div><script type="@plotdb/block">var mod;
2
- module.exports = {
3
- pkg: {
4
- name: 'dumbbell',
5
- version: '0.0.1',
6
- extend: {
7
- name: "base",
8
- version: "0.0.1"
9
- },
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
- });
20
- }
21
- };
22
- mod = function(arg$){
23
- var context, d3, ldcolor, debounce, infinite;
24
- context = arg$.context;
25
- d3 = context.d3, ldcolor = context.ldcolor, debounce = context.debounce, infinite = context.infinite;
26
- return {
27
- sample: function(){
28
- return {
29
- raw: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function(val){
30
- return {
31
- val1: Math.random() * 0.5 + 0.4,
32
- val2: Math.random() * 0.5 + 0.4,
33
- val3: Math.random() * 0.6 + 0.1,
34
- val4: Math.random() * 0.6 + 0.1,
35
- name: val
36
- };
37
- }),
38
- binding: {
39
- name: {
40
- key: 'name'
41
- },
42
- y1: [
43
- {
44
- key: 'val1'
45
- }, {
46
- key: 'val2'
47
- }
48
- ],
49
- y2: [
50
- {
51
- key: 'val3'
52
- }, {
53
- key: 'val4'
54
- }
55
- ]
56
- }
57
- };
58
- },
59
- config: {},
60
- dimension: {
61
- y1: {
62
- type: 'R',
63
- multiple: true,
64
- name: "y pos"
65
- },
66
- y2: {
67
- type: 'R',
68
- multiple: true,
69
- name: "y pos"
70
- },
71
- name: {
72
- type: 'N',
73
- name: "dumbbell name"
74
- }
75
- },
76
- init: function(){
77
- return this.infcolor = new infinite();
78
- },
79
- parse: function(){
80
- var this$ = this;
81
- this.parsed = [];
82
- this.parsed = this.data.map(function(d, i){
83
- var dumbbell;
84
- dumbbell = d.y1.map(function(e, j){
85
- return {
86
- y1: d.y1[j] || 0,
87
- y2: d.y2[j] || 0,
88
- name: [this$.binding.y1[j].key, this$.binding.y2[j].key]
89
- };
90
- });
91
- return {
92
- name: d.name,
93
- dumbbell: dumbbell
94
- };
95
- });
96
- return this.names = this.data.map(function(it){
97
- return it.name;
98
- });
99
- },
100
- resize: function(){
101
- var ref$, w, h;
102
- ref$ = [this.box.width, this.box.height], w = ref$[0], h = ref$[1];
103
- this.extent = {
104
- y: [
105
- d3.min(this.data.map(function(d, i){
106
- return d3.min([d3.min(d.y1), d3.min(d.y2)]);
107
- })), d3.max(this.data.map(function(d, i){
108
- return d3.max([d3.max(d.y1), d3.max(d.y2)]);
109
- }))
110
- ]
111
- };
112
- this.scale = {
113
- x: d3.scaleBand().domain(this.names).range([0, w]).paddingInner(0.3),
114
- y: d3.scaleLinear().domain([0, this.extent.y[1]]).range([0, h]),
115
- c: d3.scaleOrdinal(d3.schemeCategory10)
116
- };
117
- if (this.cfg != null && this.cfg.palette) {
118
- this.scale.c = d3.scaleOrdinal(this.cfg.palette.colors.map(function(it){
119
- return ldcolor.web(it.value || it);
120
- }));
121
- }
122
- if (this.cfg != null && this.cfg.palette) {
123
- return this.infcolor.setColors(this.cfg.palette.colors.map(function(it){
124
- return ldcolor.web(it.value || it);
125
- }));
126
- }
127
- },
128
- render: function(){
129
- var scale, infcolor, svg, x$;
130
- scale = this.scale, infcolor = this.infcolor;
131
- svg = d3.select(this.svg);
132
- x$ = svg.selectAll('g.data').data(this.parsed);
133
- x$.exit().remove();
134
- x$.enter().append('g').attr('class', 'data');
135
- return svg.selectAll('g.data').each(function(e, j){
136
- var bw, n, x$;
137
- bw = scale.x.bandwidth();
138
- n = d3.select(this);
139
- x$ = n.selectAll('g.dumbbell').data(e.dumbbell);
140
- x$.exit().remove();
141
- x$.enter().append('g').attr('class', 'dumbbell');
142
- return n.selectAll('g.dumbbell').each(function(f, k){
143
- var m, x$, y$;
144
- m = d3.select(this);
145
- x$ = m.selectAll('circle').data([1, 2]);
146
- x$.exit().remove();
147
- x$.enter().append('circle');
148
- y$ = m.selectAll('line').data([0]);
149
- y$.exit().remove();
150
- y$.enter().append('line');
151
- m.selectAll('circle').attr('cx', function(d, i){
152
- return scale.x(e.name) + bw * i;
153
- }).attr('cy', function(d, i){
154
- return scale.y(f["y" + d]);
155
- }).attr('r', 2).attr('fill', function(){
156
- return infcolor.get(f.name[0]);
157
- });
158
- return m.selectAll('line').attr('x1', function(d, i){
159
- return scale.x(e.name);
160
- }).attr('x2', function(d, i){
161
- return scale.x(e.name) + bw;
162
- }).attr('y1', function(d, i){
163
- return scale.y(f.y1);
164
- }).attr('y2', function(d, i){
165
- return scale.y(f.y2);
166
- }).attr('stroke', function(){
167
- return infcolor.get(f.name[0]);
168
- }).attr('stroke-width', 1);
169
- });
170
- });
171
- }
172
- };
173
- };</script></div>
@@ -1,76 +0,0 @@
1
- <div style="width:100%;height:100%"><script type="@plotdb/block">module.exports = {
2
- pkg: {
3
- name: 'empty',
4
- version: '0.0.1',
5
- dependencies: [
6
- {
7
- url: "/assets/lib/@loadingio/debounce.js/main/debounce.min.js"
8
- }, {
9
- url: "/assets/lib/wrap-svg-text/main/index.min.js",
10
- async: false
11
- }, {
12
- url: "/assets/lib/@plotdb/layout/main/index.min.js",
13
- async: false
14
- }, {
15
- url: "/assets/lib/@plotdb/layout/main/index.min.css",
16
- type: 'css'
17
- }, {
18
- url: "/assets/lib/ldcolor/main/ldcolor.min.js",
19
- async: false
20
- }, {
21
- url: "/assets/lib/@plotdb/chart/main/chart.js",
22
- async: false
23
- }, {
24
- url: "/assets/lib/@plotdb/chart/main/chart.min.css",
25
- type: 'css'
26
- }, {
27
- url: "/assets/lib/@plotdb/chart/main/utils/legend.js",
28
- async: false
29
- }, {
30
- url: "/assets/lib/@plotdb/chart/main/utils/legend.css",
31
- type: 'css'
32
- }, {
33
- url: "/assets/lib/@plotdb/chart/main/utils/tint.js",
34
- async: false
35
- }, {
36
- url: "/assets/lib/@plotdb/chart/main/utils/data.js",
37
- async: false
38
- }
39
- ]
40
- },
41
- init: function(arg$){
42
- var root, context, pubsub, data, chart, this$ = this;
43
- root = arg$.root, context = arg$.context, pubsub = arg$.pubsub, data = arg$.data;
44
- chart = context.chart;
45
- pubsub.on('init', function(opt){
46
- var c;
47
- opt == null && (opt = {});
48
- opt = import$({
49
- root: root,
50
- delayRender: true
51
- }, opt);
52
- this$.chart = c = new chart(import$((opt.prepareSvg = false, opt.layout = false, opt), data));
53
- return c.init().then(function(){
54
- return c;
55
- });
56
- });
57
- return this;
58
- },
59
- 'interface': function(){
60
- return this.chart;
61
- },
62
- mod: function(root){
63
- return {
64
- config: {},
65
- dimension: {},
66
- init: function(){},
67
- resize: function(){},
68
- render: function(){}
69
- };
70
- }
71
- };
72
- function import$(obj, src){
73
- var own = {}.hasOwnProperty;
74
- for (var key in src) if (own.call(src, key)) obj[key] = src[key];
75
- return obj;
76
- }</script></div>
@@ -1,145 +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="text"><div class="pdl-cell" data-name="number">0000</div><div class="pdl-cell" data-name="unit">0000</div></div></div><div data-type="render"></div></div></div><style type="text/css">.pdl-layout > div[data-type=layout] {
2
- display: flex;
3
- justify-content: center;
4
- align-items: center;
5
- }
6
- .pdl-layout > div[data-type=layout] .text {
7
- margin-left: 0.5em;
8
- height: 100%;
9
- display: flex;
10
- flex-direction: column;
11
- justify-content: center;
12
- align-items: start;
13
- }
14
- .pdl-layout > div[data-type=layout] [data-name=view] {
15
- height: 100%;
16
- }
17
- .pdl-layout > div[data-type=layout] [data-name=number] {
18
- font-size: 24px;
19
- line-height: 1em;
20
- }
21
- .pdl-layout > div[data-type=layout] [data-name=unit] {
22
- line-height: 1em;
23
- }
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"
32
- },
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'
62
- }
63
- }
64
- };
65
- },
66
- config: {},
67
- dimension: {
68
- value: {
69
- type: 'R',
70
- name: "value"
71
- },
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
- }));
120
- }
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
- }
144
- };
145
- };</script></div>