intelica-library-ui 0.1.89 → 0.1.91
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.
|
@@ -2525,8 +2525,8 @@ class EchartComponent {
|
|
|
2525
2525
|
config;
|
|
2526
2526
|
id;
|
|
2527
2527
|
containerStyle = {
|
|
2528
|
-
width:
|
|
2529
|
-
height:
|
|
2528
|
+
width: "100%",
|
|
2529
|
+
height: "400px",
|
|
2530
2530
|
};
|
|
2531
2531
|
event = new EventEmitter();
|
|
2532
2532
|
chart;
|
|
@@ -2537,13 +2537,13 @@ class EchartComponent {
|
|
|
2537
2537
|
ngAfterViewInit() {
|
|
2538
2538
|
const chartElement = this.el.nativeElement.querySelector(`#${this.id}_plot`);
|
|
2539
2539
|
if (!this.config) {
|
|
2540
|
-
throw new Error(
|
|
2540
|
+
throw new Error("Chart configuration is not set");
|
|
2541
2541
|
}
|
|
2542
2542
|
if (!isPlatformBrowser(this.platformId)) {
|
|
2543
|
-
throw new Error(
|
|
2543
|
+
throw new Error("Platform is not browser");
|
|
2544
2544
|
}
|
|
2545
2545
|
if (!chartElement) {
|
|
2546
|
-
throw new Error(
|
|
2546
|
+
throw new Error("Plot area not found");
|
|
2547
2547
|
}
|
|
2548
2548
|
this.initChart(chartElement);
|
|
2549
2549
|
}
|
|
@@ -2558,10 +2558,10 @@ class EchartComponent {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
}
|
|
2560
2560
|
initChart(chartElement) {
|
|
2561
|
-
const observer = new ResizeObserver(this.resize);
|
|
2561
|
+
const observer = new ResizeObserver(() => this.resize());
|
|
2562
2562
|
this.chart = echarts.init(chartElement);
|
|
2563
2563
|
this.chart.setOption(this.config);
|
|
2564
|
-
this.chart.on(
|
|
2564
|
+
this.chart.on("click", params => {
|
|
2565
2565
|
this.event.emit(params);
|
|
2566
2566
|
});
|
|
2567
2567
|
observer.observe(chartElement);
|
|
@@ -2571,7 +2571,7 @@ class EchartComponent {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartComponent, decorators: [{
|
|
2573
2573
|
type: Component,
|
|
2574
|
-
args: [{ selector:
|
|
2574
|
+
args: [{ selector: "intelica-echart", imports: [CommonModule], template: "<div [id]=\"id + '_plot'\" class=\"chart\" [ngStyle]=\"containerStyle\"></div>\r\n" }]
|
|
2575
2575
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: Object, decorators: [{
|
|
2576
2576
|
type: Inject,
|
|
2577
2577
|
args: [PLATFORM_ID]
|
|
@@ -3168,15 +3168,6 @@ class EchartService {
|
|
|
3168
3168
|
}
|
|
3169
3169
|
return axisConfiguration;
|
|
3170
3170
|
}
|
|
3171
|
-
getTooltipFormatter(color, title, body) {
|
|
3172
|
-
return `
|
|
3173
|
-
<div style="font-size: 12px; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
|
|
3174
|
-
<b style=" font-size: 13px;">${title} </b><br>
|
|
3175
|
-
<hr style="border: 1px solid ${color}; margin: 4px 0;">
|
|
3176
|
-
${body}
|
|
3177
|
-
</div>
|
|
3178
|
-
`;
|
|
3179
|
-
}
|
|
3180
3171
|
getGridConfiguration() {
|
|
3181
3172
|
return {
|
|
3182
3173
|
left: "0%",
|
|
@@ -3195,8 +3186,33 @@ class EchartService {
|
|
|
3195
3186
|
textStyle: { color: Color.blue, fontSize: 14 },
|
|
3196
3187
|
};
|
|
3197
3188
|
}
|
|
3189
|
+
/**
|
|
3190
|
+
*
|
|
3191
|
+
* @param color - Color of the tooltip
|
|
3192
|
+
* @param title - Title of the tooltip
|
|
3193
|
+
* @param body - Body of the tooltip
|
|
3194
|
+
* @returns - Tooltip HTML string
|
|
3195
|
+
*/
|
|
3196
|
+
getTooltipFormatter(color, title, body) {
|
|
3197
|
+
return `
|
|
3198
|
+
<div style="font-size: 12px; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
|
|
3199
|
+
<b style=" font-size: 13px;">${title} </b><br>
|
|
3200
|
+
<hr style="border: 1px solid ${color}; margin: 4px 0;">
|
|
3201
|
+
${body}
|
|
3202
|
+
</div>
|
|
3203
|
+
`;
|
|
3204
|
+
}
|
|
3198
3205
|
/// Charts Configuration
|
|
3199
3206
|
/// BAR CHARTS
|
|
3207
|
+
/**
|
|
3208
|
+
*
|
|
3209
|
+
* @param categories - Array of categories for the x-axis
|
|
3210
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3211
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3212
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3213
|
+
* @param showLegend - Optional flag to show the legend
|
|
3214
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3215
|
+
*/
|
|
3200
3216
|
getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3201
3217
|
return {
|
|
3202
3218
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
@@ -3229,6 +3245,15 @@ class EchartService {
|
|
|
3229
3245
|
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
3230
3246
|
};
|
|
3231
3247
|
}
|
|
3248
|
+
/**
|
|
3249
|
+
*
|
|
3250
|
+
* @param categories - Array of categories for the x-axis
|
|
3251
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3252
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3253
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3254
|
+
* @param showLegend - Optional flag to show the legend
|
|
3255
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3256
|
+
*/
|
|
3232
3257
|
getBarChartStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3233
3258
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3234
3259
|
barBase.series.forEach((serie, index) => {
|
|
@@ -3242,6 +3267,15 @@ class EchartService {
|
|
|
3242
3267
|
});
|
|
3243
3268
|
return barBase;
|
|
3244
3269
|
}
|
|
3270
|
+
/**
|
|
3271
|
+
*
|
|
3272
|
+
* @param categories - Array of categories for the y-axis
|
|
3273
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3274
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3275
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3276
|
+
* @param showLegend - Optional flag to show the legend
|
|
3277
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3278
|
+
*/
|
|
3245
3279
|
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3246
3280
|
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3247
3281
|
barBase.xAxis = this.getValueAxisConfiguration();
|
|
@@ -3251,8 +3285,23 @@ class EchartService {
|
|
|
3251
3285
|
serie.label.position = "right";
|
|
3252
3286
|
}
|
|
3253
3287
|
});
|
|
3288
|
+
if (barBase.grid) {
|
|
3289
|
+
barBase.grid.left = "10%";
|
|
3290
|
+
barBase.grid.right = "10%";
|
|
3291
|
+
barBase.grid.bottom = "10%";
|
|
3292
|
+
barBase.grid.containLabel = true;
|
|
3293
|
+
}
|
|
3254
3294
|
return barBase;
|
|
3255
3295
|
}
|
|
3296
|
+
/**
|
|
3297
|
+
*
|
|
3298
|
+
* @param categories - Array of categories for the y-axis
|
|
3299
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3300
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3301
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3302
|
+
* @param showLegend - Optional flag to show the legend
|
|
3303
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3304
|
+
*/
|
|
3256
3305
|
getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3257
3306
|
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3258
3307
|
barBase.series.forEach((serie, index) => {
|
|
@@ -3267,13 +3316,26 @@ class EchartService {
|
|
|
3267
3316
|
serie.label = undefined;
|
|
3268
3317
|
}
|
|
3269
3318
|
});
|
|
3319
|
+
if (barBase.grid) {
|
|
3320
|
+
barBase.grid.left = "10%";
|
|
3321
|
+
barBase.grid.right = "10%";
|
|
3322
|
+
barBase.grid.bottom = "10%";
|
|
3323
|
+
barBase.grid.containLabel = true;
|
|
3324
|
+
}
|
|
3270
3325
|
return barBase;
|
|
3271
3326
|
}
|
|
3327
|
+
/**
|
|
3328
|
+
*
|
|
3329
|
+
* @param categories - Array of categories for the y-axis
|
|
3330
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3331
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
3332
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
3333
|
+
* @param showLegend - Optional flag to show the legend
|
|
3334
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
3335
|
+
*/
|
|
3272
3336
|
getBarChartTopOptions(categories, series, categoryWidth = 240, labelConfig, tooltipConfig, showLegend = false) {
|
|
3273
3337
|
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3274
3338
|
if (barBase.yAxis) {
|
|
3275
|
-
// (barBase.yAxis as YAXisComponentOption).show = true;
|
|
3276
|
-
// (barBase.yAxis as YAXisComponentOption).splitLine!.show = true;
|
|
3277
3339
|
barBase.yAxis.inverse = true;
|
|
3278
3340
|
barBase.yAxis.axisLabel.color = Color.blue;
|
|
3279
3341
|
barBase.yAxis.axisLabel.fontSize = 12;
|
|
@@ -3295,6 +3357,15 @@ class EchartService {
|
|
|
3295
3357
|
return barBase;
|
|
3296
3358
|
}
|
|
3297
3359
|
/// LINE CHARTS
|
|
3360
|
+
/**
|
|
3361
|
+
*
|
|
3362
|
+
* @param categories - Array of categories for the x-axis
|
|
3363
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
3364
|
+
* @param labelConfig - Optional label configuration for the lines
|
|
3365
|
+
* @param tooltipConfig - Optional tooltip configuration for the lines
|
|
3366
|
+
* @param showLegend - Optional flag to show the legend
|
|
3367
|
+
* @returns - EChartsOption - Configuration object for the line chart
|
|
3368
|
+
*/
|
|
3298
3369
|
getLineChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3299
3370
|
return {
|
|
3300
3371
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
@@ -3350,6 +3421,13 @@ class EchartService {
|
|
|
3350
3421
|
};
|
|
3351
3422
|
}
|
|
3352
3423
|
/// PIE CHARTS
|
|
3424
|
+
/**
|
|
3425
|
+
*
|
|
3426
|
+
* @param data - Array of series data, each containing name, value, and color
|
|
3427
|
+
* @param labelConfig - Optional label configuration
|
|
3428
|
+
* @param tooltipConfig - Optional tooltip configuration
|
|
3429
|
+
* @returns - EChartsOption - Configuration object for the pie
|
|
3430
|
+
*/
|
|
3353
3431
|
getDoughnutPieOptions(data, labelConfig, tooltipConfig) {
|
|
3354
3432
|
return {
|
|
3355
3433
|
series: [
|
|
@@ -3394,6 +3472,14 @@ class EchartService {
|
|
|
3394
3472
|
},
|
|
3395
3473
|
};
|
|
3396
3474
|
}
|
|
3475
|
+
/**
|
|
3476
|
+
*
|
|
3477
|
+
* @param letter - text to show in the center of the pie
|
|
3478
|
+
* @param value - rate value
|
|
3479
|
+
* @param textSize - size of the letter
|
|
3480
|
+
* @param color - color of the letter and pie
|
|
3481
|
+
* @returns
|
|
3482
|
+
*/
|
|
3397
3483
|
getRateDoughnutPieOptions(letter, value, textSize, color) {
|
|
3398
3484
|
const power = Math.ceil(Math.log10(value));
|
|
3399
3485
|
const placeholderValue = Math.pow(10, power);
|