jmchart 1.2.17 → 1.2.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://surl.fit/tools/tools/jmchart",
31
31
  "dependencies": {
32
- "jmgraph": "^3.2.25"
32
+ "jmgraph": "^3.2.27"
33
33
  },
34
34
  "publishConfig": {
35
35
  "registry": "https://registry.npmjs.org/"
@@ -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);