intelica-library-ui 0.1.181 → 0.1.182

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.
@@ -6480,26 +6480,33 @@ class EchartService {
6480
6480
  const y = barBase.yAxis;
6481
6481
  const gr = barBase.grid;
6482
6482
  const defaultCategoryFormatter = (value, index) => {
6483
+ const sangriaBase = '\u2008\u2008\u2008\u2008\u2008\u2008\u2009';
6483
6484
  const lineLength = 35;
6485
+ const text = String(value ?? '');
6484
6486
  const prefix = `${index + 1} - `;
6485
- const words = value.split(' ');
6486
- let lines = [];
6487
- let currentLine = '';
6488
- for (const word of words) {
6489
- const testLine = currentLine ? `${currentLine} ${word}` : word;
6490
- if (testLine.length <= lineLength) {
6491
- currentLine = testLine;
6492
- }
6487
+ const digitCount = String(index + 1).length;
6488
+ let extraRepeat = 0;
6489
+ if (digitCount === 2)
6490
+ extraRepeat = 2;
6491
+ else if (digitCount === 3)
6492
+ extraRepeat = 5;
6493
+ const sangria = sangriaBase + '\u2008'.repeat(extraRepeat);
6494
+ const words = text.split(' ');
6495
+ const lines = [];
6496
+ let current = '';
6497
+ for (const w of words) {
6498
+ const test = current ? `${current} ${w}` : w;
6499
+ if (test.length <= lineLength)
6500
+ current = test;
6493
6501
  else {
6494
- lines.push(currentLine);
6495
- currentLine = word;
6502
+ if (current)
6503
+ lines.push(current);
6504
+ current = w;
6496
6505
  }
6497
6506
  }
6498
- if (currentLine)
6499
- lines.push(currentLine);
6500
- return prefix + lines
6501
- .map((line, i) => (i === 0 ? line : `\u2008\u2008\u2008\u2008\u2008\u2008\u2009${line}`))
6502
- .join('\n');
6507
+ if (current)
6508
+ lines.push(current);
6509
+ return prefix + lines.map((ln, i) => (i === 0 ? ln : `${sangria}${ln}`)).join('\n');
6503
6510
  };
6504
6511
  y.inverse = true;
6505
6512
  y.axisLabel = {