@opendata-ai/openchart-vanilla 7.1.1 → 7.1.3

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
@@ -5534,8 +5534,8 @@ function renderBrand(parent, layout) {
5534
5534
  const text = createSVGElement2("text");
5535
5535
  setAttrs2(text, {
5536
5536
  x: rightEdge,
5537
- y: chromeY + BRAND_LARGE,
5538
- "dominant-baseline": "alphabetic",
5537
+ y: chromeY,
5538
+ "dominant-baseline": "hanging",
5539
5539
  "font-family": layout.theme.fonts.family,
5540
5540
  "font-size": BRAND_FONT_SIZE2,
5541
5541
  "text-anchor": "end",
@@ -5703,36 +5703,18 @@ function renderEndpointLabels(parent, layout) {
5703
5703
  entryG.appendChild(leader);
5704
5704
  }
5705
5705
  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
5706
+ const line = createSVGElement2("line");
5707
+ line.setAttribute("class", "oc-endpoint-swatch-line");
5708
+ setAttrs2(line, {
5709
+ x1: chipX,
5710
+ y1: rowY,
5711
+ x2: chipX + chipWidth,
5712
+ y2: rowY,
5713
+ stroke: entry.color,
5714
+ "stroke-width": 2,
5715
+ "stroke-linecap": "round"
5734
5716
  });
5735
- entryG.appendChild(bar);
5717
+ entryG.appendChild(line);
5736
5718
  const label = createSVGElement2("text");
5737
5719
  label.setAttribute("class", "oc-endpoint-label");
5738
5720
  setAttrs2(label, { x: textX, y: entry.labelY + labelFontSize });
@@ -5822,46 +5804,45 @@ function renderLegend(parent, legend) {
5822
5804
  entryG.setAttribute("opacity", "0.3");
5823
5805
  }
5824
5806
  }
5807
+ const midX = offsetX + legend.swatchSize / 2;
5808
+ const midY = offsetY + legend.swatchSize / 2;
5825
5809
  if (entry.shape === "circle") {
5826
5810
  const circle = createSVGElement2("circle");
5827
5811
  setAttrs2(circle, {
5828
- cx: offsetX + legend.swatchSize / 2,
5829
- cy: offsetY + legend.swatchSize / 2,
5812
+ cx: midX,
5813
+ cy: midY,
5830
5814
  r: legend.swatchSize / 2,
5831
5815
  fill: entry.color
5832
5816
  });
5833
5817
  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
5818
+ } else if (entry.shape === "line") {
5819
+ const lineWidth = legend.swatchSize;
5820
+ const line = createSVGElement2("line");
5821
+ line.setAttribute("class", "oc-legend-swatch-line");
5822
+ setAttrs2(line, {
5823
+ x1: offsetX,
5824
+ y1: midY,
5825
+ x2: offsetX + lineWidth,
5826
+ y2: midY,
5827
+ stroke: entry.color,
5828
+ "stroke-width": 2,
5829
+ "stroke-linecap": "round"
5847
5830
  });
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,
5831
+ entryG.appendChild(line);
5832
+ } else {
5833
+ const rectSize = Math.round(legend.swatchSize * 0.6);
5834
+ const rect = createSVGElement2("rect");
5835
+ rect.setAttribute("class", "oc-legend-swatch-rect");
5836
+ setAttrs2(rect, {
5837
+ x: offsetX + (legend.swatchSize - rectSize) / 2,
5838
+ y: midY - rectSize / 2,
5839
+ width: rectSize,
5840
+ height: rectSize,
5841
+ rx: 2,
5842
+ ry: 2,
5862
5843
  fill: entry.color
5863
5844
  });
5864
- entryG.appendChild(bar);
5845
+ entryG.appendChild(rect);
5865
5846
  }
5866
5847
  const label = createSVGElement2("text");
5867
5848
  setAttrs2(label, {