cats-charts 0.0.72 → 0.0.74
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 +31 -3
- package/fesm2022/cats-charts.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
package/fesm2022/cats-charts.mjs
CHANGED
|
@@ -1385,6 +1385,34 @@ class Charts {
|
|
|
1385
1385
|
</div>
|
|
1386
1386
|
`;
|
|
1387
1387
|
}
|
|
1388
|
+
calculateGridTopLineBar(config) {
|
|
1389
|
+
let maxHeight = 0;
|
|
1390
|
+
const label = config?.series?.[0]?.['label'];
|
|
1391
|
+
if ((config?.showLabel !== true && label?.show !== true) ||
|
|
1392
|
+
(config?.labelPosition !== 'top' && label?.position !== 'top')) {
|
|
1393
|
+
return 0;
|
|
1394
|
+
}
|
|
1395
|
+
const font = [
|
|
1396
|
+
label.fontStyle,
|
|
1397
|
+
label.fontWeight,
|
|
1398
|
+
`${label.fontSize ?? 12}px`,
|
|
1399
|
+
label.fontFamily ?? 'sans-serif',
|
|
1400
|
+
]
|
|
1401
|
+
.filter(Boolean)
|
|
1402
|
+
.join(' ');
|
|
1403
|
+
const text = typeof label.formatter === 'string' ? label.formatter : '0';
|
|
1404
|
+
const rect = echarts.format.getTextRect(text, font);
|
|
1405
|
+
const padding = label.padding ?? 0;
|
|
1406
|
+
const verticalPadding = Array.isArray(padding)
|
|
1407
|
+
? padding.length === 1
|
|
1408
|
+
? padding[0] * 2
|
|
1409
|
+
: padding.length === 2
|
|
1410
|
+
? padding[0] * 2
|
|
1411
|
+
: padding[0] + padding[2]
|
|
1412
|
+
: padding * 2;
|
|
1413
|
+
maxHeight = Math.max(maxHeight, rect.height + verticalPadding);
|
|
1414
|
+
return maxHeight + 6;
|
|
1415
|
+
}
|
|
1388
1416
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: Charts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1389
1417
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: Charts, providedIn: 'root' });
|
|
1390
1418
|
}
|
|
@@ -1523,7 +1551,7 @@ class LinesChart {
|
|
|
1523
1551
|
left: this.config?.gridLeft ?? 0,
|
|
1524
1552
|
right: this.config?.gridRight ?? 0,
|
|
1525
1553
|
bottom: this.config?.gridBottom ?? 0,
|
|
1526
|
-
top: this.config?.gridTop ?? 0,
|
|
1554
|
+
top: this.config?.gridTop ?? this.chartService.calculateGridTopLineBar(this.config) ?? 0,
|
|
1527
1555
|
},
|
|
1528
1556
|
xAxis: {
|
|
1529
1557
|
show: !this.config?.isTrendChart,
|
|
@@ -1731,7 +1759,7 @@ class LinesChart {
|
|
|
1731
1759
|
},
|
|
1732
1760
|
],
|
|
1733
1761
|
},
|
|
1734
|
-
opacity: 0.4,
|
|
1762
|
+
opacity: s.areaOpacity ?? 0.4,
|
|
1735
1763
|
}
|
|
1736
1764
|
: undefined,
|
|
1737
1765
|
...s,
|
|
@@ -2057,7 +2085,7 @@ class BarChart {
|
|
|
2057
2085
|
left: this.config.gridLeft ?? 0,
|
|
2058
2086
|
right: this.config.gridRight ?? 0,
|
|
2059
2087
|
bottom: this.config.gridBottom ?? 0,
|
|
2060
|
-
top: this.config.gridTop ?? 0,
|
|
2088
|
+
top: this.config.gridTop ?? this.chartService.calculateGridTopLineBar(this.config) ?? 0,
|
|
2061
2089
|
},
|
|
2062
2090
|
xAxis: {
|
|
2063
2091
|
type: 'category',
|