w-plot-vue 1.0.0 → 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 (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 +224 -20
  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
@@ -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>
@@ -2,17 +2,21 @@
2
2
  import WBar from './WBar.vue'
3
3
  import WPie from './WPie.vue'
4
4
  import WPlot from './WPlot.vue'
5
- import WRose from './WRose.vue'
5
+ import WRose from './WRose.vue'
6
+ import WSetMulti from './WSetMulti.vue'
7
+ import WSetOne from './WSetOne.vue'
6
8
 
7
- let WGeoVue = {
9
+ let WPlotVue = {
8
10
  install: function(Vue) {
9
11
  Vue.component('w-bar', WBar)
10
12
  Vue.component('w-pie', WPie)
11
13
  Vue.component('w-plot', WPlot)
12
- Vue.component('w-rose', WRose)
14
+ Vue.component('w-rose', WRose)
15
+ Vue.component('w-set-multi', WSetMulti)
16
+ Vue.component('w-set-one', WSetOne)
13
17
  }
14
18
  }
15
19
 
16
- export default WGeoVue
20
+ export default WPlotVue
17
21
  </script>
18
22
 
@@ -4,7 +4,7 @@
4
4
  v-if="hasOptRose"
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="optRose"
@@ -15,7 +15,7 @@
15
15
  :options="optRose"
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="optRose"
@@ -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
  hasOptRose: function() {
58
76
  //console.log('computed hasOptRose')
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 = genRoseOpt(w, h, keys, rds, vo.opt)
93
+ r = genRoseOpt(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>