intelica-library-ui 0.1.85 → 0.1.87
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.
|
@@ -2548,10 +2548,15 @@ class EchartComponent {
|
|
|
2548
2548
|
refreshChart() {
|
|
2549
2549
|
this.chart.setOption(this.config);
|
|
2550
2550
|
}
|
|
2551
|
+
resize() {
|
|
2552
|
+
if (this.chart) {
|
|
2553
|
+
setTimeout(() => {
|
|
2554
|
+
this.chart.resize();
|
|
2555
|
+
}, 1);
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2551
2558
|
initChart(chartElement) {
|
|
2552
|
-
const observer = new ResizeObserver(
|
|
2553
|
-
this.chart.resize();
|
|
2554
|
-
});
|
|
2559
|
+
const observer = new ResizeObserver(this.resize);
|
|
2555
2560
|
this.chart = echarts.init(chartElement);
|
|
2556
2561
|
this.chart.setOption(this.config);
|
|
2557
2562
|
this.chart.on('click', (params) => {
|
|
@@ -3191,7 +3196,7 @@ class EchartService {
|
|
|
3191
3196
|
}
|
|
3192
3197
|
/// Charts Configuration
|
|
3193
3198
|
/// BAR CHARTS
|
|
3194
|
-
getBarChartOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3199
|
+
getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3195
3200
|
return {
|
|
3196
3201
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
3197
3202
|
yAxis: this.getValueAxisConfiguration(),
|
|
@@ -3220,11 +3225,11 @@ class EchartService {
|
|
|
3220
3225
|
formatter: tooltipConfig,
|
|
3221
3226
|
},
|
|
3222
3227
|
grid: this.getGridConfiguration(),
|
|
3223
|
-
legend: this.getLegendConfiguration(),
|
|
3228
|
+
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
3224
3229
|
};
|
|
3225
3230
|
}
|
|
3226
|
-
getBarChartStackOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3227
|
-
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig);
|
|
3231
|
+
getBarChartStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3232
|
+
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3228
3233
|
barBase.series.forEach((serie, index) => {
|
|
3229
3234
|
serie.barWidth = '50%';
|
|
3230
3235
|
serie.barGap = '0%';
|
|
@@ -3236,8 +3241,8 @@ class EchartService {
|
|
|
3236
3241
|
});
|
|
3237
3242
|
return barBase;
|
|
3238
3243
|
}
|
|
3239
|
-
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3240
|
-
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig);
|
|
3244
|
+
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3245
|
+
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3241
3246
|
barBase.xAxis = this.getValueAxisConfiguration();
|
|
3242
3247
|
barBase.yAxis = this.getCategoryAxisConfiguration(categories);
|
|
3243
3248
|
barBase.series.forEach((serie) => {
|
|
@@ -3247,8 +3252,8 @@ class EchartService {
|
|
|
3247
3252
|
});
|
|
3248
3253
|
return barBase;
|
|
3249
3254
|
}
|
|
3250
|
-
getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3251
|
-
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig);
|
|
3255
|
+
getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3256
|
+
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3252
3257
|
barBase.series.forEach((serie, index) => {
|
|
3253
3258
|
serie.barWidth = '50%';
|
|
3254
3259
|
serie.barGap = '0%';
|
|
@@ -3263,8 +3268,35 @@ class EchartService {
|
|
|
3263
3268
|
});
|
|
3264
3269
|
return barBase;
|
|
3265
3270
|
}
|
|
3271
|
+
getBarChartTopOptions(categories, series, categoryWidth = 240, labelConfig, tooltipConfig, showLegend = false) {
|
|
3272
|
+
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
3273
|
+
if (barBase.yAxis) {
|
|
3274
|
+
// (barBase.yAxis as YAXisComponentOption).show = true;
|
|
3275
|
+
// (barBase.yAxis as YAXisComponentOption).splitLine!.show = true;
|
|
3276
|
+
barBase.yAxis.inverse = true;
|
|
3277
|
+
barBase.yAxis.axisLabel.color = Color.blue;
|
|
3278
|
+
barBase.yAxis.axisLabel.fontSize = 12;
|
|
3279
|
+
barBase.yAxis.axisLabel.width = categoryWidth;
|
|
3280
|
+
barBase.yAxis.axisLabel.overflow = 'break';
|
|
3281
|
+
barBase.yAxis.axisLabel.align = 'left';
|
|
3282
|
+
barBase.yAxis.axisLabel.verticalAlign =
|
|
3283
|
+
'middle';
|
|
3284
|
+
barBase.yAxis.axisLabel.margin =
|
|
3285
|
+
categoryWidth + 30;
|
|
3286
|
+
barBase.yAxis.axisLabel.lineHeight = 16;
|
|
3287
|
+
barBase.grid.top = '0%';
|
|
3288
|
+
barBase.grid.left = -1 * categoryWidth + 60;
|
|
3289
|
+
barBase.grid.right = 20;
|
|
3290
|
+
barBase.grid.bottom = '0%';
|
|
3291
|
+
barBase.grid.containLabel = true;
|
|
3292
|
+
}
|
|
3293
|
+
barBase.series.forEach((serie, index) => {
|
|
3294
|
+
serie.barWidth = '75%';
|
|
3295
|
+
});
|
|
3296
|
+
return barBase;
|
|
3297
|
+
}
|
|
3266
3298
|
/// LINE CHARTS
|
|
3267
|
-
getLineChartOptions(categories, series, labelConfig, tooltipConfig) {
|
|
3299
|
+
getLineChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
3268
3300
|
return {
|
|
3269
3301
|
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
3270
3302
|
yAxis: this.getValueAxisConfiguration(true, true, true),
|
|
@@ -3315,7 +3347,7 @@ class EchartService {
|
|
|
3315
3347
|
showDataShadow: false,
|
|
3316
3348
|
},
|
|
3317
3349
|
],
|
|
3318
|
-
legend: this.getLegendConfiguration(),
|
|
3350
|
+
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
3319
3351
|
};
|
|
3320
3352
|
}
|
|
3321
3353
|
/// PIE CHARTS
|