@wick-charts/vue 0.4.1 → 0.5.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.
Files changed (146) hide show
  1. package/README.md +5 -3
  2. package/dist/BarSeries.vue.js +44 -0
  3. package/dist/BarSeries.vue2.js +4 -0
  4. package/dist/CandlestickSeries.vue.js +45 -0
  5. package/dist/CandlestickSeries.vue2.js +4 -0
  6. package/dist/ChartContainer.vue.js +168 -0
  7. package/dist/ChartContainer.vue2.js +4 -0
  8. package/dist/LineSeries.vue.js +44 -0
  9. package/dist/LineSeries.vue2.js +4 -0
  10. package/dist/PieSeries.vue.js +34 -0
  11. package/dist/PieSeries.vue2.js +4 -0
  12. package/dist/composables.js +44 -0
  13. package/dist/context.js +25 -0
  14. package/dist/core/dist/animation/animator.js +72 -0
  15. package/dist/core/dist/animation/config.js +145 -0
  16. package/dist/core/dist/animation/easing.js +4 -0
  17. package/dist/core/dist/animation/scalar-spring.js +57 -0
  18. package/dist/core/dist/animation/spring.js +11 -0
  19. package/dist/core/dist/animation/time.js +19 -0
  20. package/dist/core/dist/animation/viewport-engine.js +174 -0
  21. package/dist/core/dist/animation/visible-range-spring.js +64 -0
  22. package/dist/core/dist/animation/y-range-hermite.js +72 -0
  23. package/dist/core/dist/animation/y-range-snap.js +31 -0
  24. package/dist/core/dist/animation/y-range-spring.js +59 -0
  25. package/dist/core/dist/axis/dom-labels.js +60 -0
  26. package/dist/core/dist/canvas-manager.js +109 -0
  27. package/dist/core/dist/chart/edge-indicators.js +26 -0
  28. package/dist/core/dist/chart/fit-to-data.js +9 -0
  29. package/dist/core/dist/chart/last-value.js +31 -0
  30. package/dist/core/dist/chart/options.js +35 -0
  31. package/dist/core/dist/chart/pan-zoom-math.js +66 -0
  32. package/dist/core/dist/chart/streaming-cadence.js +70 -0
  33. package/dist/core/dist/chart/streaming-target.js +22 -0
  34. package/dist/core/dist/chart/viewport-padding.js +6 -0
  35. package/dist/core/dist/chart/y-target.js +24 -0
  36. package/dist/core/dist/chart.js +1495 -0
  37. package/dist/core/dist/components/crosshair.js +9 -0
  38. package/dist/core/dist/components/edge-indicator.js +36 -0
  39. package/dist/core/dist/components/grid.js +22 -0
  40. package/dist/core/dist/components/marker.js +41 -0
  41. package/dist/core/dist/components/reference-line.js +48 -0
  42. package/dist/core/dist/components/time-region.js +35 -0
  43. package/dist/core/dist/data/decimation.js +54 -0
  44. package/dist/core/dist/data/store.js +76 -0
  45. package/dist/core/dist/data/sync.js +47 -0
  46. package/dist/core/dist/events.js +19 -0
  47. package/dist/core/dist/interactions/handler.js +84 -0
  48. package/dist/core/dist/interactions/pan.js +26 -0
  49. package/dist/core/dist/interactions/zoom.js +21 -0
  50. package/dist/core/dist/navigator/controller.js +374 -0
  51. package/dist/core/dist/navigator/decimate.js +44 -0
  52. package/dist/core/dist/navigator/interactions.js +28 -0
  53. package/dist/core/dist/navigator/render.js +68 -0
  54. package/dist/core/dist/perf/counting-context.js +19 -0
  55. package/dist/core/dist/perf/perf-hud.js +453 -0
  56. package/dist/core/dist/perf/perf-monitor.js +132 -0
  57. package/dist/core/dist/render-scheduler.js +31 -0
  58. package/dist/core/dist/scales/tick-tracker.js +110 -0
  59. package/dist/core/dist/scales/x-scale.js +145 -0
  60. package/dist/core/dist/scales/y-scale.js +156 -0
  61. package/dist/core/dist/series/bar.js +341 -0
  62. package/dist/core/dist/series/base-multi-layer.js +438 -0
  63. package/dist/core/dist/series/candlestick.js +481 -0
  64. package/dist/core/dist/series/definition.js +11 -0
  65. package/dist/core/dist/series/line.js +446 -0
  66. package/dist/core/dist/series/painters/builtins.js +36 -0
  67. package/dist/core/dist/series/painters/canvas-path.js +79 -0
  68. package/dist/core/dist/series/painters/resolve.js +32 -0
  69. package/dist/core/dist/series/pie.js +545 -0
  70. package/dist/core/dist/series/register-builtins.js +11 -0
  71. package/dist/core/dist/series/stack-math.js +17 -0
  72. package/dist/core/dist/snapshots.js +107 -0
  73. package/dist/core/dist/theme/create.js +176 -0
  74. package/dist/core/dist/theme/resolve.js +14 -0
  75. package/dist/core/dist/theme/themes/andromeda.js +33 -0
  76. package/dist/core/dist/theme/themes/ayu-mirage.js +33 -0
  77. package/dist/core/dist/theme/themes/catppuccin.js +33 -0
  78. package/dist/core/dist/theme/themes/dracula.js +35 -0
  79. package/dist/core/dist/theme/themes/github-light.js +34 -0
  80. package/dist/core/dist/theme/themes/gruvbox.js +33 -0
  81. package/dist/core/dist/theme/themes/handwritten.js +101 -0
  82. package/dist/core/dist/theme/themes/high-contrast.js +33 -0
  83. package/dist/core/dist/theme/themes/lavender-mist.js +33 -0
  84. package/dist/core/dist/theme/themes/light-pink.js +34 -0
  85. package/dist/core/dist/theme/themes/material-palenight.js +33 -0
  86. package/dist/core/dist/theme/themes/minimal-light.js +34 -0
  87. package/dist/core/dist/theme/themes/mint-breeze.js +33 -0
  88. package/dist/core/dist/theme/themes/monokai-pro.js +33 -0
  89. package/dist/core/dist/theme/themes/night-owl.js +35 -0
  90. package/dist/core/dist/theme/themes/one-dark-pro.js +33 -0
  91. package/dist/core/dist/theme/themes/panda.js +33 -0
  92. package/dist/core/dist/theme/themes/peach-cream.js +33 -0
  93. package/dist/core/dist/theme/themes/quiet-light.js +37 -0
  94. package/dist/core/dist/theme/themes/rose-pine-dawn.js +33 -0
  95. package/dist/core/dist/theme/themes/sand-dune.js +33 -0
  96. package/dist/core/dist/theme/themes/solarized-light.js +34 -0
  97. package/dist/core/dist/tooltip-position.js +10 -0
  98. package/dist/core/dist/utils/color.js +37 -0
  99. package/dist/core/dist/utils/format.js +29 -0
  100. package/dist/core/dist/utils/math.js +26 -0
  101. package/dist/core/dist/utils/poisoned-data-reporter.js +15 -0
  102. package/dist/core/dist/utils/time.js +41 -0
  103. package/dist/index.d.ts +1096 -63
  104. package/dist/index.js +142 -7754
  105. package/dist/ui/Crosshair.vue.js +53 -0
  106. package/dist/ui/Crosshair.vue2.js +4 -0
  107. package/dist/ui/InfoBar.vue.js +143 -0
  108. package/dist/ui/InfoBar.vue2.js +4 -0
  109. package/dist/ui/Legend.vue.js +212 -0
  110. package/dist/ui/Legend.vue2.js +4 -0
  111. package/dist/ui/Marker.vue.js +47 -0
  112. package/dist/ui/Marker.vue2.js +4 -0
  113. package/dist/ui/Navigator.vue.js +58 -0
  114. package/dist/ui/Navigator.vue2.js +4 -0
  115. package/dist/ui/NumberFlow.vue.js +69 -0
  116. package/dist/ui/NumberFlow.vue2.js +4 -0
  117. package/dist/ui/PieLegend.vue.js +132 -0
  118. package/dist/ui/PieLegend.vue2.js +4 -0
  119. package/dist/ui/PieTooltip.vue.js +135 -0
  120. package/dist/ui/PieTooltip.vue2.js +4 -0
  121. package/dist/ui/ReferenceLine.vue.js +44 -0
  122. package/dist/ui/ReferenceLine.vue2.js +4 -0
  123. package/dist/ui/TimeAxis.vue.js +43 -0
  124. package/dist/ui/TimeAxis.vue2.js +4 -0
  125. package/dist/ui/TimeRegion.vue.js +41 -0
  126. package/dist/ui/TimeRegion.vue2.js +4 -0
  127. package/dist/ui/Title.vue.js +54 -0
  128. package/dist/ui/Title.vue2.js +4 -0
  129. package/dist/ui/Tooltip.vue.js +195 -0
  130. package/dist/ui/Tooltip.vue2.js +4 -0
  131. package/dist/ui/YAxis.vue.js +42 -0
  132. package/dist/ui/YAxis.vue2.js +4 -0
  133. package/dist/ui/YLabel.vue.js +105 -0
  134. package/dist/ui/YLabel.vue2.js +4 -0
  135. package/package.json +2 -2
  136. package/src/BarSeries.vue +12 -13
  137. package/src/CandlestickSeries.vue +17 -6
  138. package/src/LineSeries.vue +12 -13
  139. package/src/PieSeries.vue +2 -1
  140. package/src/composables.ts +12 -2
  141. package/src/index.ts +42 -0
  142. package/src/ui/Crosshair.vue +28 -3
  143. package/src/ui/Legend.vue +1 -2
  144. package/src/ui/Marker.vue +62 -0
  145. package/src/ui/ReferenceLine.vue +58 -0
  146. package/src/ui/TimeRegion.vue +54 -0
@@ -0,0 +1,341 @@
1
+ import { DEFAULT_BAR_SMOOTH as N, DEFAULT_BAR_ENTRY as _ } from "../animation/config.js";
2
+ import { BaseMultiLayerSeries as U } from "./base-multi-layer.js";
3
+ import { resolveBarPainter as X } from "./painters/resolve.js";
4
+ const I = 2, q = {
5
+ // Single fallback resolver; the definition's `create` swaps in `theme.bar.color`.
6
+ colors: ["#26a69a"],
7
+ barWidthRatio: 0.6,
8
+ stacking: "off",
9
+ anchor: "center",
10
+ cornerRadius: I,
11
+ entryMs: _,
12
+ smoothMs: N
13
+ };
14
+ function F(P) {
15
+ return {
16
+ ...P,
17
+ entryMs: P.entryMs === !1 ? 0 : P.entryMs ?? _,
18
+ smoothMs: P.smoothMs === !1 ? 0 : P.smoothMs ?? N
19
+ };
20
+ }
21
+ const G = {
22
+ top: { tl: !0, tr: !0, br: !1, bl: !1 },
23
+ bottom: { tl: !1, tr: !1, br: !0, bl: !0 },
24
+ none: { tl: !1, tr: !1, br: !1, bl: !1 }
25
+ };
26
+ class K extends U {
27
+ kind = "bar";
28
+ /** Resolved drawing context for the in-flight render pass. Set at the top of
29
+ * {@link render}, read by {@link drawAnimatedBar}. */
30
+ #e = null;
31
+ constructor(e, o) {
32
+ super(e), this.options = F({ ...q, ...o });
33
+ }
34
+ updateOptions(e) {
35
+ this.options = F({ ...this.options, ...e });
36
+ }
37
+ isEntryEnabled() {
38
+ return (this.options.entryAnimation ?? "fade-grow") !== "none";
39
+ }
40
+ applyTheme(e, o) {
41
+ const h = this.stores.length === 1, c = e.seriesColors[0] ?? "#26a69a", d = h ? [e.bar?.color ?? c] : e.seriesColors.slice(0, this.stores.length);
42
+ this.updateOptions({ colors: d });
43
+ }
44
+ /** True when `time` is at/after the configured `projectedFrom` forecast cut. */
45
+ isProjectedTime(e) {
46
+ const o = this.options.projectedFrom;
47
+ return o !== void 0 && e >= o;
48
+ }
49
+ /**
50
+ * Shape of the per-bar entrance transform. Centralized so the entrance style
51
+ * is a single switch; new styles like 'slide' drop in here without touching
52
+ * each render path.
53
+ */
54
+ applyBarTransform(e, o) {
55
+ const { baselineY: h, topY: c, barHeight: d, x: m, barWidth: M } = e, p = this.options.entryAnimation ?? "fade-grow";
56
+ if (o >= 1 || p === "none")
57
+ return { topY: c, barHeight: d, x: m, barWidth: M, alpha: 1 };
58
+ let f = c, w = d, y = m, k = 1;
59
+ if ((p === "fade" || p === "fade-grow") && (k = o), (p === "grow" || p === "fade-grow") && !e.growBaked) {
60
+ const l = d * o;
61
+ c < h ? f = h - l : f = h, w = Math.max(1, l);
62
+ }
63
+ return p === "slide" && (y = m + (1 - o) * M, k = o), { topY: f, barHeight: w, x: y, barWidth: M, alpha: k };
64
+ }
65
+ render(e) {
66
+ this.tickAnimations(performance.now());
67
+ const { scope: o } = e;
68
+ switch (this.#e = {
69
+ painter: X(this.options.barPainter),
70
+ env: {
71
+ ctx: o.context,
72
+ theme: e.theme,
73
+ horizontalPixelRatio: o.horizontalPixelRatio,
74
+ verticalPixelRatio: o.verticalPixelRatio
75
+ },
76
+ radius: (this.options.cornerRadius ?? I) * o.horizontalPixelRatio
77
+ }, this.options.stacking) {
78
+ case "normal":
79
+ this.renderStacked(e, !1);
80
+ break;
81
+ case "percent":
82
+ this.renderStacked(e, !0);
83
+ break;
84
+ default:
85
+ this.renderOff(e);
86
+ break;
87
+ }
88
+ }
89
+ /** Stacking off — each layer drawn independently from zero, overlapping */
90
+ renderOff(e) {
91
+ const { scope: o, timeScale: h, yScale: c, dataInterval: d } = e, { context: m, horizontalPixelRatio: M } = o, p = h.getRange();
92
+ let f = 0;
93
+ for (const v of this.stores) {
94
+ if (!v.isVisible()) continue;
95
+ const u = v.getVisibleData(p.from, p.to).length;
96
+ if (u > f && (f = u), f > 2) break;
97
+ }
98
+ const w = h.barWidthBitmap(d), y = Math.round(30 * M), k = f <= 2 ? Math.min(y, w) : w, l = Math.max(1, Math.round(k * this.options.barWidthRatio) - 2), T = Math.floor(l / 2), E = this.options.anchor === "right" ? l : T, H = c.getRange().min < 0, g = H ? c.valueToBitmapY(0) : o.bitmapSize.height;
99
+ if (this.stores.length === 1) {
100
+ if (!this.stores[0].isVisible()) return;
101
+ const v = this.stores[0].getVisibleData(p.from, p.to);
102
+ for (const u of v) {
103
+ if (!Number.isFinite(u.value)) continue;
104
+ const a = this.effectiveValue(e, 0, u.time, u.value), Y = this.entranceProgress(e, 0, u.time), x = this.isProjectedTime(u.time), t = h.timeToBitmapX(u.time), i = this.resolveLayerColor(0, a);
105
+ if (a >= 0) {
106
+ const r = c.valueToBitmapY(a), s = Math.max(1, g - r);
107
+ this.drawAnimatedBar({
108
+ context: m,
109
+ progress: Y,
110
+ baselineY: g,
111
+ topY: r,
112
+ barHeight: s,
113
+ x: t - E,
114
+ barWidth: l,
115
+ color: i,
116
+ roundEdge: "top",
117
+ isProjected: x
118
+ });
119
+ } else {
120
+ const r = c.valueToBitmapY(a), s = Math.max(1, r - g);
121
+ this.drawAnimatedBar({
122
+ context: m,
123
+ progress: Y,
124
+ baselineY: g,
125
+ topY: g,
126
+ barHeight: s,
127
+ x: t - E,
128
+ barWidth: l,
129
+ color: i,
130
+ roundEdge: "bottom",
131
+ isProjected: x
132
+ });
133
+ }
134
+ }
135
+ } else {
136
+ const v = this.stores.map(
137
+ (a, Y) => this.getLayerAlpha(Y) > 0 ? a.getVisibleData(p.from, p.to) : []
138
+ ), u = /* @__PURE__ */ new Map();
139
+ for (let a = 0; a < v.length; a++) {
140
+ const Y = this.getLayerAlpha(a);
141
+ for (const x of v[a]) {
142
+ if (!Number.isFinite(x.value)) continue;
143
+ let t = u.get(x.time);
144
+ t || (t = [], u.set(x.time, t)), t.push({ layer: a, value: this.effectiveValue(e, a, x.time, x.value) * Y });
145
+ }
146
+ }
147
+ for (const [a, Y] of u) {
148
+ Y.sort(
149
+ (i, r) => Math.abs(r.value) - Math.abs(i.value)
150
+ );
151
+ const x = h.timeToBitmapX(a), t = this.isProjectedTime(a);
152
+ for (let i = 0; i < Y.length; i++) {
153
+ const { layer: r, value: s } = Y[i], n = this.resolveLayerColor(r, s), W = this.entranceProgress(e, r, a);
154
+ if (s >= 0) {
155
+ const R = c.valueToBitmapY(s), j = Math.max(1, g - R);
156
+ this.drawAnimatedBar({
157
+ context: m,
158
+ progress: W,
159
+ baselineY: g,
160
+ topY: R,
161
+ barHeight: j,
162
+ x: x - E,
163
+ barWidth: l,
164
+ color: n,
165
+ roundEdge: "top",
166
+ isProjected: t
167
+ });
168
+ } else {
169
+ const R = c.valueToBitmapY(s), j = Math.max(1, R - g);
170
+ this.drawAnimatedBar({
171
+ context: m,
172
+ progress: W,
173
+ baselineY: g,
174
+ topY: g,
175
+ barHeight: j,
176
+ x: x - E,
177
+ barWidth: l,
178
+ color: n,
179
+ roundEdge: "bottom",
180
+ isProjected: t
181
+ });
182
+ }
183
+ }
184
+ }
185
+ }
186
+ if (H) {
187
+ m.strokeStyle = e.theme.grid.color, m.lineWidth = 1;
188
+ const v = Math.round(g) + 0.5;
189
+ m.beginPath(), m.moveTo(0, v), m.lineTo(o.bitmapSize.width, v), m.stroke();
190
+ }
191
+ }
192
+ /** Stacked (normal or percent) rendering */
193
+ renderStacked(e, o) {
194
+ const { scope: h, timeScale: c, yScale: d, dataInterval: m } = e, { context: M, horizontalPixelRatio: p } = h, f = c.getRange();
195
+ let w = 0;
196
+ for (const t of this.stores) {
197
+ if (!t.isVisible()) continue;
198
+ const i = t.getVisibleData(f.from, f.to).length;
199
+ if (i > w && (w = i), w > 2) break;
200
+ }
201
+ const y = c.barWidthBitmap(m), k = Math.round(30 * p), l = w <= 2 ? Math.min(k, y) : y, T = Math.max(1, Math.round(l * this.options.barWidthRatio) - 2), E = Math.floor(T / 2), H = this.options.anchor === "right" ? T : E, g = this.stores.map(
202
+ (t, i) => this.getLayerAlpha(i) > 0 ? t.getVisibleData(f.from, f.to) : []
203
+ );
204
+ if (g.every((t) => t.length === 0)) return;
205
+ const v = this.options.entryAnimation ?? "fade-grow", u = v === "grow" || v === "fade-grow", a = /* @__PURE__ */ new Map();
206
+ for (let t = 0; t < g.length; t++) {
207
+ const i = this.getLayerAlpha(t);
208
+ for (const r of g[t]) {
209
+ let s = a.get(r.time);
210
+ s || (s = new Array(g.length).fill(0), a.set(r.time, s));
211
+ const n = Number.isFinite(r.value) ? r.value : 0;
212
+ let W = this.effectiveValue(e, t, r.time, n) * i;
213
+ u && !this.isProjectedTime(r.time) && (W *= this.entranceProgress(e, t, r.time)), s[t] = W;
214
+ }
215
+ }
216
+ const Y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
217
+ for (const [t, i] of a) {
218
+ let r = -1, s = -1;
219
+ for (let n = 0; n < i.length; n++)
220
+ i[n] > 0 && (r = n), i[n] < 0 && (s = n);
221
+ r >= 0 && Y.set(t, r), s >= 0 && x.set(t, s);
222
+ }
223
+ for (let t = 0; t < g.length; t++) {
224
+ const i = this.resolveLayerColor(t, this.stores[t].last()?.value ?? 0);
225
+ for (const [r, s] of a) {
226
+ const n = s[t];
227
+ if (n === 0) continue;
228
+ const W = c.timeToBitmapX(r);
229
+ let R = 0, j = 0;
230
+ for (let b = 0; b < t; b++) {
231
+ const B = s[b];
232
+ B > 0 ? R += B : j += B;
233
+ }
234
+ const L = this.entranceProgress(e, t, r), V = this.isProjectedTime(r), D = n > 0 ? Y.get(r) === t ? "top" : "none" : x.get(r) === t ? "bottom" : "none";
235
+ if (o) {
236
+ let b = 0, B = 0;
237
+ for (const A of s)
238
+ A > 0 ? b += A : B += A;
239
+ if (n > 0 && b > 0) {
240
+ const A = R / b * 100, z = (R + n) / b * 100, S = d.valueToBitmapY(z), C = d.valueToBitmapY(A), O = Math.max(1, C - S);
241
+ this.drawAnimatedBar({
242
+ context: M,
243
+ progress: L,
244
+ baselineY: C,
245
+ topY: S,
246
+ barHeight: O,
247
+ x: W - H,
248
+ barWidth: T,
249
+ color: i,
250
+ roundEdge: D,
251
+ isProjected: V,
252
+ growBaked: !0
253
+ });
254
+ } else if (n < 0 && B < 0) {
255
+ const A = j / B * -100, z = (j + n) / B * -100, S = d.valueToBitmapY(A), C = d.valueToBitmapY(z), O = Math.max(1, C - S);
256
+ this.drawAnimatedBar({
257
+ context: M,
258
+ progress: L,
259
+ baselineY: S,
260
+ topY: S,
261
+ barHeight: O,
262
+ x: W - H,
263
+ barWidth: T,
264
+ color: i,
265
+ roundEdge: D,
266
+ isProjected: V,
267
+ growBaked: !0
268
+ });
269
+ }
270
+ } else if (n > 0) {
271
+ const b = d.valueToBitmapY(R + n), B = d.valueToBitmapY(R), A = Math.max(1, B - b);
272
+ this.drawAnimatedBar({
273
+ context: M,
274
+ progress: L,
275
+ baselineY: B,
276
+ topY: b,
277
+ barHeight: A,
278
+ x: W - H,
279
+ barWidth: T,
280
+ color: i,
281
+ roundEdge: D,
282
+ isProjected: V,
283
+ growBaked: !0
284
+ });
285
+ } else {
286
+ const b = d.valueToBitmapY(j), B = d.valueToBitmapY(j + n), A = Math.max(1, B - b);
287
+ this.drawAnimatedBar({
288
+ context: M,
289
+ progress: L,
290
+ baselineY: b,
291
+ topY: b,
292
+ barHeight: A,
293
+ x: W - H,
294
+ barWidth: T,
295
+ color: i,
296
+ roundEdge: D,
297
+ isProjected: V,
298
+ growBaked: !0
299
+ });
300
+ }
301
+ }
302
+ }
303
+ }
304
+ /**
305
+ * Paint one bar through the resolved painter, applying any entrance transform
306
+ * and per-bar alpha first. The painter owns the fill (and the rounded-corner
307
+ * geometry); a projected bar is forced settled so its only alpha source is the
308
+ * painter's translucent fill rather than a `globalAlpha` fade.
309
+ */
310
+ drawAnimatedBar(e) {
311
+ const o = this.#e;
312
+ if (o === null) return;
313
+ const { context: h, baselineY: c, topY: d, barHeight: m, x: M, barWidth: p, color: f, roundEdge: w } = e, y = e.isProjected ? 1 : e.progress, k = this.options.entryAnimation ?? "fade-grow", l = y >= 1 || k === "none" ? { x: M, topY: d, barWidth: p, barHeight: m, alpha: 1 } : this.applyBarTransform(e, y), T = {
314
+ geom: { x: l.x, y: l.topY, width: l.barWidth, height: l.barHeight, baselineY: c },
315
+ color: f,
316
+ corners: G[w],
317
+ // Clamp to this bar's geometry so `radius` honors its pre-clamped contract
318
+ // for custom painters; `fillRoundedRect` re-clamps to the same bound, so
319
+ // the built-in output is unchanged.
320
+ radius: Math.min(o.radius, l.barWidth / 2, l.barHeight / 2),
321
+ progress: y,
322
+ isProjected: e.isProjected
323
+ };
324
+ if (l.alpha < 1) {
325
+ h.save(), h.globalAlpha = l.alpha, o.painter(o.env, T), h.restore();
326
+ return;
327
+ }
328
+ o.painter(o.env, T);
329
+ }
330
+ }
331
+ const Z = {
332
+ type: "bar",
333
+ create: ({ theme: P, layerCount: e }, o) => {
334
+ const h = e === 1 ? [P.bar?.color ?? P.seriesColors[0] ?? "#26a69a"] : P.seriesColors.slice(0, e);
335
+ return new K(e, { colors: h, ...o });
336
+ }
337
+ };
338
+ export {
339
+ K as BarRenderer,
340
+ Z as BarSeriesDef
341
+ };