@juspay/svelte-ui-components 2.100.2 → 2.101.0
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.
|
@@ -641,7 +641,25 @@
|
|
|
641
641
|
right: dims.margin.right,
|
|
642
642
|
bottom: dims.margin.bottom,
|
|
643
643
|
left: dims.margin.left
|
|
644
|
-
}
|
|
644
|
+
},
|
|
645
|
+
bars: bars.map((bar, index) => {
|
|
646
|
+
// barLabels is index-aligned with bars (both derive from the same list);
|
|
647
|
+
// fall back to the bar's top-centre when value labels are hidden.
|
|
648
|
+
const barLabel = barLabels[index];
|
|
649
|
+
return {
|
|
650
|
+
index,
|
|
651
|
+
seriesIndex: bar.si,
|
|
652
|
+
pointIndex: bar.pi,
|
|
653
|
+
x: bar.x,
|
|
654
|
+
y: bar.y,
|
|
655
|
+
width: bar.width,
|
|
656
|
+
height: bar.height,
|
|
657
|
+
value: bar.dataPoint.value,
|
|
658
|
+
label: bar.dataPoint.label ?? '',
|
|
659
|
+
labelX: barLabel ? barLabel.p.x : bar.x + bar.width / 2,
|
|
660
|
+
labelY: barLabel ? barLabel.p.y : bar.y
|
|
661
|
+
};
|
|
662
|
+
})
|
|
645
663
|
});
|
|
646
664
|
|
|
647
665
|
// ── Interactions ───────────────────────────────────────────────
|
|
@@ -47,6 +47,36 @@ export type BarChartSeries = {
|
|
|
47
47
|
/** Series-level fill: plain color, pattern, or gradient. */
|
|
48
48
|
color?: BarFill;
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Geometry for a single rendered bar, in inner (post-margin) coordinates — the
|
|
52
|
+
* same space the overlay `<g>` draws in, so values map 1:1 without re-applying
|
|
53
|
+
* the margin. `labelX`/`labelY` are the value-label anchor when `showValues` is
|
|
54
|
+
* on, otherwise the bar's top-centre.
|
|
55
|
+
*/
|
|
56
|
+
export type BarChartBarPosition = {
|
|
57
|
+
/** Zero-based index in render order. */
|
|
58
|
+
index: number;
|
|
59
|
+
/** Series index (0-based). */
|
|
60
|
+
seriesIndex: number;
|
|
61
|
+
/** Category / point index (0-based). */
|
|
62
|
+
pointIndex: number;
|
|
63
|
+
/** Bar rectangle x (left edge). */
|
|
64
|
+
x: number;
|
|
65
|
+
/** Bar rectangle y (top edge). */
|
|
66
|
+
y: number;
|
|
67
|
+
/** Bar rectangle width. */
|
|
68
|
+
width: number;
|
|
69
|
+
/** Bar rectangle height. */
|
|
70
|
+
height: number;
|
|
71
|
+
/** The datum's numeric value. */
|
|
72
|
+
value: number;
|
|
73
|
+
/** The datum's category label. */
|
|
74
|
+
label: string;
|
|
75
|
+
/** Value-label anchor x. */
|
|
76
|
+
labelX: number;
|
|
77
|
+
/** Value-label anchor y. */
|
|
78
|
+
labelY: number;
|
|
79
|
+
};
|
|
50
80
|
export type BarChartRenderContext = {
|
|
51
81
|
/** Inner drawing width (pixels) */
|
|
52
82
|
innerWidth: number;
|
|
@@ -65,6 +95,12 @@ export type BarChartRenderContext = {
|
|
|
65
95
|
bottom: number;
|
|
66
96
|
left: number;
|
|
67
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Per-bar geometry in render order. Lets an overlay anchor annotations
|
|
100
|
+
* (e.g. an icon above the first funnel step's value) to a specific bar
|
|
101
|
+
* without re-deriving the band scale from innerWidth.
|
|
102
|
+
*/
|
|
103
|
+
bars: BarChartBarPosition[];
|
|
68
104
|
};
|
|
69
105
|
export type BarChartProperties = OptionalBarChartProperties & BarChartEventProperties;
|
|
70
106
|
export type OptionalBarChartProperties = {
|