@opendata-ai/openchart-vanilla 7.1.2 → 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 +40 -59
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/renderers/endpoint-labels.ts +12 -32
- package/src/renderers/legend.ts +31 -37
package/dist/index.js
CHANGED
|
@@ -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
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
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(
|
|
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:
|
|
5829
|
-
cy:
|
|
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
|
|
5836
|
-
const
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
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(
|
|
5849
|
-
|
|
5850
|
-
const
|
|
5851
|
-
const
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
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(
|
|
5845
|
+
entryG.appendChild(rect);
|
|
5865
5846
|
}
|
|
5866
5847
|
const label = createSVGElement2("text");
|
|
5867
5848
|
setAttrs2(label, {
|