cats-charts 0.0.87 → 0.0.88
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/fesm2022/cats-charts.mjs +10 -3
- package/fesm2022/cats-charts.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/fesm2022/cats-charts.mjs
CHANGED
|
@@ -5195,7 +5195,9 @@ class GaugeChart {
|
|
|
5195
5195
|
const midValueCount = Math.max(Math.floor(this.config.midValueCount ?? 0), 0);
|
|
5196
5196
|
const splitNumber = showMidValue && midValueCount > 0 ? midValueCount + 1 : 1;
|
|
5197
5197
|
const metricNameWidth = this.resolveMetricNameWidth();
|
|
5198
|
-
const
|
|
5198
|
+
const metricNameFontSize = this.clamp(style?.metricNameTypography?.fontSize ?? 10, 8, 40);
|
|
5199
|
+
const metricValueFontSize = this.clamp(style?.metricValueTypography?.fontSize ?? 14, 8, 40);
|
|
5200
|
+
const metricName = this.truncateMetricName(this.applyTextCase(this.config.name ?? 'Value', style?.metricNameTypography?.case), metricNameWidth, metricNameFontSize);
|
|
5199
5201
|
const metricValue = this.applyTextCase(this.formatNumber(rawValue, compactNumber, precision), style?.metricValueTypography?.case);
|
|
5200
5202
|
const generatedGaugeSeries = {
|
|
5201
5203
|
type: 'gauge',
|
|
@@ -5302,14 +5304,16 @@ class GaugeChart {
|
|
|
5302
5304
|
overflow: 'truncate',
|
|
5303
5305
|
ellipsis: '...',
|
|
5304
5306
|
align: 'center',
|
|
5305
|
-
|
|
5307
|
+
// Keep each rich-text line tall enough for its current font size.
|
|
5308
|
+
// Fixed line heights make the name and value overlap at large sizes.
|
|
5309
|
+
lineHeight: this.resolveTypographyLineHeight(metricNameFontSize),
|
|
5306
5310
|
},
|
|
5307
5311
|
value: {
|
|
5308
5312
|
...this.resolveTypography(style?.metricValueTypography, {
|
|
5309
5313
|
color: '#252a31',
|
|
5310
5314
|
fontSize: 14,
|
|
5311
5315
|
}),
|
|
5312
|
-
lineHeight:
|
|
5316
|
+
lineHeight: this.resolveTypographyLineHeight(metricValueFontSize),
|
|
5313
5317
|
},
|
|
5314
5318
|
},
|
|
5315
5319
|
},
|
|
@@ -5747,6 +5751,9 @@ class GaugeChart {
|
|
|
5747
5751
|
? `${name.slice(0, Math.max(maximumCharacters - 3, 1))}...`
|
|
5748
5752
|
: name;
|
|
5749
5753
|
}
|
|
5754
|
+
resolveTypographyLineHeight(fontSize) {
|
|
5755
|
+
return Math.ceil(fontSize * 1.3);
|
|
5756
|
+
}
|
|
5750
5757
|
resolveMetricValues() {
|
|
5751
5758
|
return (this.config.data ?? [])
|
|
5752
5759
|
.map((value) => this.toFiniteNumber(value))
|