cats-charts 0.0.96 → 0.0.98
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 +59 -40
- package/fesm2022/cats-charts.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
package/fesm2022/cats-charts.mjs
CHANGED
|
@@ -1046,7 +1046,7 @@ class Charts {
|
|
|
1046
1046
|
color:#434A51;
|
|
1047
1047
|
padding-top: 0.5rem;
|
|
1048
1048
|
">
|
|
1049
|
-
${data[0]}: <b style="color:#111;font-weight:600;">${data[1]}</b>
|
|
1049
|
+
${data[0]}: <b style="color:#111;font-weight:600;">${this.formatTooltipValue(data[1], config?.tooltipCompactValue)}</b>
|
|
1050
1050
|
</div>`;
|
|
1051
1051
|
});
|
|
1052
1052
|
}
|
|
@@ -1085,7 +1085,7 @@ class Charts {
|
|
|
1085
1085
|
font-size: 12px;
|
|
1086
1086
|
color: #434A51;
|
|
1087
1087
|
">
|
|
1088
|
-
${name}: <b style="color:#111; font-weight:600;">${config.valueFormatter ? config.valueFormatter(value) : this.formatTooltipValue(value, config
|
|
1088
|
+
${name}: <b style="color:#111; font-weight:600;">${config.valueFormatter ? config.valueFormatter(value) : this.formatTooltipValue(value, config?.tooltipCompactValue)}</b> ${config.showTooltipPercent ? '(' + percent + '%)' : ''}
|
|
1089
1089
|
</span>
|
|
1090
1090
|
</div>
|
|
1091
1091
|
${extraTooltipDataTemplate}
|
|
@@ -1110,7 +1110,7 @@ class Charts {
|
|
|
1110
1110
|
color:#434A51;
|
|
1111
1111
|
padding-top: 0.5rem;
|
|
1112
1112
|
">
|
|
1113
|
-
${data[0]}: <b style="color:#111;font-weight:600;">${data[1]}</b>
|
|
1113
|
+
${data[0]}: <b style="color:#111;font-weight:600;">${this.formatTooltipValue(data[1], config?.tooltipCompactValue)}</b>
|
|
1114
1114
|
</div>`;
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
@@ -1198,6 +1198,8 @@ class Charts {
|
|
|
1198
1198
|
return `${scaled}${units[unitIndex].suffix}`;
|
|
1199
1199
|
}
|
|
1200
1200
|
formatTooltipValue(value, compact = false) {
|
|
1201
|
+
if (typeof Number(value) !== 'number')
|
|
1202
|
+
return value;
|
|
1201
1203
|
const roundedValue = this.toMaxDecimals(value);
|
|
1202
1204
|
return compact ? this.compactValueFormat(roundedValue) : roundedValue;
|
|
1203
1205
|
}
|
|
@@ -4558,49 +4560,53 @@ class SankeyChart {
|
|
|
4558
4560
|
this.chartInstance.off();
|
|
4559
4561
|
this.bindSankeyDragBounds();
|
|
4560
4562
|
this.events.forEach((eventName) => {
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4563
|
+
if (eventName === 'contextmenu') {
|
|
4564
|
+
this.chartInstance.on(eventName, (params) => {
|
|
4565
|
+
const event = params?.event?.event;
|
|
4566
|
+
if (event) {
|
|
4567
|
+
params.event.event.preventDefault();
|
|
4568
|
+
const container = this.chartInstance.getDom();
|
|
4569
|
+
const rect = container.getBoundingClientRect();
|
|
4570
|
+
this.cardPosition = {
|
|
4571
|
+
x: event.clientX - rect.left,
|
|
4572
|
+
y: event.clientY - rect.top,
|
|
4573
|
+
};
|
|
4574
|
+
this.openCard = true;
|
|
4575
|
+
this.cdr.markForCheck();
|
|
4576
|
+
}
|
|
4573
4577
|
this.chartEvent.emit({
|
|
4574
4578
|
type: eventName,
|
|
4575
4579
|
data: params,
|
|
4576
4580
|
});
|
|
4577
|
-
}
|
|
4578
|
-
|
|
4579
|
-
|
|
4581
|
+
});
|
|
4582
|
+
}
|
|
4583
|
+
else if (eventName === 'click') {
|
|
4584
|
+
this.chartInstance.on('click', (params) => {
|
|
4585
|
+
this.chartEvent.emit({
|
|
4586
|
+
type: 'click',
|
|
4587
|
+
data: params,
|
|
4588
|
+
});
|
|
4589
|
+
});
|
|
4590
|
+
const zr = this.chartInstance.getZr();
|
|
4591
|
+
zr.on('click', (zrEvent) => {
|
|
4592
|
+
if (!zrEvent.target) {
|
|
4593
|
+
const nativeEvent = zrEvent.event;
|
|
4594
|
+
nativeEvent.preventDefault();
|
|
4580
4595
|
this.chartEvent.emit({
|
|
4581
|
-
type: '
|
|
4582
|
-
data:
|
|
4596
|
+
type: 'blur',
|
|
4597
|
+
data: { ...zrEvent, type: 'blur' },
|
|
4583
4598
|
});
|
|
4584
|
-
}
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
nativeEvent.preventDefault();
|
|
4590
|
-
this.chartEvent.emit({
|
|
4591
|
-
type: 'blur',
|
|
4592
|
-
data: { ...zrEvent, type: 'blur' },
|
|
4593
|
-
});
|
|
4594
|
-
}
|
|
4595
|
-
});
|
|
4596
|
-
}
|
|
4597
|
-
else {
|
|
4599
|
+
}
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
else {
|
|
4603
|
+
this.chartInstance.on(eventName, (params) => {
|
|
4598
4604
|
this.chartEvent.emit({
|
|
4599
4605
|
type: eventName,
|
|
4600
4606
|
data: params,
|
|
4601
4607
|
});
|
|
4602
|
-
}
|
|
4603
|
-
}
|
|
4608
|
+
});
|
|
4609
|
+
}
|
|
4604
4610
|
});
|
|
4605
4611
|
}
|
|
4606
4612
|
/**
|
|
@@ -6363,7 +6369,7 @@ class GanttChart {
|
|
|
6363
6369
|
this.isBrowser = isPlatformBrowser(platformId);
|
|
6364
6370
|
}
|
|
6365
6371
|
get deafultColors() {
|
|
6366
|
-
return this.chartService.
|
|
6372
|
+
return this.chartService.defaultLegendColors;
|
|
6367
6373
|
}
|
|
6368
6374
|
get rowHeight() {
|
|
6369
6375
|
const configuredHeight = Number(this.config?.rowHeight ?? DEFAULT_ROW_HEIGHT);
|
|
@@ -6373,6 +6379,12 @@ class GanttChart {
|
|
|
6373
6379
|
const configuredGap = Number(this.config?.xAxisMinLabelGap ?? 100);
|
|
6374
6380
|
return Number.isFinite(configuredGap) ? Math.max(1, configuredGap) : 100;
|
|
6375
6381
|
}
|
|
6382
|
+
get yAxisLabelWidth() {
|
|
6383
|
+
const chartWidth = this.chartContainer?.nativeElement.getBoundingClientRect().width ||
|
|
6384
|
+
this.chartInstance?.getWidth?.() ||
|
|
6385
|
+
360;
|
|
6386
|
+
return Math.max(100, Math.min(240, Math.round(chartWidth * 0.22)));
|
|
6387
|
+
}
|
|
6376
6388
|
getAggregationLabelCount() {
|
|
6377
6389
|
const values = [];
|
|
6378
6390
|
const addTimestamp = (value) => {
|
|
@@ -6446,7 +6458,7 @@ class GanttChart {
|
|
|
6446
6458
|
return weekStart.getTime();
|
|
6447
6459
|
}
|
|
6448
6460
|
resolveSeriesColor(series, index) {
|
|
6449
|
-
const colors = this.config?.colors || this.
|
|
6461
|
+
const colors = this.config?.colors || this.chartService.defaultLegendColors;
|
|
6450
6462
|
return series?.itemStyle?.color ?? colors[index % Math.max(colors.length, 1)] ?? '#64748b';
|
|
6451
6463
|
}
|
|
6452
6464
|
createBarLabel(label, rect) {
|
|
@@ -6576,6 +6588,7 @@ class GanttChart {
|
|
|
6576
6588
|
this.rowIndexMap = new Map(this.visibleRows.map((row, index) => [row.name, index]));
|
|
6577
6589
|
const selected = this.readLegendSelected();
|
|
6578
6590
|
const selectedMode = this.config?.customLegend?.selectionMode === 'exclusive' ? 'single' : true;
|
|
6591
|
+
const yAxisLabelWidth = this.yAxisLabelWidth;
|
|
6579
6592
|
const option = {
|
|
6580
6593
|
animation: false,
|
|
6581
6594
|
backgroundColor: 'transparent',
|
|
@@ -6707,6 +6720,7 @@ class GanttChart {
|
|
|
6707
6720
|
axisLabel: {
|
|
6708
6721
|
show: this.config?.showYAxisLabel ?? true,
|
|
6709
6722
|
color: '#434A51',
|
|
6723
|
+
width: yAxisLabelWidth,
|
|
6710
6724
|
overflow: 'truncate',
|
|
6711
6725
|
align: 'right',
|
|
6712
6726
|
fontSize: 12,
|
|
@@ -7228,7 +7242,8 @@ class GanttChart {
|
|
|
7228
7242
|
refreshAxisNameSpace() {
|
|
7229
7243
|
if (!this.chartInstance)
|
|
7230
7244
|
return;
|
|
7231
|
-
this.
|
|
7245
|
+
const yAxisLabelWidth = this.yAxisLabelWidth;
|
|
7246
|
+
const option = {
|
|
7232
7247
|
xAxis: {
|
|
7233
7248
|
name: this.resolveAxisName(this.config?.xAxisName, 'x'),
|
|
7234
7249
|
nameTextStyle: this.resolveAxisNameTextStyle('x'),
|
|
@@ -7239,7 +7254,11 @@ class GanttChart {
|
|
|
7239
7254
|
nameTextStyle: this.resolveAxisNameTextStyle('y'),
|
|
7240
7255
|
},
|
|
7241
7256
|
],
|
|
7242
|
-
}
|
|
7257
|
+
};
|
|
7258
|
+
if (this.config?.yAxis?.axisLabel?.width == null) {
|
|
7259
|
+
option.yAxis[0].axisLabel = { width: yAxisLabelWidth };
|
|
7260
|
+
}
|
|
7261
|
+
this.chartInstance.setOption(option);
|
|
7243
7262
|
this.scheduleVerticalZoomLayout();
|
|
7244
7263
|
this.scheduleHorizontalZoomLayout();
|
|
7245
7264
|
}
|