intelica-library-ui 0.1.186 → 0.1.187
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.
|
@@ -6240,6 +6240,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
6240
6240
|
}]
|
|
6241
6241
|
}] });
|
|
6242
6242
|
|
|
6243
|
+
function darkenColor(input, amount = 0.2) {
|
|
6244
|
+
const clamp = (v) => Math.max(0, Math.min(255, v));
|
|
6245
|
+
const toHex = (v) => v.toString(16).padStart(2, '0');
|
|
6246
|
+
if (input.startsWith('#')) {
|
|
6247
|
+
const r = parseInt(input.slice(1, 3), 16);
|
|
6248
|
+
const g = parseInt(input.slice(3, 5), 16);
|
|
6249
|
+
const b = parseInt(input.slice(5, 7), 16);
|
|
6250
|
+
return `#${toHex(clamp(Math.round(r * (1 - amount))))}${toHex(clamp(Math.round(g * (1 - amount))))}${toHex(clamp(Math.round(b * (1 - amount))))}`;
|
|
6251
|
+
}
|
|
6252
|
+
const m = input.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/i);
|
|
6253
|
+
if (m) {
|
|
6254
|
+
const r = clamp(Math.round(+m[1] * (1 - amount)));
|
|
6255
|
+
const g = clamp(Math.round(+m[2] * (1 - amount)));
|
|
6256
|
+
const b = clamp(Math.round(+m[3] * (1 - amount)));
|
|
6257
|
+
const a = m[4] !== undefined ? `, ${m[4]}` : '';
|
|
6258
|
+
return `rgba(${r}, ${g}, ${b}${a})`;
|
|
6259
|
+
}
|
|
6260
|
+
return input;
|
|
6261
|
+
}
|
|
6262
|
+
|
|
6243
6263
|
class EchartService {
|
|
6244
6264
|
_sharedService = inject(SharedService);
|
|
6245
6265
|
/// Chart Generals
|
|
@@ -6393,14 +6413,33 @@ class EchartService {
|
|
|
6393
6413
|
* @param showLegend - Optional flag to show the legend
|
|
6394
6414
|
* @returns - EChartsOption - Configuration object for the bar chart
|
|
6395
6415
|
*/
|
|
6396
|
-
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false
|
|
6416
|
+
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false, enableSelectStyle = false // 👈 nuevo
|
|
6417
|
+
) {
|
|
6397
6418
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
6398
6419
|
barBase.xAxis = this.getValueAxisConfiguration();
|
|
6399
6420
|
barBase.yAxis = this.getCategoryAxisConfiguration(categories);
|
|
6400
|
-
barBase.series.forEach(serie => {
|
|
6421
|
+
barBase.series.forEach((serie, idx) => {
|
|
6401
6422
|
if (serie.label) {
|
|
6402
6423
|
serie.label.position = "right";
|
|
6403
6424
|
}
|
|
6425
|
+
const baseColor = serie.itemStyle?.color ??
|
|
6426
|
+
(series[idx] && series[idx].color) ??
|
|
6427
|
+
'#FF8A00';
|
|
6428
|
+
serie.itemStyle = {
|
|
6429
|
+
...(serie.itemStyle || {}),
|
|
6430
|
+
color: baseColor,
|
|
6431
|
+
borderWidth: 0,
|
|
6432
|
+
};
|
|
6433
|
+
if (enableSelectStyle) {
|
|
6434
|
+
serie.selectedMode = 'single';
|
|
6435
|
+
const selectedColor = darkenColor(String(baseColor), 0.38);
|
|
6436
|
+
serie.select = {
|
|
6437
|
+
itemStyle: {
|
|
6438
|
+
color: selectedColor,
|
|
6439
|
+
borderWidth: 0,
|
|
6440
|
+
},
|
|
6441
|
+
};
|
|
6442
|
+
}
|
|
6404
6443
|
});
|
|
6405
6444
|
if (barBase.grid) {
|
|
6406
6445
|
barBase.grid.left = "10%";
|
|
@@ -6451,7 +6490,7 @@ class EchartService {
|
|
|
6451
6490
|
* @returns - EChartsOption - Configuration object for the bar chart
|
|
6452
6491
|
*/
|
|
6453
6492
|
getBarChartTopOptions(categories, series, categoryWidth = 240, labelConfig, tooltipConfig, showLegend = false, categoryFormatter) {
|
|
6454
|
-
const barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
6493
|
+
const barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend, true);
|
|
6455
6494
|
if (barBase.yAxis) {
|
|
6456
6495
|
const y = barBase.yAxis;
|
|
6457
6496
|
const gr = barBase.grid;
|