@opendata-ai/openchart-vanilla 7.1.2 → 7.1.4

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.js CHANGED
@@ -5259,7 +5259,7 @@ function renderAnnotations(parent, layout) {
5259
5259
 
5260
5260
  // src/renderers/axes.ts
5261
5261
  import {
5262
- AXIS_TITLE_OFFSET_COMPACT,
5262
+ AXIS_TITLE_GAP,
5263
5263
  estimateTextWidth as estimateTextWidth2,
5264
5264
  getAxisTitleOffset,
5265
5265
  TICK_LABEL_OFFSET
@@ -5474,7 +5474,6 @@ function renderAxis(parent, axis, orientation, layout) {
5474
5474
  transform: `rotate(90, ${titleX}, ${area.y + area.height / 2})`
5475
5475
  });
5476
5476
  } else {
5477
- const AXIS_TITLE_GAP = 8;
5478
5477
  const maxTickLabelWidth = axis.ticks.reduce((max, t) => {
5479
5478
  const w = estimateTextWidth2(
5480
5479
  t.label,
@@ -5484,7 +5483,7 @@ function renderAxis(parent, axis, orientation, layout) {
5484
5483
  return Math.max(max, w);
5485
5484
  }, 0);
5486
5485
  const dynamicOffset = TICK_LABEL_OFFSET + maxTickLabelWidth + AXIS_TITLE_GAP;
5487
- const titleOffset = Math.max(dynamicOffset, AXIS_TITLE_OFFSET_COMPACT);
5486
+ const titleOffset = Math.max(dynamicOffset, getAxisTitleOffset(layout.dimensions.width));
5488
5487
  setAttrs2(axisLabel, {
5489
5488
  x: area.x - titleOffset,
5490
5489
  y: area.y + area.height / 2,
@@ -5703,36 +5702,18 @@ function renderEndpointLabels(parent, layout) {
5703
5702
  entryG.appendChild(leader);
5704
5703
  }
5705
5704
  const rowY = entry.labelY + labelFontSize / 2;
5706
- const chipHeight = Math.max(12, Math.round(ep.swatchSize * 0.85));
5707
- const chipY = rowY - chipHeight / 2;
5708
- const chip = createSVGElement2("rect");
5709
- chip.setAttribute("class", "oc-endpoint-swatch-chip");
5710
- setAttrs2(chip, {
5711
- x: chipX,
5712
- y: chipY,
5713
- width: chipWidth,
5714
- height: chipHeight,
5715
- rx: 3,
5716
- ry: 3,
5717
- fill: ep.swatchChipFill
5718
- });
5719
- entryG.appendChild(chip);
5720
- const barWidth = Math.max(8, chipWidth - 8);
5721
- const barHeight = 3;
5722
- const barX = chipX + (chipWidth - barWidth) / 2;
5723
- const barY = rowY - barHeight / 2;
5724
- const bar = createSVGElement2("rect");
5725
- bar.setAttribute("class", "oc-endpoint-swatch-bar");
5726
- setAttrs2(bar, {
5727
- x: barX,
5728
- y: barY,
5729
- width: barWidth,
5730
- height: barHeight,
5731
- rx: barHeight / 2,
5732
- ry: barHeight / 2,
5733
- fill: entry.color
5705
+ const line = createSVGElement2("line");
5706
+ line.setAttribute("class", "oc-endpoint-swatch-line");
5707
+ setAttrs2(line, {
5708
+ x1: chipX,
5709
+ y1: rowY,
5710
+ x2: chipX + chipWidth,
5711
+ y2: rowY,
5712
+ stroke: entry.color,
5713
+ "stroke-width": 2,
5714
+ "stroke-linecap": "round"
5734
5715
  });
5735
- entryG.appendChild(bar);
5716
+ entryG.appendChild(line);
5736
5717
  const label = createSVGElement2("text");
5737
5718
  label.setAttribute("class", "oc-endpoint-label");
5738
5719
  setAttrs2(label, { x: textX, y: entry.labelY + labelFontSize });
@@ -5822,46 +5803,45 @@ function renderLegend(parent, legend) {
5822
5803
  entryG.setAttribute("opacity", "0.3");
5823
5804
  }
5824
5805
  }
5806
+ const midX = offsetX + legend.swatchSize / 2;
5807
+ const midY = offsetY + legend.swatchSize / 2;
5825
5808
  if (entry.shape === "circle") {
5826
5809
  const circle = createSVGElement2("circle");
5827
5810
  setAttrs2(circle, {
5828
- cx: offsetX + legend.swatchSize / 2,
5829
- cy: offsetY + legend.swatchSize / 2,
5811
+ cx: midX,
5812
+ cy: midY,
5830
5813
  r: legend.swatchSize / 2,
5831
5814
  fill: entry.color
5832
5815
  });
5833
5816
  entryG.appendChild(circle);
5834
- } else {
5835
- const chipHeight = Math.max(12, Math.round(legend.swatchSize * 0.85));
5836
- const chipY = offsetY + legend.swatchSize / 2 - chipHeight / 2;
5837
- const chip = createSVGElement2("rect");
5838
- chip.setAttribute("class", "oc-legend-swatch-chip");
5839
- setAttrs2(chip, {
5840
- x: offsetX,
5841
- y: chipY,
5842
- width: legend.swatchSize,
5843
- height: chipHeight,
5844
- rx: 3,
5845
- ry: 3,
5846
- fill: legend.swatchChipFill
5817
+ } else if (entry.shape === "line") {
5818
+ const lineWidth = legend.swatchSize;
5819
+ const line = createSVGElement2("line");
5820
+ line.setAttribute("class", "oc-legend-swatch-line");
5821
+ setAttrs2(line, {
5822
+ x1: offsetX,
5823
+ y1: midY,
5824
+ x2: offsetX + lineWidth,
5825
+ y2: midY,
5826
+ stroke: entry.color,
5827
+ "stroke-width": 2,
5828
+ "stroke-linecap": "round"
5847
5829
  });
5848
- entryG.appendChild(chip);
5849
- const barWidth = Math.max(8, legend.swatchSize - 8);
5850
- const barHeight = 3;
5851
- const barX = offsetX + (legend.swatchSize - barWidth) / 2;
5852
- const barY = offsetY + legend.swatchSize / 2 - barHeight / 2;
5853
- const bar = createSVGElement2("rect");
5854
- bar.setAttribute("class", "oc-legend-swatch-bar");
5855
- setAttrs2(bar, {
5856
- x: barX,
5857
- y: barY,
5858
- width: barWidth,
5859
- height: barHeight,
5860
- rx: barHeight / 2,
5861
- ry: barHeight / 2,
5830
+ entryG.appendChild(line);
5831
+ } else {
5832
+ const rectSize = Math.round(legend.swatchSize * 0.6);
5833
+ const rect = createSVGElement2("rect");
5834
+ rect.setAttribute("class", "oc-legend-swatch-rect");
5835
+ setAttrs2(rect, {
5836
+ x: offsetX + (legend.swatchSize - rectSize) / 2,
5837
+ y: midY - rectSize / 2,
5838
+ width: rectSize,
5839
+ height: rectSize,
5840
+ rx: 2,
5841
+ ry: 2,
5862
5842
  fill: entry.color
5863
5843
  });
5864
- entryG.appendChild(bar);
5844
+ entryG.appendChild(rect);
5865
5845
  }
5866
5846
  const label = createSVGElement2("text");
5867
5847
  setAttrs2(label, {
@@ -8711,9 +8691,11 @@ function renderTable(layout, container, opts) {
8711
8691
  if (pagination) {
8712
8692
  wrapper.appendChild(pagination);
8713
8693
  }
8694
+ const footerRow = document.createElement("div");
8695
+ footerRow.className = "oc-table-footer-row";
8714
8696
  const footerChrome = renderChromeBlock(layout, "footer");
8715
8697
  if (footerChrome) {
8716
- wrapper.appendChild(footerChrome);
8698
+ footerRow.appendChild(footerChrome);
8717
8699
  }
8718
8700
  const liveRegion = document.createElement("div");
8719
8701
  liveRegion.className = "oc-table-live-region oc-sr-only";
@@ -8734,7 +8716,6 @@ function renderTable(layout, container, opts) {
8734
8716
  const brandColor = theme ? theme.colors.axis : "#999999";
8735
8717
  const brand = document.createElement("div");
8736
8718
  brand.className = "oc-table-ref";
8737
- brand.style.cssText = "text-align: right; padding: 4px 8px;";
8738
8719
  const brandLink = document.createElement("a");
8739
8720
  brandLink.href = BRAND_URL4;
8740
8721
  brandLink.target = "_blank";
@@ -8742,7 +8723,10 @@ function renderTable(layout, container, opts) {
8742
8723
  brandLink.style.cssText = `font-size: ${BRAND_FONT_SIZE4}px; font-weight: 600; color: ${brandColor}; opacity: 0.55; text-decoration: none; font-family: ${theme ? theme.fonts.family : "sans-serif"};`;
8743
8724
  brandLink.textContent = "tryOpenData.ai";
8744
8725
  brand.appendChild(brandLink);
8745
- wrapper.appendChild(brand);
8726
+ footerRow.appendChild(brand);
8727
+ }
8728
+ if (footerRow.childElementCount > 0) {
8729
+ wrapper.appendChild(footerRow);
8746
8730
  }
8747
8731
  if (opts?.animate && layout.animation?.enabled) {
8748
8732
  const anim = layout.animation;