intelica-library-ui 0.1.81 → 0.1.83
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.
|
@@ -2515,8 +2515,8 @@ class EchartComponent {
|
|
|
2515
2515
|
config;
|
|
2516
2516
|
id;
|
|
2517
2517
|
containerStyle = {
|
|
2518
|
-
width:
|
|
2519
|
-
height:
|
|
2518
|
+
width: '100%',
|
|
2519
|
+
height: '400px',
|
|
2520
2520
|
};
|
|
2521
2521
|
event = new EventEmitter();
|
|
2522
2522
|
chart;
|
|
@@ -2527,13 +2527,13 @@ class EchartComponent {
|
|
|
2527
2527
|
ngAfterViewInit() {
|
|
2528
2528
|
const chartElement = this.el.nativeElement.querySelector(`#${this.id}_plot`);
|
|
2529
2529
|
if (!this.config) {
|
|
2530
|
-
throw new Error(
|
|
2530
|
+
throw new Error('Chart configuration is not set');
|
|
2531
2531
|
}
|
|
2532
2532
|
if (!isPlatformBrowser(this.platformId)) {
|
|
2533
|
-
throw new Error(
|
|
2533
|
+
throw new Error('Platform is not browser');
|
|
2534
2534
|
}
|
|
2535
2535
|
if (!chartElement) {
|
|
2536
|
-
throw new Error(
|
|
2536
|
+
throw new Error('Plot area not found');
|
|
2537
2537
|
}
|
|
2538
2538
|
this.initChart(chartElement);
|
|
2539
2539
|
}
|
|
@@ -2541,18 +2541,22 @@ class EchartComponent {
|
|
|
2541
2541
|
this.chart.setOption(this.config);
|
|
2542
2542
|
}
|
|
2543
2543
|
initChart(chartElement) {
|
|
2544
|
+
const observer = new ResizeObserver(() => {
|
|
2545
|
+
this.chart.resize();
|
|
2546
|
+
});
|
|
2544
2547
|
this.chart = echarts.init(chartElement);
|
|
2545
2548
|
this.chart.setOption(this.config);
|
|
2546
|
-
this.chart.on(
|
|
2549
|
+
this.chart.on('click', (params) => {
|
|
2547
2550
|
this.event.emit(params);
|
|
2548
2551
|
});
|
|
2552
|
+
observer.observe(chartElement);
|
|
2549
2553
|
}
|
|
2550
2554
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartComponent, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
2551
2555
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.1", type: EchartComponent, isStandalone: true, selector: "intelica-echart", inputs: { config: "config", id: "id", containerStyle: "containerStyle" }, outputs: { event: "event" }, ngImport: i0, template: "<div [id]=\"id + '_plot'\" class=\"chart\" [ngStyle]=\"containerStyle\"></div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2552
2556
|
}
|
|
2553
2557
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: EchartComponent, decorators: [{
|
|
2554
2558
|
type: Component,
|
|
2555
|
-
args: [{ selector:
|
|
2559
|
+
args: [{ selector: 'intelica-echart', imports: [CommonModule], template: "<div [id]=\"id + '_plot'\" class=\"chart\" [ngStyle]=\"containerStyle\"></div>\r\n" }]
|
|
2556
2560
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: Object, decorators: [{
|
|
2557
2561
|
type: Inject,
|
|
2558
2562
|
args: [PLATFORM_ID]
|
|
@@ -3178,6 +3182,7 @@ class EchartService {
|
|
|
3178
3182
|
};
|
|
3179
3183
|
}
|
|
3180
3184
|
/// Charts Configuration
|
|
3185
|
+
/// BAR CHARTS
|
|
3181
3186
|
getBarChartOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3182
3187
|
return {
|
|
3183
3188
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
@@ -3250,8 +3255,117 @@ class EchartService {
|
|
|
3250
3255
|
});
|
|
3251
3256
|
return barBase;
|
|
3252
3257
|
}
|
|
3253
|
-
|
|
3254
|
-
|
|
3258
|
+
/// LINE CHARTS
|
|
3259
|
+
getLineChartOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3260
|
+
return {
|
|
3261
|
+
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
3262
|
+
yAxis: this.getValueAxisConfiguration(true, true, true),
|
|
3263
|
+
series: [
|
|
3264
|
+
...series.map((item, seriesIndex) => ({
|
|
3265
|
+
type: 'line',
|
|
3266
|
+
name: item.name,
|
|
3267
|
+
data: item.value,
|
|
3268
|
+
itemStyle: { color: item.color },
|
|
3269
|
+
symbol: 'circle',
|
|
3270
|
+
symbolSize: 14,
|
|
3271
|
+
emphasis: {
|
|
3272
|
+
itemStyle: {
|
|
3273
|
+
color: item.color,
|
|
3274
|
+
borderColor: item.color + '40', // 40 ( hexadecimal ) = .25 ( decimal )
|
|
3275
|
+
borderWidth: 16,
|
|
3276
|
+
},
|
|
3277
|
+
},
|
|
3278
|
+
})),
|
|
3279
|
+
],
|
|
3280
|
+
tooltip: {
|
|
3281
|
+
trigger: 'item',
|
|
3282
|
+
backgroundColor: '#FFFFFF',
|
|
3283
|
+
borderWidth: 2,
|
|
3284
|
+
textStyle: { fontSize: 12 },
|
|
3285
|
+
formatter: tooltipConfig,
|
|
3286
|
+
},
|
|
3287
|
+
dataZoom: [
|
|
3288
|
+
{
|
|
3289
|
+
type: 'inside', // inside | slider
|
|
3290
|
+
show: true,
|
|
3291
|
+
height: 12,
|
|
3292
|
+
bottom: 10,
|
|
3293
|
+
backgroundColor: '#ddd',
|
|
3294
|
+
borderColor: 'transparent',
|
|
3295
|
+
fillerColor: 'rgba(150, 150, 150, 0.5)',
|
|
3296
|
+
handleSize: '80%',
|
|
3297
|
+
handleStyle: {
|
|
3298
|
+
color: '#A0A0A0',
|
|
3299
|
+
borderColor: 'transparent',
|
|
3300
|
+
shadowBlur: 2,
|
|
3301
|
+
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
3302
|
+
},
|
|
3303
|
+
showDataShadow: false,
|
|
3304
|
+
},
|
|
3305
|
+
{
|
|
3306
|
+
type: 'inside',
|
|
3307
|
+
showDataShadow: false,
|
|
3308
|
+
},
|
|
3309
|
+
],
|
|
3310
|
+
legend: this.getLegendConfiguration(),
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
/// PIE CHARTS
|
|
3314
|
+
getDoughnutPieOptions(data, labelConfig, tooltipConfig) {
|
|
3315
|
+
return {
|
|
3316
|
+
series: [
|
|
3317
|
+
{
|
|
3318
|
+
data: data.map((item) => ({
|
|
3319
|
+
...item,
|
|
3320
|
+
itemStyle: { color: item.color },
|
|
3321
|
+
})),
|
|
3322
|
+
name: 'Pie Chart',
|
|
3323
|
+
type: 'pie',
|
|
3324
|
+
radius: ['40%', '70%'],
|
|
3325
|
+
avoidLabelOverlap: false,
|
|
3326
|
+
emphasis: {
|
|
3327
|
+
scale: true,
|
|
3328
|
+
},
|
|
3329
|
+
labelLine: {
|
|
3330
|
+
show: true,
|
|
3331
|
+
length: 15,
|
|
3332
|
+
length2: 20,
|
|
3333
|
+
},
|
|
3334
|
+
label: {
|
|
3335
|
+
show: true,
|
|
3336
|
+
position: 'outside',
|
|
3337
|
+
color: Color.blue,
|
|
3338
|
+
fontSize: 14,
|
|
3339
|
+
formatter: labelConfig,
|
|
3340
|
+
},
|
|
3341
|
+
},
|
|
3342
|
+
],
|
|
3343
|
+
tooltip: {
|
|
3344
|
+
trigger: 'item',
|
|
3345
|
+
formatter: tooltipConfig,
|
|
3346
|
+
// extraCssText: this.chartService.getTooltipCssText(),
|
|
3347
|
+
},
|
|
3348
|
+
legend: {
|
|
3349
|
+
orient: 'horizontal', // 'horizontal | vertical'
|
|
3350
|
+
icon: 'circle',
|
|
3351
|
+
bottom: 5,
|
|
3352
|
+
align: 'auto',
|
|
3353
|
+
itemGap: 20,
|
|
3354
|
+
textStyle: { color: Color.blue, fontSize: 14 },
|
|
3355
|
+
},
|
|
3356
|
+
};
|
|
3357
|
+
}
|
|
3358
|
+
getRateDoughnutPieOptions(letter, value, color) {
|
|
3359
|
+
const power = Math.ceil(Math.log10(value));
|
|
3360
|
+
const placeholderValue = Math.pow(10, power);
|
|
3361
|
+
const data = [
|
|
3362
|
+
{ name: letter, value: value, itemStyle: { color: color } },
|
|
3363
|
+
{
|
|
3364
|
+
name: 'placeholder',
|
|
3365
|
+
value: placeholderValue - value,
|
|
3366
|
+
itemStyle: { color: Color.gray },
|
|
3367
|
+
},
|
|
3368
|
+
];
|
|
3255
3369
|
return {
|
|
3256
3370
|
tooltip: {
|
|
3257
3371
|
trigger: 'none',
|
|
@@ -3270,10 +3384,8 @@ class EchartService {
|
|
|
3270
3384
|
silent: true,
|
|
3271
3385
|
label: {
|
|
3272
3386
|
show: true,
|
|
3273
|
-
formatter:
|
|
3274
|
-
|
|
3275
|
-
},
|
|
3276
|
-
color: rateData.itemStyle.color,
|
|
3387
|
+
formatter: letter,
|
|
3388
|
+
color: color,
|
|
3277
3389
|
fontSize: '40',
|
|
3278
3390
|
position: 'center',
|
|
3279
3391
|
},
|