jmchart 1.2.17 → 1.2.18

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.
@@ -12891,7 +12891,7 @@ define(['exports'], (function (exports) { 'use strict';
12891
12891
  x: labelX,
12892
12892
  y: labelY
12893
12893
  },
12894
- text: value.toString()
12894
+ text: Number(value.toFixed(2)).toString()
12895
12895
  });
12896
12896
  this.addShape(tickLabel);
12897
12897
  }
@@ -12945,6 +12945,10 @@ define(['exports'], (function (exports) { 'use strict';
12945
12945
  * 创建仪表盘值标签
12946
12946
  */
12947
12947
  createGaugeValueLabel(centerX, centerY, radius, value) {
12948
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12949
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12950
+ yValue: value
12951
+ }) : Number(value.toFixed(2)).toString();
12948
12952
  const valueLabel = this.graph.createShape('label', {
12949
12953
  style: {
12950
12954
  fill: this.style.valueColor || '#333',
@@ -12957,7 +12961,7 @@ define(['exports'], (function (exports) { 'use strict';
12957
12961
  x: centerX,
12958
12962
  y: centerY + radius * 0.3
12959
12963
  },
12960
- text: value.toString()
12964
+ text: text
12961
12965
  });
12962
12966
  this.addShape(valueLabel);
12963
12967
  if (this.style.unit) {
@@ -12893,7 +12893,7 @@ class jmGaugeSeries extends jmSeries {
12893
12893
  x: labelX,
12894
12894
  y: labelY
12895
12895
  },
12896
- text: value.toString()
12896
+ text: Number(value.toFixed(2)).toString()
12897
12897
  });
12898
12898
  this.addShape(tickLabel);
12899
12899
  }
@@ -12947,6 +12947,10 @@ class jmGaugeSeries extends jmSeries {
12947
12947
  * 创建仪表盘值标签
12948
12948
  */
12949
12949
  createGaugeValueLabel(centerX, centerY, radius, value) {
12950
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12951
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12952
+ yValue: value
12953
+ }) : Number(value.toFixed(2)).toString();
12950
12954
  const valueLabel = this.graph.createShape('label', {
12951
12955
  style: {
12952
12956
  fill: this.style.valueColor || '#333',
@@ -12959,7 +12963,7 @@ class jmGaugeSeries extends jmSeries {
12959
12963
  x: centerX,
12960
12964
  y: centerY + radius * 0.3
12961
12965
  },
12962
- text: value.toString()
12966
+ text: text
12963
12967
  });
12964
12968
  this.addShape(valueLabel);
12965
12969
  if (this.style.unit) {
@@ -12889,7 +12889,7 @@ class jmGaugeSeries extends jmSeries {
12889
12889
  x: labelX,
12890
12890
  y: labelY
12891
12891
  },
12892
- text: value.toString()
12892
+ text: Number(value.toFixed(2)).toString()
12893
12893
  });
12894
12894
  this.addShape(tickLabel);
12895
12895
  }
@@ -12943,6 +12943,10 @@ class jmGaugeSeries extends jmSeries {
12943
12943
  * 创建仪表盘值标签
12944
12944
  */
12945
12945
  createGaugeValueLabel(centerX, centerY, radius, value) {
12946
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12947
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12948
+ yValue: value
12949
+ }) : Number(value.toFixed(2)).toString();
12946
12950
  const valueLabel = this.graph.createShape('label', {
12947
12951
  style: {
12948
12952
  fill: this.style.valueColor || '#333',
@@ -12955,7 +12959,7 @@ class jmGaugeSeries extends jmSeries {
12955
12959
  x: centerX,
12956
12960
  y: centerY + radius * 0.3
12957
12961
  },
12958
- text: value.toString()
12962
+ text: text
12959
12963
  });
12960
12964
  this.addShape(valueLabel);
12961
12965
  if (this.style.unit) {
@@ -12892,7 +12892,7 @@ var jmChart = (function (exports) {
12892
12892
  x: labelX,
12893
12893
  y: labelY
12894
12894
  },
12895
- text: value.toString()
12895
+ text: Number(value.toFixed(2)).toString()
12896
12896
  });
12897
12897
  this.addShape(tickLabel);
12898
12898
  }
@@ -12946,6 +12946,10 @@ var jmChart = (function (exports) {
12946
12946
  * 创建仪表盘值标签
12947
12947
  */
12948
12948
  createGaugeValueLabel(centerX, centerY, radius, value) {
12949
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12950
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12951
+ yValue: value
12952
+ }) : Number(value.toFixed(2)).toString();
12949
12953
  const valueLabel = this.graph.createShape('label', {
12950
12954
  style: {
12951
12955
  fill: this.style.valueColor || '#333',
@@ -12958,7 +12962,7 @@ var jmChart = (function (exports) {
12958
12962
  x: centerX,
12959
12963
  y: centerY + radius * 0.3
12960
12964
  },
12961
- text: value.toString()
12965
+ text: text
12962
12966
  });
12963
12967
  this.addShape(valueLabel);
12964
12968
  if (this.style.unit) {
@@ -12894,7 +12894,7 @@ System.register([], (function (exports) {
12894
12894
  x: labelX,
12895
12895
  y: labelY
12896
12896
  },
12897
- text: value.toString()
12897
+ text: Number(value.toFixed(2)).toString()
12898
12898
  });
12899
12899
  this.addShape(tickLabel);
12900
12900
  }
@@ -12948,6 +12948,10 @@ System.register([], (function (exports) {
12948
12948
  * 创建仪表盘值标签
12949
12949
  */
12950
12950
  createGaugeValueLabel(centerX, centerY, radius, value) {
12951
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
12952
+ const text = this.option.itemLabelFormat ? this.option.itemLabelFormat.call(this, {
12953
+ yValue: value
12954
+ }) : Number(value.toFixed(2)).toString();
12951
12955
  const valueLabel = this.graph.createShape('label', {
12952
12956
  style: {
12953
12957
  fill: this.style.valueColor || '#333',
@@ -12960,7 +12964,7 @@ System.register([], (function (exports) {
12960
12964
  x: centerX,
12961
12965
  y: centerY + radius * 0.3
12962
12966
  },
12963
- text: value.toString()
12967
+ text: text
12964
12968
  });
12965
12969
  this.addShape(valueLabel);
12966
12970
  if (this.style.unit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.2.17",
3
+ "version": "1.2.18",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -149,7 +149,7 @@ export default class jmGaugeSeries extends jmSeries {
149
149
  zIndex: 4
150
150
  },
151
151
  position: { x: labelX, y: labelY },
152
- text: value.toString()
152
+ text: Number(value.toFixed(2)).toString()
153
153
  });
154
154
 
155
155
  this.addShape(tickLabel);
@@ -198,6 +198,11 @@ export default class jmGaugeSeries extends jmSeries {
198
198
  * 创建仪表盘值标签
199
199
  */
200
200
  createGaugeValueLabel(centerX, centerY, radius, value) {
201
+ // 使用 itemLabelFormat 格式化,如果没有则默认最多保留2位小数
202
+ const text = this.option.itemLabelFormat
203
+ ? this.option.itemLabelFormat.call(this, { yValue: value })
204
+ : Number(value.toFixed(2)).toString();
205
+
201
206
  const valueLabel = this.graph.createShape('label', {
202
207
  style: {
203
208
  fill: this.style.valueColor || '#333',
@@ -207,7 +212,7 @@ export default class jmGaugeSeries extends jmSeries {
207
212
  zIndex: 7
208
213
  },
209
214
  position: { x: centerX, y: centerY + radius * 0.3 },
210
- text: value.toString()
215
+ text: text
211
216
  });
212
217
 
213
218
  this.addShape(valueLabel);