@diagrammo/dgmo 0.8.8 → 0.8.9

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/dist/index.cjs CHANGED
@@ -5355,52 +5355,26 @@ function buildChartCommons(parsed, palette, isDark) {
5355
5355
  fontFamily: FONT_FAMILY
5356
5356
  }
5357
5357
  } : void 0;
5358
- const tooltipTheme = {
5359
- backgroundColor: palette.surface,
5360
- borderColor: palette.border,
5361
- textStyle: { color: palette.text }
5362
- };
5363
5358
  return {
5364
5359
  textColor,
5365
5360
  axisLineColor,
5366
5361
  splitLineColor,
5367
5362
  gridOpacity,
5368
5363
  colors,
5369
- titleConfig,
5370
- tooltipTheme
5364
+ titleConfig
5371
5365
  };
5372
5366
  }
5373
5367
  function buildExtendedChartOption(parsed, palette, isDark) {
5374
5368
  if (parsed.error) {
5375
5369
  return {};
5376
5370
  }
5377
- const {
5378
- textColor,
5379
- axisLineColor,
5380
- gridOpacity,
5381
- colors,
5382
- titleConfig,
5383
- tooltipTheme
5384
- } = buildChartCommons(parsed, palette, isDark);
5371
+ const { textColor, axisLineColor, gridOpacity, colors, titleConfig } = buildChartCommons(parsed, palette, isDark);
5385
5372
  if (parsed.type === "sankey") {
5386
- return buildSankeyOption(
5387
- parsed,
5388
- textColor,
5389
- colors,
5390
- titleConfig,
5391
- tooltipTheme
5392
- );
5373
+ return buildSankeyOption(parsed, textColor, colors, titleConfig);
5393
5374
  }
5394
5375
  if (parsed.type === "chord") {
5395
5376
  const bg = isDark ? palette.surface : palette.bg;
5396
- return buildChordOption(
5397
- parsed,
5398
- textColor,
5399
- colors,
5400
- bg,
5401
- titleConfig,
5402
- tooltipTheme
5403
- );
5377
+ return buildChordOption(parsed, textColor, colors, bg, titleConfig);
5404
5378
  }
5405
5379
  if (parsed.type === "function") {
5406
5380
  return buildFunctionOption(
@@ -5410,8 +5384,7 @@ function buildExtendedChartOption(parsed, palette, isDark) {
5410
5384
  axisLineColor,
5411
5385
  gridOpacity,
5412
5386
  colors,
5413
- titleConfig,
5414
- tooltipTheme
5387
+ titleConfig
5415
5388
  );
5416
5389
  }
5417
5390
  if (parsed.type === "scatter") {
@@ -5424,20 +5397,12 @@ function buildExtendedChartOption(parsed, palette, isDark) {
5424
5397
  gridOpacity,
5425
5398
  colors,
5426
5399
  bg,
5427
- titleConfig,
5428
- tooltipTheme
5400
+ titleConfig
5429
5401
  );
5430
5402
  }
5431
5403
  if (parsed.type === "funnel") {
5432
5404
  const bg = isDark ? palette.surface : palette.bg;
5433
- return buildFunnelOption(
5434
- parsed,
5435
- textColor,
5436
- colors,
5437
- bg,
5438
- titleConfig,
5439
- tooltipTheme
5440
- );
5405
+ return buildFunnelOption(parsed, textColor, colors, bg, titleConfig);
5441
5406
  }
5442
5407
  return buildHeatmapOption(
5443
5408
  parsed,
@@ -5445,11 +5410,10 @@ function buildExtendedChartOption(parsed, palette, isDark) {
5445
5410
  isDark,
5446
5411
  textColor,
5447
5412
  axisLineColor,
5448
- titleConfig,
5449
- tooltipTheme
5413
+ titleConfig
5450
5414
  );
5451
5415
  }
5452
- function buildSankeyOption(parsed, textColor, colors, titleConfig, tooltipTheme) {
5416
+ function buildSankeyOption(parsed, textColor, colors, titleConfig) {
5453
5417
  const nodeSet = /* @__PURE__ */ new Set();
5454
5418
  if (parsed.links) {
5455
5419
  for (const link of parsed.links) {
@@ -5468,17 +5432,15 @@ function buildSankeyOption(parsed, textColor, colors, titleConfig, tooltipTheme)
5468
5432
  title: titleConfig,
5469
5433
  xAxis: { show: false },
5470
5434
  yAxis: { show: false },
5471
- tooltip: {
5472
- show: false,
5473
- ...tooltipTheme
5474
- },
5475
5435
  series: [
5476
5436
  {
5477
5437
  type: "sankey",
5478
5438
  emphasis: {
5479
5439
  focus: "adjacency",
5480
- blurScope: "global"
5440
+ blurScope: "global",
5441
+ itemStyle: { opacity: 1 }
5481
5442
  },
5443
+ blur: BLUR_DIM,
5482
5444
  nodeAlign: "left",
5483
5445
  nodeGap: 12,
5484
5446
  nodeWidth: 20,
@@ -5501,7 +5463,7 @@ function buildSankeyOption(parsed, textColor, colors, titleConfig, tooltipTheme)
5501
5463
  ]
5502
5464
  };
5503
5465
  }
5504
- function buildChordOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme) {
5466
+ function buildChordOption(parsed, textColor, colors, bg, titleConfig) {
5505
5467
  const nodeSet = /* @__PURE__ */ new Set();
5506
5468
  if (parsed.links) {
5507
5469
  for (const link of parsed.links) {
@@ -5535,17 +5497,6 @@ function buildChordOption(parsed, textColor, colors, bg, titleConfig, tooltipThe
5535
5497
  return {
5536
5498
  ...CHART_BASE,
5537
5499
  title: titleConfig,
5538
- tooltip: {
5539
- trigger: "item",
5540
- ...tooltipTheme,
5541
- formatter: (params) => {
5542
- const p = params;
5543
- if (p.data && p.data.source && p.data.target) {
5544
- return `${p.data.source} \u2192 ${p.data.target}: ${p.data.value}`;
5545
- }
5546
- return "";
5547
- }
5548
- },
5549
5500
  xAxis: { show: false },
5550
5501
  yAxis: { show: false },
5551
5502
  series: [
@@ -5604,11 +5555,13 @@ function buildChordOption(parsed, textColor, colors, bg, titleConfig, tooltipThe
5604
5555
  },
5605
5556
  emphasis: {
5606
5557
  focus: "adjacency",
5558
+ itemStyle: { opacity: 1 },
5607
5559
  lineStyle: {
5608
5560
  width: 5,
5609
5561
  opacity: 1
5610
5562
  }
5611
- }
5563
+ },
5564
+ blur: BLUR_DIM
5612
5565
  }
5613
5566
  ]
5614
5567
  };
@@ -5622,7 +5575,7 @@ function evaluateExpression(expr, x) {
5622
5575
  return NaN;
5623
5576
  }
5624
5577
  }
5625
- function buildFunctionOption(parsed, palette, textColor, axisLineColor, gridOpacity, colors, titleConfig, tooltipTheme) {
5578
+ function buildFunctionOption(parsed, palette, textColor, axisLineColor, gridOpacity, colors, titleConfig) {
5626
5579
  const xRange = parsed.xRange ?? { min: -10, max: 10 };
5627
5580
  const samples = 200;
5628
5581
  const step = (xRange.max - xRange.min) / samples;
@@ -5655,19 +5608,13 @@ function buildFunctionOption(parsed, palette, textColor, axisLineColor, gridOpac
5655
5608
  opacity: 0.15
5656
5609
  }
5657
5610
  },
5658
- emphasis: EMPHASIS_SELF
5611
+ emphasis: EMPHASIS_SELF,
5612
+ blur: BLUR_DIM
5659
5613
  };
5660
5614
  });
5661
5615
  return {
5662
5616
  ...CHART_BASE,
5663
5617
  title: titleConfig,
5664
- tooltip: {
5665
- trigger: "axis",
5666
- ...tooltipTheme,
5667
- axisPointer: {
5668
- type: "cross"
5669
- }
5670
- },
5671
5618
  legend: {
5672
5619
  data: (parsed.functions ?? []).map((fn) => fn.name),
5673
5620
  bottom: 10,
@@ -5916,7 +5863,7 @@ function dataToPixel(dataX, dataY, xMin, xMax, yMin, yMax, gridLeftPct, gridRigh
5916
5863
  const py = gridTopPx + (yMax - dataY) / (yMax - yMin) * plotHeight;
5917
5864
  return { px, py };
5918
5865
  }
5919
- function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpacity, colors, bg, titleConfig, tooltipTheme) {
5866
+ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpacity, colors, bg, titleConfig) {
5920
5867
  const points = parsed.scatterPoints ?? [];
5921
5868
  const defaultSize = 15;
5922
5869
  const hasCategories = points.some((p) => p.category !== void 0);
@@ -5932,11 +5879,9 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
5932
5879
  };
5933
5880
  const emphasisConfig = {
5934
5881
  focus: "self",
5935
- itemStyle: {
5936
- shadowBlur: 10,
5937
- shadowColor: "rgba(0, 0, 0, 0.3)"
5938
- }
5882
+ itemStyle: { opacity: 1 }
5939
5883
  };
5884
+ const blurConfig = BLUR_DIM;
5940
5885
  let series;
5941
5886
  if (hasCategories) {
5942
5887
  const categories2 = [
@@ -5967,7 +5912,8 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
5967
5912
  borderWidth: CHART_BORDER_WIDTH
5968
5913
  },
5969
5914
  label: labelConfig,
5970
- emphasis: emphasisConfig
5915
+ emphasis: emphasisConfig,
5916
+ blur: blurConfig
5971
5917
  };
5972
5918
  });
5973
5919
  } else {
@@ -5989,24 +5935,11 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
5989
5935
  type: "scatter",
5990
5936
  data,
5991
5937
  label: labelConfig,
5992
- emphasis: emphasisConfig
5938
+ emphasis: emphasisConfig,
5939
+ blur: blurConfig
5993
5940
  }
5994
5941
  ];
5995
5942
  }
5996
- const tooltip = {
5997
- trigger: "item",
5998
- ...tooltipTheme,
5999
- formatter: (params) => {
6000
- const p = params;
6001
- const xLabel = parsed.xlabel || "x";
6002
- const yLabel = parsed.ylabel || "y";
6003
- let html = `<strong>${p.name}</strong>`;
6004
- if (hasCategories) html += `<br/>${p.seriesName}`;
6005
- html += `<br/>${xLabel}: ${p.value[0]}<br/>${yLabel}: ${p.value[1]}`;
6006
- if (hasSize) html += `<br/>${parsed.sizelabel || "size"}: ${p.value[2]}`;
6007
- return html;
6008
- }
6009
- };
6010
5943
  const xValues = points.map((p) => p.x);
6011
5944
  const yValues = points.map((p) => p.y);
6012
5945
  const xMin = Math.min(...xValues);
@@ -6087,7 +6020,6 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
6087
6020
  ...CHART_BASE,
6088
6021
  title: titleConfig,
6089
6022
  ...legendConfig && { legend: legendConfig },
6090
- tooltip,
6091
6023
  grid: {
6092
6024
  left: `${gridLeft}%`,
6093
6025
  right: `${gridRight}%`,
@@ -6149,7 +6081,7 @@ function buildScatterOption(parsed, palette, textColor, axisLineColor, gridOpaci
6149
6081
  ...graphic && { graphic }
6150
6082
  };
6151
6083
  }
6152
- function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, titleConfig, tooltipTheme) {
6084
+ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, titleConfig) {
6153
6085
  const bg = isDark ? palette.surface : palette.bg;
6154
6086
  const heatmapRows = parsed.heatmapRows ?? [];
6155
6087
  const columns = parsed.columns ?? [];
@@ -6167,16 +6099,6 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
6167
6099
  return {
6168
6100
  ...CHART_BASE,
6169
6101
  title: titleConfig,
6170
- tooltip: {
6171
- trigger: "item",
6172
- ...tooltipTheme,
6173
- formatter: (params) => {
6174
- const p = params;
6175
- const colName = columns[p.data[0]] ?? p.data[0];
6176
- const rowName = rowLabels[p.data[1]] ?? p.data[1];
6177
- return `${rowName} / ${colName}: <strong>${p.data[2]}</strong>`;
6178
- }
6179
- },
6180
6102
  grid: {
6181
6103
  left: "3%",
6182
6104
  right: "10%",
@@ -6246,19 +6168,15 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
6246
6168
  fontWeight: "bold"
6247
6169
  },
6248
6170
  emphasis: {
6249
- ...EMPHASIS_SELF,
6250
- itemStyle: {
6251
- shadowBlur: 10,
6252
- shadowColor: "rgba(0, 0, 0, 0.5)"
6253
- }
6254
- }
6171
+ ...EMPHASIS_SELF
6172
+ },
6173
+ blur: BLUR_DIM
6255
6174
  }
6256
6175
  ]
6257
6176
  };
6258
6177
  }
6259
- function buildFunnelOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme) {
6178
+ function buildFunnelOption(parsed, textColor, colors, bg, titleConfig) {
6260
6179
  const sorted = [...parsed.data].sort((a, b) => b.value - a.value);
6261
- const topValue = sorted.length > 0 ? sorted[0].value : 1;
6262
6180
  const data = sorted.map((d) => {
6263
6181
  const stroke2 = d.color ?? colors[parsed.data.indexOf(d) % colors.length];
6264
6182
  return {
@@ -6293,25 +6211,6 @@ function buildFunnelOption(parsed, textColor, colors, bg, titleConfig, tooltipTh
6293
6211
  title: titleConfig,
6294
6212
  xAxis: { show: false },
6295
6213
  yAxis: { show: false },
6296
- tooltip: {
6297
- trigger: "item",
6298
- ...tooltipTheme,
6299
- formatter: (params) => {
6300
- const p = params;
6301
- const val = p.value;
6302
- const prev = prevValueMap.get(p.name) ?? val;
6303
- const isFirst = p.dataIndex === 0;
6304
- if (isFirst) return "";
6305
- const parts = [];
6306
- const stepDrop = ((1 - val / prev) * 100).toFixed(1);
6307
- parts.push(`Step drop-off: ${stepDrop}%`);
6308
- if (topValue > 0) {
6309
- const totalDrop = ((1 - val / topValue) * 100).toFixed(1);
6310
- parts.push(`Overall drop-off: ${totalDrop}%`);
6311
- }
6312
- return parts.join("<br/>");
6313
- }
6314
- },
6315
6214
  series: [
6316
6215
  {
6317
6216
  type: "funnel",
@@ -6329,11 +6228,9 @@ function buildFunnelOption(parsed, textColor, colors, bg, titleConfig, tooltipTh
6329
6228
  lineStyle: { color: textColor, opacity: 0.3 }
6330
6229
  },
6331
6230
  emphasis: {
6332
- ...EMPHASIS_SELF,
6333
- label: {
6334
- fontSize: 15
6335
- }
6231
+ ...EMPHASIS_SELF
6336
6232
  },
6233
+ blur: BLUR_DIM,
6337
6234
  data
6338
6235
  },
6339
6236
  {
@@ -6427,8 +6324,7 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6427
6324
  splitLineColor,
6428
6325
  gridOpacity,
6429
6326
  colors,
6430
- titleConfig,
6431
- tooltipTheme
6327
+ titleConfig
6432
6328
  } = buildChartCommons(parsed, palette, isDark);
6433
6329
  const bg = isDark ? palette.surface : palette.bg;
6434
6330
  switch (parsed.type) {
@@ -6442,7 +6338,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6442
6338
  colors,
6443
6339
  bg,
6444
6340
  titleConfig,
6445
- tooltipTheme,
6446
6341
  chartWidth
6447
6342
  );
6448
6343
  case "bar-stacked":
@@ -6455,7 +6350,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6455
6350
  colors,
6456
6351
  bg,
6457
6352
  titleConfig,
6458
- tooltipTheme,
6459
6353
  chartWidth
6460
6354
  );
6461
6355
  case "line":
@@ -6468,7 +6362,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6468
6362
  gridOpacity,
6469
6363
  colors,
6470
6364
  titleConfig,
6471
- tooltipTheme,
6472
6365
  chartWidth
6473
6366
  ) : buildLineOption(
6474
6367
  parsed,
@@ -6478,7 +6371,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6478
6371
  splitLineColor,
6479
6372
  gridOpacity,
6480
6373
  titleConfig,
6481
- tooltipTheme,
6482
6374
  chartWidth
6483
6375
  );
6484
6376
  case "area":
@@ -6490,7 +6382,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6490
6382
  splitLineColor,
6491
6383
  gridOpacity,
6492
6384
  titleConfig,
6493
- tooltipTheme,
6494
6385
  chartWidth
6495
6386
  );
6496
6387
  case "pie":
@@ -6500,7 +6391,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6500
6391
  getSegmentColors(palette, parsed.data.length),
6501
6392
  bg,
6502
6393
  titleConfig,
6503
- tooltipTheme,
6504
6394
  false
6505
6395
  );
6506
6396
  case "doughnut":
@@ -6510,7 +6400,6 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6510
6400
  getSegmentColors(palette, parsed.data.length),
6511
6401
  bg,
6512
6402
  titleConfig,
6513
- tooltipTheme,
6514
6403
  true
6515
6404
  );
6516
6405
  case "radar":
@@ -6520,8 +6409,7 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6520
6409
  isDark,
6521
6410
  textColor,
6522
6411
  gridOpacity,
6523
- titleConfig,
6524
- tooltipTheme
6412
+ titleConfig
6525
6413
  );
6526
6414
  case "polar-area":
6527
6415
  return buildPolarAreaOption(
@@ -6529,21 +6417,36 @@ function buildSimpleChartOption(parsed, palette, isDark, chartWidth) {
6529
6417
  textColor,
6530
6418
  getSegmentColors(palette, parsed.data.length),
6531
6419
  bg,
6532
- titleConfig,
6533
- tooltipTheme
6420
+ titleConfig
6534
6421
  );
6535
6422
  }
6536
6423
  }
6537
6424
  function makeChartGrid(options) {
6425
+ const left = options.yLabel ? "12%" : "3%";
6538
6426
  return {
6539
- left: options.yLabel ? "12%" : "3%",
6427
+ left,
6540
6428
  right: "4%",
6541
6429
  bottom: options.hasLegend ? "15%" : options.xLabel ? "10%" : "3%",
6542
6430
  top: options.hasTitle ? "15%" : "5%",
6543
6431
  containLabel: true
6544
6432
  };
6545
6433
  }
6546
- function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, bg, titleConfig, tooltipTheme, chartWidth) {
6434
+ function wrapLabel(text, maxChars) {
6435
+ const words = text.split(" ");
6436
+ const lines = [];
6437
+ let current = "";
6438
+ for (const word of words) {
6439
+ if (current && current.length + 1 + word.length > maxChars) {
6440
+ lines.push(current);
6441
+ current = word;
6442
+ } else {
6443
+ current = current ? current + " " + word : word;
6444
+ }
6445
+ }
6446
+ if (current) lines.push(current);
6447
+ return lines.join("\n");
6448
+ }
6449
+ function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, bg, titleConfig, chartWidth) {
6547
6450
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
6548
6451
  const isHorizontal = parsed.orientation === "horizontal";
6549
6452
  const labels = parsed.data.map((d) => d.label);
@@ -6558,7 +6461,11 @@ function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOp
6558
6461
  }
6559
6462
  };
6560
6463
  });
6561
- const hCatGap = isHorizontal && yLabel ? Math.max(40, Math.max(...labels.map((l) => l.length)) * 8 + 16) : void 0;
6464
+ const catLabels = isHorizontal ? labels.map((l) => wrapLabel(l, 12)) : labels;
6465
+ const maxVisibleLen = Math.max(
6466
+ ...catLabels.map((l) => Math.max(...l.split("\n").map((seg) => seg.length)))
6467
+ );
6468
+ const hCatGap = isHorizontal && yLabel ? Math.max(40, maxVisibleLen * 8 + 16) : void 0;
6562
6469
  const categoryAxis = makeGridAxis(
6563
6470
  "category",
6564
6471
  textColor,
@@ -6566,29 +6473,38 @@ function buildBarOption(parsed, textColor, axisLineColor, splitLineColor, gridOp
6566
6473
  splitLineColor,
6567
6474
  gridOpacity,
6568
6475
  isHorizontal ? yLabel : xLabel,
6569
- labels,
6476
+ catLabels,
6570
6477
  hCatGap,
6571
6478
  !isHorizontal ? chartWidth : void 0
6572
6479
  );
6480
+ const hValueGap = isHorizontal && xLabel ? 40 : void 0;
6573
6481
  const valueAxis = makeGridAxis(
6574
6482
  "value",
6575
6483
  textColor,
6576
6484
  axisLineColor,
6577
6485
  splitLineColor,
6578
6486
  gridOpacity,
6579
- isHorizontal ? xLabel : yLabel
6487
+ isHorizontal ? xLabel : yLabel,
6488
+ void 0,
6489
+ hValueGap
6580
6490
  );
6581
6491
  return {
6582
6492
  ...CHART_BASE,
6583
6493
  title: titleConfig,
6584
- grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
6494
+ grid: makeChartGrid({
6495
+ xLabel,
6496
+ yLabel,
6497
+ hasTitle: !!parsed.title,
6498
+ isHorizontal
6499
+ }),
6585
6500
  xAxis: isHorizontal ? valueAxis : categoryAxis,
6586
- yAxis: isHorizontal ? categoryAxis : valueAxis,
6501
+ yAxis: isHorizontal ? { ...categoryAxis, inverse: true } : valueAxis,
6587
6502
  series: [
6588
6503
  {
6589
6504
  type: "bar",
6590
6505
  data,
6591
- emphasis: EMPHASIS_SELF
6506
+ emphasis: EMPHASIS_SELF,
6507
+ blur: BLUR_DIM
6592
6508
  }
6593
6509
  ]
6594
6510
  };
@@ -6605,7 +6521,7 @@ function buildMarkArea(eras, labels, textColor, defaultColor) {
6605
6521
  if (eras.length === 0) return void 0;
6606
6522
  return {
6607
6523
  silent: false,
6608
- tooltip: { show: true },
6524
+ tooltip: { show: false },
6609
6525
  data: eras.map((era) => {
6610
6526
  const startIdx = labels.indexOf(era.start);
6611
6527
  const endIdx = labels.indexOf(era.end);
@@ -6628,7 +6544,7 @@ function buildMarkArea(eras, labels, textColor, defaultColor) {
6628
6544
  })
6629
6545
  };
6630
6546
  }
6631
- function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth) {
6547
+ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, chartWidth) {
6632
6548
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
6633
6549
  const lineColor = parsed.color ?? parsed.seriesNameColors?.[0] ?? palette.primary;
6634
6550
  const labels = parsed.data.map((d) => d.label);
@@ -6639,11 +6555,6 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
6639
6555
  return {
6640
6556
  ...CHART_BASE,
6641
6557
  title: titleConfig,
6642
- tooltip: {
6643
- trigger: "axis",
6644
- ...tooltipTheme,
6645
- axisPointer: { type: "line" }
6646
- },
6647
6558
  grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
6648
6559
  xAxis: makeGridAxis(
6649
6560
  "category",
@@ -6674,12 +6585,13 @@ function buildLineOption(parsed, palette, textColor, axisLineColor, splitLineCol
6674
6585
  lineStyle: { color: lineColor, width: 3 },
6675
6586
  itemStyle: { color: lineColor },
6676
6587
  emphasis: EMPHASIS_LINE,
6588
+ blur: BLUR_DIM,
6677
6589
  ...markArea && { markArea }
6678
6590
  }
6679
6591
  ]
6680
6592
  };
6681
6593
  }
6682
- function buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, tooltipTheme, chartWidth) {
6594
+ function buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, colors, titleConfig, chartWidth) {
6683
6595
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
6684
6596
  const seriesNames = parsed.seriesNames ?? [];
6685
6597
  const labels = parsed.data.map((d) => d.label);
@@ -6700,17 +6612,13 @@ function buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLi
6700
6612
  lineStyle: { color, width: 3 },
6701
6613
  itemStyle: { color },
6702
6614
  emphasis: EMPHASIS_LINE,
6615
+ blur: BLUR_DIM,
6703
6616
  ...idx === 0 && markArea && { markArea }
6704
6617
  };
6705
6618
  });
6706
6619
  return {
6707
6620
  ...CHART_BASE,
6708
6621
  title: titleConfig,
6709
- tooltip: {
6710
- trigger: "axis",
6711
- ...tooltipTheme,
6712
- axisPointer: { type: "line" }
6713
- },
6714
6622
  legend: {
6715
6623
  data: seriesNames,
6716
6624
  bottom: 10,
@@ -6745,7 +6653,7 @@ function buildMultiLineOption(parsed, palette, textColor, axisLineColor, splitLi
6745
6653
  series
6746
6654
  };
6747
6655
  }
6748
- function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, tooltipTheme, chartWidth) {
6656
+ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineColor, gridOpacity, titleConfig, chartWidth) {
6749
6657
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
6750
6658
  const lineColor = parsed.color ?? parsed.seriesNameColors?.[0] ?? palette.primary;
6751
6659
  const labels = parsed.data.map((d) => d.label);
@@ -6756,11 +6664,6 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
6756
6664
  return {
6757
6665
  ...CHART_BASE,
6758
6666
  title: titleConfig,
6759
- tooltip: {
6760
- trigger: "axis",
6761
- ...tooltipTheme,
6762
- axisPointer: { type: "line" }
6763
- },
6764
6667
  grid: makeChartGrid({ xLabel, yLabel, hasTitle: !!parsed.title }),
6765
6668
  xAxis: makeGridAxis(
6766
6669
  "category",
@@ -6792,6 +6695,7 @@ function buildAreaOption(parsed, palette, textColor, axisLineColor, splitLineCol
6792
6695
  itemStyle: { color: lineColor },
6793
6696
  areaStyle: { opacity: 0.25 },
6794
6697
  emphasis: EMPHASIS_LINE,
6698
+ blur: BLUR_DIM,
6795
6699
  ...markArea && { markArea }
6796
6700
  }
6797
6701
  ]
@@ -6823,7 +6727,7 @@ function pieLabelLayout(parsed) {
6823
6727
  if (maxLen > 18) return { outerRadius: 55, fontSize: 13 };
6824
6728
  return { outerRadius: 70, fontSize: 14 };
6825
6729
  }
6826
- function buildPieOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme, isDoughnut) {
6730
+ function buildPieOption(parsed, textColor, colors, bg, titleConfig, isDoughnut) {
6827
6731
  const HIDE_AXES = { xAxis: { show: false }, yAxis: { show: false } };
6828
6732
  const data = parsed.data.map((d, i) => {
6829
6733
  const stroke2 = d.color ?? colors[i % colors.length];
@@ -6842,10 +6746,6 @@ function buildPieOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme
6842
6746
  ...CHART_BASE,
6843
6747
  ...HIDE_AXES,
6844
6748
  title: titleConfig,
6845
- tooltip: {
6846
- trigger: "item",
6847
- ...tooltipTheme
6848
- },
6849
6749
  series: [
6850
6750
  {
6851
6751
  type: "pie",
@@ -6859,12 +6759,13 @@ function buildPieOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme
6859
6759
  fontSize
6860
6760
  },
6861
6761
  labelLine: { show: true },
6862
- emphasis: EMPHASIS_SELF
6762
+ emphasis: EMPHASIS_SELF,
6763
+ blur: BLUR_DIM
6863
6764
  }
6864
6765
  ]
6865
6766
  };
6866
6767
  }
6867
- function buildRadarOption(parsed, palette, isDark, textColor, gridOpacity, titleConfig, tooltipTheme) {
6768
+ function buildRadarOption(parsed, palette, isDark, textColor, gridOpacity, titleConfig) {
6868
6769
  const bg = isDark ? palette.surface : palette.bg;
6869
6770
  const radarColor = parsed.color ?? parsed.seriesNameColors?.[0] ?? palette.primary;
6870
6771
  const values = parsed.data.map((d) => d.value);
@@ -6878,10 +6779,6 @@ function buildRadarOption(parsed, palette, isDark, textColor, gridOpacity, title
6878
6779
  title: titleConfig,
6879
6780
  xAxis: { show: false },
6880
6781
  yAxis: { show: false },
6881
- tooltip: {
6882
- trigger: "item",
6883
- ...tooltipTheme
6884
- },
6885
6782
  radar: {
6886
6783
  indicator,
6887
6784
  axisName: {
@@ -6918,12 +6815,13 @@ function buildRadarOption(parsed, palette, isDark, textColor, gridOpacity, title
6918
6815
  }
6919
6816
  }
6920
6817
  ],
6921
- emphasis: EMPHASIS_SELF
6818
+ emphasis: EMPHASIS_SELF,
6819
+ blur: BLUR_DIM
6922
6820
  }
6923
6821
  ]
6924
6822
  };
6925
6823
  }
6926
- function buildPolarAreaOption(parsed, textColor, colors, bg, titleConfig, tooltipTheme) {
6824
+ function buildPolarAreaOption(parsed, textColor, colors, bg, titleConfig) {
6927
6825
  const data = parsed.data.map((d, i) => {
6928
6826
  const stroke2 = d.color ?? colors[i % colors.length];
6929
6827
  return {
@@ -6941,10 +6839,6 @@ function buildPolarAreaOption(parsed, textColor, colors, bg, titleConfig, toolti
6941
6839
  title: titleConfig,
6942
6840
  xAxis: { show: false },
6943
6841
  yAxis: { show: false },
6944
- tooltip: {
6945
- trigger: "item",
6946
- ...tooltipTheme
6947
- },
6948
6842
  series: [
6949
6843
  {
6950
6844
  type: "pie",
@@ -6962,12 +6856,13 @@ function buildPolarAreaOption(parsed, textColor, colors, bg, titleConfig, toolti
6962
6856
  fontSize: pieLabelLayout(parsed).fontSize
6963
6857
  },
6964
6858
  labelLine: { show: true },
6965
- emphasis: EMPHASIS_SELF
6859
+ emphasis: EMPHASIS_SELF,
6860
+ blur: BLUR_DIM
6966
6861
  }
6967
6862
  ]
6968
6863
  };
6969
6864
  }
6970
- function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, bg, titleConfig, tooltipTheme, chartWidth) {
6865
+ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor, gridOpacity, colors, bg, titleConfig, chartWidth) {
6971
6866
  const { xLabel, yLabel } = resolveAxisLabels(parsed);
6972
6867
  const isHorizontal = parsed.orientation === "horizontal";
6973
6868
  const seriesNames = parsed.seriesNames ?? [];
@@ -6996,7 +6891,8 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
6996
6891
  fontWeight: "bold",
6997
6892
  fontFamily: FONT_FAMILY
6998
6893
  },
6999
- emphasis: EMPHASIS_SELF
6894
+ emphasis: EMPHASIS_SERIES,
6895
+ blur: BLUR_DIM
7000
6896
  };
7001
6897
  });
7002
6898
  const hCatGap = isHorizontal && yLabel ? Math.max(40, Math.max(...labels.map((l) => l.length)) * 8 + 16) : void 0;
@@ -7037,7 +6933,7 @@ function buildBarStackedOption(parsed, textColor, axisLineColor, splitLineColor,
7037
6933
  hasLegend: true
7038
6934
  }),
7039
6935
  xAxis: isHorizontal ? valueAxis : categoryAxis,
7040
- yAxis: isHorizontal ? categoryAxis : valueAxis,
6936
+ yAxis: isHorizontal ? { ...categoryAxis, inverse: true } : valueAxis,
7041
6937
  series
7042
6938
  };
7043
6939
  }
@@ -7121,7 +7017,7 @@ async function renderExtendedChartForExport(content, theme, palette, options) {
7121
7017
  chart.dispose();
7122
7018
  }
7123
7019
  }
7124
- var echarts, EMPHASIS_SELF, EMPHASIS_LINE, CHART_BASE, CHART_BORDER_WIDTH, VALID_EXTENDED_TYPES, KNOWN_EXTENDED_OPTIONS, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT, STANDARD_CHART_TYPES;
7020
+ var echarts, EMPHASIS_SELF, EMPHASIS_SERIES, BLUR_DIM, EMPHASIS_LINE, CHART_BASE, CHART_BORDER_WIDTH, VALID_EXTENDED_TYPES, KNOWN_EXTENDED_OPTIONS, ECHART_EXPORT_WIDTH, ECHART_EXPORT_HEIGHT, STANDARD_CHART_TYPES;
7125
7021
  var init_echarts = __esm({
7126
7022
  "src/echarts.ts"() {
7127
7023
  "use strict";
@@ -7136,20 +7032,22 @@ var init_echarts = __esm({
7136
7032
  init_colors();
7137
7033
  init_parsing();
7138
7034
  init_chart();
7139
- EMPHASIS_SELF = { focus: "self", blurScope: "global" };
7140
- EMPHASIS_LINE = {
7141
- ...EMPHASIS_SELF,
7142
- scale: 2.5,
7143
- itemStyle: {
7144
- borderWidth: 2,
7145
- borderColor: "#fff",
7146
- shadowBlur: 8,
7147
- shadowColor: "rgba(0,0,0,0.4)"
7148
- }
7035
+ EMPHASIS_SELF = {
7036
+ focus: "self",
7037
+ blurScope: "global",
7038
+ itemStyle: { opacity: 1 }
7039
+ };
7040
+ EMPHASIS_SERIES = {
7041
+ focus: "series",
7042
+ blurScope: "global",
7043
+ itemStyle: { opacity: 1 }
7149
7044
  };
7045
+ BLUR_DIM = { itemStyle: { opacity: 0.15 }, lineStyle: { opacity: 0.15 } };
7046
+ EMPHASIS_LINE = { ...EMPHASIS_SELF };
7150
7047
  CHART_BASE = {
7151
7048
  backgroundColor: "transparent",
7152
- animation: false
7049
+ animation: false,
7050
+ tooltip: { show: false }
7153
7051
  };
7154
7052
  CHART_BORDER_WIDTH = 2;
7155
7053
  VALID_EXTENDED_TYPES = /* @__PURE__ */ new Set([