w-plot-vue 1.0.0 → 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 (140) hide show
  1. package/README.md +4 -4
  2. package/dist/w-plot-vue.umd.js +7 -0
  3. package/dist/w-plot-vue.umd.js.map +1 -0
  4. package/docs/examples/app.html +1 -1
  5. package/docs/examples/app.umd.js +2 -2
  6. package/docs/examples/app.umd.js.map +1 -1
  7. package/docs/examples/w-bar_horizontal_multi-set(color).html +10 -10
  8. package/docs/examples/w-bar_horizontal_multi-set(color, gradient).html +10 -10
  9. package/docs/examples/w-bar_horizontal_multi-set(series color).html +10 -10
  10. package/docs/examples/w-bar_horizontal_multi-set(series color, gradient).html +10 -10
  11. package/docs/examples/w-bar_horizontal_multi-set.html +10 -10
  12. package/docs/examples/w-bar_horizontal_multi-set__barDisplay(stackNormal).html +10 -10
  13. package/docs/examples/w-bar_horizontal_multi-set__barDisplay(stackPercent).html +10 -10
  14. package/docs/examples/w-bar_horizontal_multi-set__hide legned.html +10 -10
  15. package/docs/examples/w-bar_horizontal_multi-set__show labels.html +10 -10
  16. package/docs/examples/w-bar_horizontal_multi-set_barKpColor(gradient).html +10 -10
  17. package/docs/examples/w-bar_horizontal_multi-set_barKpColor.html +10 -10
  18. package/docs/examples/w-bar_horizontal_multi-set_barUseInnerLabelsForHorizontal_barGroupWidthRatio.html +496 -0
  19. package/docs/examples/w-bar_horizontal_multi-set_barWidthRatio.html +10 -10
  20. package/docs/examples/w-bar_horizontal_multi-set_barWidthRatio_barGroupWidthRatio.html +10 -10
  21. package/docs/examples/w-bar_horizontal_one-set(color).html +10 -10
  22. package/docs/examples/w-bar_horizontal_one-set(color, gradient).html +10 -10
  23. package/docs/examples/w-bar_horizontal_one-set.html +10 -10
  24. package/docs/examples/w-bar_horizontal_one-set_barColor(gradient).html +10 -10
  25. package/docs/examples/w-bar_horizontal_one-set_barColor.html +10 -10
  26. package/docs/examples/w-bar_horizontal_one-set_barKpColor(gradient).html +10 -10
  27. package/docs/examples/w-bar_horizontal_one-set_barKpColor.html +10 -10
  28. package/docs/examples/w-bar_horizontal_one-set_barUseInnerLabelsForHorizontal.html +493 -0
  29. package/docs/examples/w-bar_horizontal_one-set_barWidthRatio.html +10 -10
  30. package/docs/examples/w-bar_horizontal_one-set_barWidthRatio_barGroupWidthRatio.html +10 -10
  31. package/docs/examples/w-bar_horizontal_one-set_hide labels.html +10 -10
  32. package/docs/examples/w-bar_horizontal_one-set_marginLeft_marginRight.html +10 -10
  33. package/docs/examples/w-bar_horizontal_one-set_show legned.html +10 -10
  34. package/docs/examples/w-bar_multi-set(color).html +10 -10
  35. package/docs/examples/w-bar_multi-set(color, gradient).html +10 -10
  36. package/docs/examples/w-bar_multi-set(series color).html +10 -10
  37. package/docs/examples/w-bar_multi-set(series color, gradient).html +10 -10
  38. package/docs/examples/w-bar_multi-set.html +10 -10
  39. package/docs/examples/w-bar_multi-set__barDisplay(stackNormal).html +10 -10
  40. package/docs/examples/w-bar_multi-set__barDisplay(stackNormal)_.html +10 -10
  41. package/docs/examples/w-bar_multi-set__barDisplay(stackPercent).html +10 -10
  42. package/docs/examples/w-bar_multi-set__hide legned.html +10 -10
  43. package/docs/examples/w-bar_multi-set__show labels.html +10 -10
  44. package/docs/examples/w-bar_multi-set_barKpColor(gradient).html +10 -10
  45. package/docs/examples/w-bar_multi-set_barKpColor.html +10 -10
  46. package/docs/examples/w-bar_multi-set_barWidthRatio.html +10 -10
  47. package/docs/examples/w-bar_multi-set_barWidthRatio_barGroupWidthRatio_barBorderRadius.html +10 -10
  48. package/docs/examples/w-bar_one-set(color).html +10 -10
  49. package/docs/examples/w-bar_one-set(color, gradient).html +10 -10
  50. package/docs/examples/w-bar_one-set.html +10 -10
  51. package/docs/examples/w-bar_one-set_barColor(gradient).html +10 -10
  52. package/docs/examples/w-bar_one-set_barColor.html +10 -10
  53. package/docs/examples/w-bar_one-set_barKpColor(gradient).html +10 -10
  54. package/docs/examples/w-bar_one-set_barKpColor.html +10 -10
  55. package/docs/examples/w-bar_one-set_barWidthRatio.html +10 -10
  56. package/docs/examples/w-bar_one-set_barWidthRatio_barGroupWidthRatio_barBorderRadius.html +10 -10
  57. package/docs/examples/w-bar_one-set_hide labels.html +10 -10
  58. package/docs/examples/w-bar_one-set_marginLeft_marginRight_marginTop.html +10 -10
  59. package/docs/examples/w-bar_one-set_show legned.html +10 -10
  60. package/docs/examples/w-pie_one-set(color).html +5 -5
  61. package/docs/examples/w-pie_one-set(color, gradient).html +5 -5
  62. package/docs/examples/w-pie_one-set.html +5 -5
  63. package/docs/examples/w-pie_one-set_hide labels.html +5 -5
  64. package/docs/examples/w-pie_one-set_hide legned.html +5 -5
  65. package/docs/examples/w-pie_one-set_marginLeft_marginRight_marginTop.html +5 -5
  66. package/docs/examples/w-pie_one-set_pieBorderRadius.html +5 -5
  67. package/docs/examples/w-pie_one-set_pieBorderWidth_pieBorderRadius.html +5 -5
  68. package/docs/examples/w-pie_one-set_pieKpColor(gradient).html +5 -5
  69. package/docs/examples/w-pie_one-set_pieKpColor.html +5 -5
  70. package/docs/examples/w-pie_one-set_pieThicknessRatio.html +5 -5
  71. package/docs/examples/w-plot_default.html +1 -1
  72. package/docs/examples/w-rose_multi-set(color).html +10 -10
  73. package/docs/examples/w-rose_multi-set(color, gradient).html +10 -10
  74. package/docs/examples/w-rose_multi-set(series color).html +10 -10
  75. package/docs/examples/w-rose_multi-set(series color, gradient).html +10 -10
  76. package/docs/examples/w-rose_multi-set.html +10 -10
  77. package/docs/examples/w-rose_multi-set__hide legned.html +10 -10
  78. package/docs/examples/w-rose_multi-set__show labels.html +10 -10
  79. package/docs/examples/w-rose_multi-set_roseBorderWidth.html +10 -10
  80. package/docs/examples/w-rose_multi-set_roseKpColor(gradient).html +10 -10
  81. package/docs/examples/w-rose_multi-set_roseKpColor.html +10 -10
  82. package/docs/examples/w-rose_multi-set_roseWidthRatio.html +10 -10
  83. package/docs/examples/w-rose_one-set(color).html +10 -10
  84. package/docs/examples/w-rose_one-set(color, gradient).html +10 -10
  85. package/docs/examples/w-rose_one-set.html +10 -10
  86. package/docs/examples/w-rose_one-set_marginLeft_marginRight_marginTop.html +10 -10
  87. package/docs/examples/w-rose_one-set_roseBorderWidth.html +10 -10
  88. package/docs/examples/w-rose_one-set_roseKpColor(gradient).html +10 -10
  89. package/docs/examples/w-rose_one-set_roseKpColor.html +10 -10
  90. package/docs/examples/w-rose_one-set_roseShowLabels.html +10 -10
  91. package/docs/examples/w-rose_one-set_roseWidthRatio.html +10 -10
  92. package/docs/examples/w-rose_one-set_showLegend.html +10 -10
  93. package/docs/examples/w-rose_one-set_showLegend_legendPosition.html +10 -10
  94. package/docs/examples/w-set-multi_default.html +221 -0
  95. package/docs/examples/w-set-multi_hide labels.html +222 -0
  96. package/docs/examples/w-set-multi_hide legned.html +222 -0
  97. package/docs/examples/w-set-multi_keySelect.html +226 -0
  98. package/docs/examples/w-set-multi_slot head.html +225 -0
  99. package/docs/examples/w-set-multi_textPlotType_kpSelectText_widthSelect.html +233 -0
  100. package/docs/examples/w-set-one_default.html +192 -0
  101. package/docs/examples/w-set-one_hide labels.html +193 -0
  102. package/docs/examples/w-set-one_keySelect.html +197 -0
  103. package/docs/examples/w-set-one_show legned.html +193 -0
  104. package/docs/examples/w-set-one_slot head.html +196 -0
  105. package/docs/examples/w-set-one_textPlotType_kpSelectText_widthSelect.html +201 -0
  106. package/docs/getDefAxis.mjs.html +5 -5
  107. package/docs/getDefChart.mjs.html +3 -3
  108. package/docs/getDefLegend.mjs.html +2 -2
  109. package/docs/getDefOpt.mjs.html +2 -2
  110. package/docs/global.html +2 -2
  111. package/docs/index.html +2 -2
  112. package/docs/module-WBar.html +2 -2
  113. package/docs/module-WPie.html +2 -2
  114. package/docs/module-WPlot.html +2 -2
  115. package/docs/module-WRose.html +2 -2
  116. package/docs/module-WSetMulti.html +216 -0
  117. package/docs/module-WSetOne.html +216 -0
  118. package/docs/setLegendLoc.mjs.html +2 -2
  119. package/package.json +1 -1
  120. package/src/App.vue +10 -0
  121. package/src/AppZoneWBar.vue +50 -9
  122. package/src/AppZoneWPie.vue +4 -4
  123. package/src/AppZoneWRose.vue +9 -9
  124. package/src/AppZoneWSetMulti.vue +225 -0
  125. package/src/AppZoneWSetOne.vue +193 -0
  126. package/src/components/WBar.vue +128 -18
  127. package/src/components/WPie.vue +21 -18
  128. package/src/components/{WGeoVue.vue → WPlotVue.vue} +8 -4
  129. package/src/components/WRose.vue +21 -18
  130. package/src/components/WSetMulti.vue +423 -0
  131. package/src/components/WSetOne.vue +57 -0
  132. package/src/js/genBarOpt.mjs +54 -7
  133. package/src/js/genPieOpt.mjs +1 -1
  134. package/src/js/genRoseOpt.mjs +1 -1
  135. package/src/js/getDefAxis.mjs +3 -3
  136. package/src/js/getDefChart.mjs +1 -1
  137. package/toolg/gDistRollupComps.mjs +1 -1
  138. package/toolg/gMergeComps.mjs +4 -4
  139. package/dist/w-geo-vue.umd.js +0 -7
  140. package/dist/w-geo-vue.umd.js.map +0 -1
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <div>
3
+
4
+
5
+ <div class="head1"><span style="cursor:pointer;" title="open for copy link to view component" onclick="window.open('//yuda-lyu.github.io/w-plot-vue/examples/app.html?cmp='+this.innerText,'_blank')">w-set-multi</span></div>
6
+
7
+
8
+ <div style="padding:0px;">
9
+
10
+
11
+ <div class="bk">
12
+ <demolink
13
+ :kbname="'w-set-multi'"
14
+ :casename="'default'"
15
+ ></demolink>
16
+
17
+ <w-set-multi
18
+ :opt="{
19
+ ...WSetMulti.opt2e,
20
+ }"
21
+ ></w-set-multi>
22
+
23
+ </div>
24
+
25
+
26
+ <div class="bk">
27
+ <demolink
28
+ :kbname="'w-set-multi'"
29
+ :casename="'keySelect'"
30
+ ></demolink>
31
+
32
+ <div style="padding-bottom:5px; font-size:0.8rem;">
33
+ keySelect: {{WSetMulti.keySelect}}
34
+ </div>
35
+
36
+ <w-set-multi
37
+ :opt="{
38
+ ...WSetMulti.opt2e,
39
+ }"
40
+ :keySelect.sync="WSetMulti.keySelect"
41
+ ></w-set-multi>
42
+
43
+ </div>
44
+
45
+
46
+ <div class="bk">
47
+ <demolink
48
+ :kbname="'w-set-multi'"
49
+ :casename="'textPlotType & kpSelectText & widthSelect'"
50
+ ></demolink>
51
+
52
+ <w-set-multi
53
+ :opt="{
54
+ ...WSetMulti.opt2e,
55
+ }"
56
+ :textPlotType="'繪圖類型'"
57
+ :kpSelectText="{
58
+ 'bar-v-normal':'垂直直條圖',
59
+ 'bar-v-stack-normal':'垂直堆疊直條圖',
60
+ 'bar-v-stack-percent':'垂直堆疊佔比直條圖',
61
+ 'bar-h-normal':'水平直條圖',
62
+ 'bar-h-normal-dense':'水平直條圖(緊密)',
63
+ 'bar-h-stack-normal':'水平堆疊直條圖',
64
+ 'bar-h-stack-percent':'水平堆疊佔比直條圖',
65
+ 'rose-normal':'玫瑰圖',
66
+ }"
67
+ :widthSelect="170"
68
+ ></w-set-multi>
69
+
70
+ </div>
71
+
72
+
73
+ <div class="bk">
74
+ <demolink
75
+ :kbname="'w-set-multi'"
76
+ :casename="'hide labels'"
77
+ ></demolink>
78
+
79
+ <w-set-multi
80
+ :opt="{
81
+ ...WSetMulti.opt2e,
82
+ showLabels:false,
83
+ }"
84
+ ></w-set-multi>
85
+
86
+ </div>
87
+
88
+
89
+ <div class="bk">
90
+ <demolink
91
+ :kbname="'w-set-multi'"
92
+ :casename="'hide legned'"
93
+ ></demolink>
94
+
95
+ <w-set-multi
96
+ :opt="{
97
+ ...WSetMulti.opt2e,
98
+ showLegend:false,
99
+ }"
100
+ ></w-set-multi>
101
+
102
+ </div>
103
+
104
+
105
+ <div class="bk">
106
+ <demolink
107
+ :kbname="'w-set-multi'"
108
+ :casename="'slot head'"
109
+ ></demolink>
110
+
111
+ <w-set-multi
112
+ :opt="{
113
+ ...WSetMulti.opt2e,
114
+ }"
115
+ >
116
+ <template v-slot:head>
117
+ <div style="padding-right:8px; font-size:1.3rem;">
118
+ 🌿
119
+ </div>
120
+ </template>
121
+ </w-set-multi>
122
+
123
+ </div>
124
+
125
+
126
+ </div>
127
+
128
+
129
+ </div>
130
+ </template>
131
+
132
+ <script>
133
+ import demolink from './components/demolink.vue'
134
+ import WSetMulti from './components/WSetMulti.vue'
135
+
136
+ export default {
137
+ components: {
138
+ demolink,
139
+ WSetMulti,
140
+ },
141
+ props: {
142
+ },
143
+ data: function() {
144
+ let keys = ['USA', 'China', 'Brazil', 'EU', 'India', 'Russia']
145
+ let rds2e = [
146
+ {
147
+ name: 'Corn',
148
+ data: {
149
+ USA: {
150
+ value: 406.292,
151
+ color: ['rgb(255, 205, 210)', 'rgb(229, 115, 115)'],
152
+ },
153
+ China: {
154
+ value: 260.000,
155
+ color: ['rgb(255, 185, 210)', 'rgb(229, 95, 115)'],
156
+ },
157
+ Brazil: {
158
+ value: 107.000,
159
+ color: ['rgb(255, 165, 210)', 'rgb(229, 75, 115)'],
160
+ },
161
+ EU: {
162
+ value: 68.300,
163
+ color: ['rgb(255, 145, 210)', 'rgb(229, 55, 115)'],
164
+ },
165
+ India: {
166
+ value: 27.500,
167
+ color: ['rgb(255, 125, 210)', 'rgb(229, 35, 115)'],
168
+ },
169
+ Russia: {
170
+ value: 14.500,
171
+ color: ['rgb(255, 105, 210)', 'rgb(229, 15, 115)'],
172
+ },
173
+ },
174
+ },
175
+ {
176
+ name: 'Wheat',
177
+ data: {
178
+ USA: {
179
+ value: 51.086,
180
+ color: ['rgb(210, 205, 255)', 'rgb(115, 115, 229)'],
181
+ },
182
+ China: {
183
+ value: 136.000,
184
+ color: ['rgb(210, 185, 255)', 'rgb(115, 95, 229)'],
185
+ },
186
+ Brazil: {
187
+ value: 5.500,
188
+ color: ['rgb(210, 165, 255)', 'rgb(115, 75, 229)'],
189
+ },
190
+ EU: {
191
+ value: 141.000,
192
+ color: ['rgb(210, 145, 255)', 'rgb(115, 55, 229)'],
193
+ },
194
+ India: {
195
+ value: 107.180,
196
+ color: ['rgb(210, 125, 255)', 'rgb(115, 35, 229)'],
197
+ },
198
+ Russia: {
199
+ value: 77.000,
200
+ color: ['rgb(210, 105, 255)', 'rgb(115, 15, 229)'],
201
+ },
202
+ },
203
+ },
204
+ ]
205
+ return {
206
+ 'WSetMulti': {
207
+ 'keySelect': 'bar-v-normal',
208
+ 'opt2e': {
209
+ width: 400,
210
+ height: 400,
211
+ keys,
212
+ rds: rds2e,
213
+ xTitle: 'Countries',
214
+ yTitle: 'Weight (MT)',
215
+ },
216
+ },
217
+ }
218
+ },
219
+ methods: {
220
+ }
221
+ }
222
+ </script>
223
+
224
+ <style scoped>
225
+ </style>
@@ -0,0 +1,193 @@
1
+ <template>
2
+ <div>
3
+
4
+
5
+ <div class="head1"><span style="cursor:pointer;" title="open for copy link to view component" onclick="window.open('//yuda-lyu.github.io/w-plot-vue/examples/app.html?cmp='+this.innerText,'_blank')">w-set-one</span></div>
6
+
7
+
8
+ <div style="padding:0px;">
9
+
10
+
11
+ <div class="bk">
12
+ <demolink
13
+ :kbname="'w-set-one'"
14
+ :casename="'default'"
15
+ ></demolink>
16
+
17
+ <w-set-one
18
+ :opt="{
19
+ ...WSetOne.opt1c,
20
+ }"
21
+ ></w-set-one>
22
+
23
+ </div>
24
+
25
+
26
+ <div class="bk">
27
+ <demolink
28
+ :kbname="'w-set-one'"
29
+ :casename="'keySelect'"
30
+ ></demolink>
31
+
32
+ <div style="padding-bottom:5px; font-size:0.8rem;">
33
+ keySelect: {{WSetOne.keySelect}}
34
+ </div>
35
+
36
+ <w-set-one
37
+ :opt="{
38
+ ...WSetOne.opt1c,
39
+ }"
40
+ :keySelect.sync="WSetOne.keySelect"
41
+ ></w-set-one>
42
+
43
+ </div>
44
+
45
+
46
+ <div class="bk">
47
+ <demolink
48
+ :kbname="'w-set-one'"
49
+ :casename="'textPlotType & kpSelectText & widthSelect'"
50
+ ></demolink>
51
+
52
+ <w-set-one
53
+ :opt="{
54
+ ...WSetOne.opt1c,
55
+ }"
56
+ :textPlotType="'繪圖類型'"
57
+ :kpSelectText="{
58
+ 'bar-v-normal':'垂直直條圖',
59
+ 'bar-h-normal':'水平直條圖',
60
+ 'bar-h-normal-dense':'水平直條圖(緊密)',
61
+ 'pie-normal':'圓餅圖',
62
+ 'rose-normal':'玫瑰圖',
63
+ }"
64
+ :widthSelect="160"
65
+ ></w-set-one>
66
+
67
+ </div>
68
+
69
+
70
+ <div class="bk">
71
+ <demolink
72
+ :kbname="'w-set-one'"
73
+ :casename="'hide labels'"
74
+ ></demolink>
75
+
76
+ <w-set-one
77
+ :opt="{
78
+ ...WSetOne.opt1c,
79
+ showLabels:false,
80
+ }"
81
+ ></w-set-one>
82
+
83
+ </div>
84
+
85
+
86
+ <div class="bk">
87
+ <demolink
88
+ :kbname="'w-set-one'"
89
+ :casename="'show legned'"
90
+ ></demolink>
91
+
92
+ <w-set-one
93
+ :opt="{
94
+ ...WSetOne.opt1c,
95
+ showLegend:true,
96
+ }"
97
+ ></w-set-one>
98
+
99
+ </div>
100
+
101
+
102
+ <div class="bk">
103
+ <demolink
104
+ :kbname="'w-set-one'"
105
+ :casename="'slot head'"
106
+ ></demolink>
107
+
108
+ <w-set-one
109
+ :opt="{
110
+ ...WSetOne.opt1c,
111
+ }"
112
+ >
113
+ <template v-slot:head>
114
+ <div style="padding-right:8px; font-size:1.3rem;">
115
+ 🌿
116
+ </div>
117
+ </template>
118
+ </w-set-one>
119
+
120
+ </div>
121
+
122
+
123
+ </div>
124
+
125
+
126
+ </div>
127
+ </template>
128
+
129
+ <script>
130
+ import demolink from './components/demolink.vue'
131
+ import WSetOne from './components/WSetOne.vue'
132
+
133
+ export default {
134
+ components: {
135
+ demolink,
136
+ WSetOne,
137
+ },
138
+ props: {
139
+ },
140
+ data: function() {
141
+ let keys = ['USA', 'China', 'Brazil', 'EU', 'India', 'Russia']
142
+ let rds1c = [
143
+ {
144
+ name: 'Corn',
145
+ data: {
146
+ USA: {
147
+ value: 406.292,
148
+ color: ['#EF9A9A', '#F44336'],
149
+ },
150
+ China: {
151
+ value: 260.000,
152
+ color: ['#F48FB1', '#E91E63'],
153
+ },
154
+ Brazil: {
155
+ value: 107.000,
156
+ color: ['#CE93D8', '#9C27B0'],
157
+ },
158
+ EU: {
159
+ value: 68.300,
160
+ color: ['#B39DDB', '#673AB7'],
161
+ },
162
+ India: {
163
+ value: 27.500,
164
+ color: ['#9FA8DA', '#3F51B5'],
165
+ },
166
+ Russia: {
167
+ value: 14.500,
168
+ color: ['#90CAF9', '#2196F3'],
169
+ },
170
+ },
171
+ },
172
+ ]
173
+ return {
174
+ 'WSetOne': {
175
+ 'keySelect': 'bar-v-normal',
176
+ 'opt1c': {
177
+ width: 400,
178
+ height: 400,
179
+ keys,
180
+ rds: rds1c,
181
+ xTitle: 'Countries',
182
+ yTitle: 'Weight (MT)',
183
+ },
184
+ },
185
+ }
186
+ },
187
+ methods: {
188
+ }
189
+ }
190
+ </script>
191
+
192
+ <style scoped>
193
+ </style>
@@ -4,18 +4,32 @@
4
4
  v-if="hasOptBar"
5
5
  >
6
6
 
7
- <div :style="`width:${getWidth}px; max-width:${getWidth}px;`">
7
+ <div :style="`width:${picWidth}px; max-width:${picWidth}px;`">
8
8
  <slot
9
9
  name="top"
10
10
  :opt="optBar"
11
11
  ></slot>
12
12
  </div>
13
13
 
14
- <WPlot
15
- :options="optBar"
16
- ></WPlot>
14
+ <div style="position:relative;">
17
15
 
18
- <div :style="`width:${getWidth}px; max-width:${getWidth}px;`">
16
+ <WPlot
17
+ :options="optBar"
18
+ ></WPlot>
19
+
20
+ <template v-if="useInnerLabels">
21
+ <div
22
+ :style="`position:absolute; left:${locLeft}px; top:${tk.y}px; font-family:${hTickLableFontFamily}; font-size:${hTickLableFontSize}; color:${hTickLableColor};`"
23
+ :key="'ktk-'+ktk"
24
+ v-for="(tk,ktk) in hTickLabels"
25
+ >
26
+ {{tk.name}}
27
+ </div>
28
+ </template>
29
+
30
+ </div>
31
+
32
+ <div :style="`width:${picWidth}px; max-width:${picWidth}px;`">
19
33
  <slot
20
34
  name="bottom"
21
35
  :opt="optBar"
@@ -27,7 +41,8 @@
27
41
 
28
42
  <script>
29
43
  import get from 'lodash-es/get'
30
- // import map from 'lodash-es/map'
44
+ import map from 'lodash-es/map'
45
+ import size from 'lodash-es/size'
31
46
  // import cloneDeep from 'lodash-es/cloneDeep'
32
47
  // import isestr from 'wsemi/src/isestr.mjs'
33
48
  import iseobj from 'wsemi/src/iseobj.mjs'
@@ -54,6 +69,24 @@ export default {
54
69
  },
55
70
  computed: {
56
71
 
72
+ picWidth: function() {
73
+ let vo = this
74
+ let w = get(vo, 'opt.width', 0)
75
+ return w
76
+ },
77
+
78
+ picHeight: function() {
79
+ let vo = this
80
+ let w = get(vo, 'opt.height', 0)
81
+ return w
82
+ },
83
+
84
+ ks: function() {
85
+ let vo = this
86
+ let ks = get(vo, 'opt.keys', [])
87
+ return ks
88
+ },
89
+
57
90
  hasOptBar: function() {
58
91
  //console.log('computed hasOptBar')
59
92
 
@@ -71,11 +104,8 @@ export default {
71
104
 
72
105
  let r = null
73
106
  try {
74
- let w = vo.getWidth()
75
- let h = vo.getHeight()
76
- let keys = get(vo, 'opt.keys', [])
77
107
  let rds = get(vo, 'opt.rds', [])
78
- r = genBarOpt(w, h, keys, rds, vo.opt)
108
+ r = genBarOpt(vo.picWidth, vo.picHeight, vo.ks, rds, vo.opt)
79
109
  }
80
110
  catch (err) {
81
111
  console.log(err)
@@ -84,21 +114,101 @@ export default {
84
114
  return r
85
115
  },
86
116
 
87
- },
88
- methods: {
117
+ useInnerLabels: function() {
118
+ let vo = this
119
+ let b1 = get(vo, 'opt.direction', '') === 'horizontal'
120
+ let b2 = get(vo, 'opt.barUseInnerLabelsForHorizontal', false)
121
+ let b = b1 && b2
122
+ return b
123
+ },
89
124
 
90
- getWidth: function() {
125
+ locLeft: function() {
91
126
  let vo = this
92
- let w = get(vo, 'opt.width', 0)
93
- return w
127
+ let r = get(vo, 'optBar.chart.marginLeft', 0)
128
+ return r
94
129
  },
95
130
 
96
- getHeight: function() {
131
+ locTop: function() {
97
132
  let vo = this
98
- let w = get(vo, 'opt.height', 0)
99
- return w
133
+ let r = get(vo, 'optBar.chart.marginTop', 0)
134
+ return r
135
+ },
136
+
137
+ locBottom: function() {
138
+ let vo = this
139
+ let r = get(vo, 'optBar.chart.marginBottom', 0)
140
+ return r
141
+ },
142
+
143
+ hTickLableFontFamily: function() {
144
+ let vo = this
145
+ let r = get(vo, 'optBar.xAxis.labels.style.fontFamily', '')
146
+ return r
147
+ },
148
+
149
+ hTickLableFontSize: function() {
150
+ let vo = this
151
+ let r = get(vo, 'optBar.xAxis.labels.style.fontSize', '')
152
+ return r
153
+ },
154
+
155
+ hTickLableColor: function() {
156
+ let vo = this
157
+ let r = get(vo, 'optBar.xAxis.labels.style.color', '')
158
+ return r
159
+ },
160
+
161
+ hAxisMin: function() {
162
+ let vo = this
163
+ let r = get(vo, 'optBar.xAxis.min', 0)
164
+ return r
100
165
  },
101
166
 
167
+ // hAxisMax: function() {
168
+ // let vo = this
169
+ // let r = get(vo, 'optBar.xAxis.max', 0)
170
+ // return r
171
+ // },
172
+
173
+ hTickLabels: function() {
174
+ let vo = this
175
+
176
+ //h
177
+ let h = vo.picHeight - vo.locTop - vo.locBottom
178
+ h = Math.max(h, 0)
179
+ // console.log('h', h)
180
+
181
+ //n
182
+ let n = size(vo.ks)
183
+ // console.log('n', n)
184
+
185
+ //rng
186
+ let rng = n - vo.hAxisMin
187
+ // console.log('rng', rng)
188
+
189
+ //yd
190
+ let yd = 0
191
+ if (rng > 0) {
192
+ yd = h / rng
193
+ }
194
+ // console.log('yd', yd)
195
+
196
+ //tks
197
+ let tks = map(vo.ks, (v, k) => {
198
+ let y = vo.locTop + yd * (k - vo.hAxisMin)
199
+ return {
200
+ name: v,
201
+ y,
202
+ }
203
+ })
204
+ // console.log('tks', tks)
205
+
206
+ return tks
207
+ },
208
+
209
+ },
210
+ methods: {
211
+
102
212
  }
103
213
  }
104
214
  </script>
@@ -4,7 +4,7 @@
4
4
  v-if="hasOptPie"
5
5
  >
6
6
 
7
- <div :style="`width:${getWidth}px; max-width:${getWidth}px;`">
7
+ <div :style="`width:${picWidth}px; max-width:${picWidth}px;`">
8
8
  <slot
9
9
  name="top"
10
10
  :opt="optPie"
@@ -15,7 +15,7 @@
15
15
  :options="optPie"
16
16
  ></WPlot>
17
17
 
18
- <div :style="`width:${getWidth}px; max-width:${getWidth}px;`">
18
+ <div :style="`width:${picWidth}px; max-width:${picWidth}px;`">
19
19
  <slot
20
20
  name="bottom"
21
21
  :opt="optPie"
@@ -54,6 +54,24 @@ export default {
54
54
  },
55
55
  computed: {
56
56
 
57
+ picWidth: function() {
58
+ let vo = this
59
+ let w = get(vo, 'opt.width', 0)
60
+ return w
61
+ },
62
+
63
+ picHeight: function() {
64
+ let vo = this
65
+ let w = get(vo, 'opt.height', 0)
66
+ return w
67
+ },
68
+
69
+ ks: function() {
70
+ let vo = this
71
+ let ks = get(vo, 'opt.keys', [])
72
+ return ks
73
+ },
74
+
57
75
  hasOptPie: function() {
58
76
  //console.log('computed hasOptPie')
59
77
 
@@ -71,11 +89,8 @@ export default {
71
89
 
72
90
  let r = null
73
91
  try {
74
- let w = vo.getWidth()
75
- let h = vo.getHeight()
76
- let keys = get(vo, 'opt.keys', [])
77
92
  let rds = get(vo, 'opt.rds', [])
78
- r = genPieOpt(w, h, keys, rds, vo.opt)
93
+ r = genPieOpt(vo.picWidth, vo.picHeight, vo.ks, rds, vo.opt)
79
94
  }
80
95
  catch (err) {
81
96
  console.log(err)
@@ -87,18 +102,6 @@ export default {
87
102
  },
88
103
  methods: {
89
104
 
90
- getWidth: function() {
91
- let vo = this
92
- let w = get(vo, 'opt.width', 0)
93
- return w
94
- },
95
-
96
- getHeight: function() {
97
- let vo = this
98
- let w = get(vo, 'opt.height', 0)
99
- return w
100
- },
101
-
102
105
  }
103
106
  }
104
107
  </script>