jmchart 1.1.78 → 1.1.79

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.
package/example/bar.html CHANGED
@@ -69,7 +69,8 @@
69
69
  style: {
70
70
  // 渐变色
71
71
  color: 'linear-gradient(50% 0 50% 100%, #ccc 0, #000 0.5, #fff 1)',
72
- perWidth: 0.5,
72
+ perWidth: 0.5, // 控制barWidth占比,优先级比barWidth低
73
+ //barWidth: 80,// 优先级最高
73
74
  label: {
74
75
  show: true,
75
76
  offset: 5, // 离柱偏移量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.1.78",
3
+ "version": "1.1.79",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -107,8 +107,15 @@ export default class jmBarSeries extends jmSeries {
107
107
  //计算每个柱子占宽
108
108
  //每项柱子占宽除以柱子个数,默认最大宽度为30
109
109
  const maxWidth = this.xAxis.width / count / this.graph.barSeriesCount;
110
- this.barTotalWidth = (this.xAxis.width / count * (this.style.perWidth||0.4));
111
- this.barWidth = this.barTotalWidth / this.graph.barSeriesCount;
110
+
111
+ if(this.style.barWidth > 0) {
112
+ this.barWidth = Number(this.style.barWidth);
113
+ this.barTotalWidth = this.barWidth * this.graph.barSeriesCount;
114
+ }
115
+ else {
116
+ this.barTotalWidth = (this.xAxis.width / count * (this.style.perWidth||0.4));
117
+ this.barWidth = this.barTotalWidth / this.graph.barSeriesCount;
118
+ }
112
119
 
113
120
  if(this.barWidth > maxWidth) {
114
121
  this.barWidth = maxWidth;