cats-charts 0.0.96 → 0.0.97

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.
@@ -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.tooltipCompactValue)}</b> ${config.showTooltipPercent ? '(' + percent + '%)' : ''}
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
  }
@@ -6363,7 +6365,7 @@ class GanttChart {
6363
6365
  this.isBrowser = isPlatformBrowser(platformId);
6364
6366
  }
6365
6367
  get deafultColors() {
6366
- return this.chartService.defaultColors;
6368
+ return this.chartService.defaultLegendColors;
6367
6369
  }
6368
6370
  get rowHeight() {
6369
6371
  const configuredHeight = Number(this.config?.rowHeight ?? DEFAULT_ROW_HEIGHT);
@@ -6373,6 +6375,12 @@ class GanttChart {
6373
6375
  const configuredGap = Number(this.config?.xAxisMinLabelGap ?? 100);
6374
6376
  return Number.isFinite(configuredGap) ? Math.max(1, configuredGap) : 100;
6375
6377
  }
6378
+ get yAxisLabelWidth() {
6379
+ const chartWidth = this.chartContainer?.nativeElement.getBoundingClientRect().width ||
6380
+ this.chartInstance?.getWidth?.() ||
6381
+ 360;
6382
+ return Math.max(100, Math.min(240, Math.round(chartWidth * 0.22)));
6383
+ }
6376
6384
  getAggregationLabelCount() {
6377
6385
  const values = [];
6378
6386
  const addTimestamp = (value) => {
@@ -6446,7 +6454,7 @@ class GanttChart {
6446
6454
  return weekStart.getTime();
6447
6455
  }
6448
6456
  resolveSeriesColor(series, index) {
6449
- const colors = this.config?.colors || this.deafultColors;
6457
+ const colors = this.config?.colors || this.chartService.defaultLegendColors;
6450
6458
  return series?.itemStyle?.color ?? colors[index % Math.max(colors.length, 1)] ?? '#64748b';
6451
6459
  }
6452
6460
  createBarLabel(label, rect) {
@@ -6576,6 +6584,7 @@ class GanttChart {
6576
6584
  this.rowIndexMap = new Map(this.visibleRows.map((row, index) => [row.name, index]));
6577
6585
  const selected = this.readLegendSelected();
6578
6586
  const selectedMode = this.config?.customLegend?.selectionMode === 'exclusive' ? 'single' : true;
6587
+ const yAxisLabelWidth = this.yAxisLabelWidth;
6579
6588
  const option = {
6580
6589
  animation: false,
6581
6590
  backgroundColor: 'transparent',
@@ -6707,6 +6716,7 @@ class GanttChart {
6707
6716
  axisLabel: {
6708
6717
  show: this.config?.showYAxisLabel ?? true,
6709
6718
  color: '#434A51',
6719
+ width: yAxisLabelWidth,
6710
6720
  overflow: 'truncate',
6711
6721
  align: 'right',
6712
6722
  fontSize: 12,
@@ -7228,7 +7238,8 @@ class GanttChart {
7228
7238
  refreshAxisNameSpace() {
7229
7239
  if (!this.chartInstance)
7230
7240
  return;
7231
- this.chartInstance.setOption({
7241
+ const yAxisLabelWidth = this.yAxisLabelWidth;
7242
+ const option = {
7232
7243
  xAxis: {
7233
7244
  name: this.resolveAxisName(this.config?.xAxisName, 'x'),
7234
7245
  nameTextStyle: this.resolveAxisNameTextStyle('x'),
@@ -7239,7 +7250,11 @@ class GanttChart {
7239
7250
  nameTextStyle: this.resolveAxisNameTextStyle('y'),
7240
7251
  },
7241
7252
  ],
7242
- });
7253
+ };
7254
+ if (this.config?.yAxis?.axisLabel?.width == null) {
7255
+ option.yAxis[0].axisLabel = { width: yAxisLabelWidth };
7256
+ }
7257
+ this.chartInstance.setOption(option);
7243
7258
  this.scheduleVerticalZoomLayout();
7244
7259
  this.scheduleHorizontalZoomLayout();
7245
7260
  }