Skip to content

Commit 85076f1

Browse files
Version Packages (next) (#816)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b625487 commit 85076f1

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.changeset/pre.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"add-trail-component",
2020
"add-violin-component",
2121
"afraid-jobs-say",
22+
"arclabel-component",
23+
"arctext-centered-default",
24+
"arctext-inner-padding",
2225
"area-y0-baseline-default",
2326
"axis-grid-stroke-fill-props",
2427
"band-scale-transform-brush",
@@ -45,6 +48,7 @@
4548
"chatty-shirts-rule",
4649
"chilly-games-hide",
4750
"chubby-ties-play",
51+
"circle-legend-component",
4852
"clean-nights-jog",
4953
"clear-ghosts-arrive",
5054
"clear-moose-rush",
@@ -107,6 +111,7 @@
107111
"funny-wasps-heal",
108112
"geo-context-rename",
109113
"geo-default-translate-center",
114+
"geo-legend-component",
110115
"geo-relative-scale-translate-extent",
111116
"giant-donuts-yell",
112117
"globe-scroll-zoom",
@@ -128,10 +133,12 @@
128133
"khaki-pugs-hammer",
129134
"kind-melons-invent",
130135
"kind-shirts-sniff",
136+
"labels-center-placement",
131137
"large-spiders-stay",
132138
"late-glasses-itch",
133139
"layer-context-rename",
134140
"legal-parrots-beam",
141+
"legend-tooltip-indicator",
135142
"lemon-bats-change",
136143
"loud-lies-film",
137144
"loud-paws-allow",
@@ -160,6 +167,7 @@
160167
"open-bushes-run",
161168
"open-houses-vanish",
162169
"orientation-to-valueaxis",
170+
"piechart-arcchart-labels-prop",
163171
"pink-flies-worry",
164172
"pink-hornets-rest",
165173
"pink-showers-hunt",

packages/layerchart/CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
11
# LayerChart
22

3+
## 2.0.0-next.52
4+
5+
### Minor Changes
6+
7+
- feat(ArcLabel): New component for positioning text labels on arc segments ([#817](https://github.com/techniq/layerchart/pull/817))
8+
9+
`ArcLabel` is a new marking component for placing text (and optional leader lines) relative to an arc. It's used internally by `PieChart` and `ArcChart` when the `labels` prop is set, but can also be rendered directly inside an `Arc` children snippet.
10+
11+
Supported placements:
12+
- `centroid` — at the arc centroid (horizontal text, default)
13+
- `centroid-rotated` — at the centroid, rotated to follow the arc tangent, flipped where needed so text stays upright
14+
- `centroid-radial` — at the centroid, rotated to read along the radial direction (center → outer edge)
15+
- `inner` / `middle` / `outer` — along the inner, medial, or outer arc path (centered via `startOffset: '50%'` by default)
16+
- `callout` — outside the arc with a leader line that bends horizontally to the label
17+
18+
`ArcLabel` accepts a single `offset` prop that is routed to the placement-appropriate radial padding (centroid offset, `innerPadding`/`outerPadding`, or `calloutLineLength`), plus `calloutLineLength` / `calloutLabelOffset` / `calloutPadding` for fine-grained control of callout leader lines. The leader line renders via the `Path` primitive, so it works in both SVG and Canvas chart layers.
19+
20+
- breaking(Arc): Center arc text along path by default for `inner`/`middle`/`outer` positions ([#817](https://github.com/techniq/layerchart/pull/817))
21+
22+
`getArcTextProps('inner' | 'middle' | 'outer')` now defaults to `startOffset: '50%'` with `textAnchor: 'middle'`, centering the text along the arc path rather than anchoring it at the arc start. When an explicit `startOffset` is provided, the anchor falls back to `'start'` so the text begins at that position (matching prior behavior for callers that set a start offset).
23+
24+
- feat(Arc): Add `innerPadding` option to `getArcTextProps` / `getTrackTextProps` ([#817](https://github.com/techniq/layerchart/pull/817))
25+
26+
`ArcTextOptions` now supports an `innerPadding` option, symmetric to the existing `outerPadding`. Positive values shrink the inner radius used to build the `inner`/`middle` arc text paths, moving text inward (toward the chart center). Previously, offsetting an `inner`-placed arc label away from the arc edge required overriding the path manually; now it works the same as `outerPadding` does for `outer` text.
27+
28+
- feat(CircleLegend): New component for visualizing radius (`rScale`) values as nested circles ([#818](https://github.com/techniq/layerchart/pull/818))
29+
30+
`CircleLegend` displays a set of bottom-aligned nested circles representing values from a radius scale, useful alongside bubble maps and scatter charts that encode magnitude via circle area. By default it reads `rScale` from the chart context, but a `scale` prop can also be passed to render standalone.
31+
32+
Supports `tickValues` / `ticks` / `tickFormat` for value selection and formatting, a `title` rendered centered above the circles, and `labelPlacement="right" | "left" | "inline"` to render tick labels with a leader line on either side of the circles or centered inside each circle near the top.
33+
34+
- feat(GeoLegend): New scale-bar legend showing real-world distance for the current `Chart` projection ([#818](https://github.com/techniq/layerchart/pull/818))
35+
36+
`GeoLegend` reads the active geo projection from the chart context and renders a labeled scale bar with tick subdivisions. By default it picks a "nice" round distance that covers ~25% of the chart width, but `distance` can be passed for an explicit value. Supports `units="km" | "mi"`, configurable `ticks`, `tickFormat`, `title`, and the standard `placement` props. Inspired by Harry Stevens' [d3-geo-scale-bar](https://observablehq.com/@harrystevens/introducing-d3-geo-scale-bar).
37+
38+
- feat(Labels): Add `middle` placement and change `center` to center within the bar body ([#449](https://github.com/techniq/layerchart/pull/449))
39+
40+
`placement="center"` now positions the label at the center of the bar body (between the value edge and the baseline). The previous `center` behavior (label aligned to the value edge with a middle anchor) is now available as the new `placement="middle"`.
41+
42+
- feat(Legend, CircleLegend): Show an indicator of the current tooltip value on the legend ([#818](https://github.com/techniq/layerchart/pull/818))
43+
44+
`Legend` (ramp variant) now draws a small upward-pointing arrow below the color ramp at the position of the currently hovered value, and `CircleLegend` draws a 50%-opacity filled circle at the corresponding radius. Both auto-read the hovered data from `ctx.tooltip.data` and pipe it through the chart's color (`ctx.c`) / radius (`ctx.r`) accessors, so wiring is automatic for charts that configure `c` / `r` / `cScale` / `rScale` via `Chart` props.
45+
46+
A new `value` prop on both components allows explicitly setting the indicator value (overriding the auto-detection), useful when the tooltip data shape doesn't match the chart's accessor.
47+
48+
For `scaleThreshold` / `scaleQuantize` / `scaleQuantile` scales, the `Legend` indicator centers on the matching bucket swatch.
49+
50+
- feat(PieChart/ArcChart): Add top-level `labels` prop ([#817](https://github.com/techniq/layerchart/pull/817))
51+
52+
`PieChart` and `ArcChart` now accept a `labels` prop that renders text labels on each arc without requiring a custom `arc` snippet. Pass `true` to enable defaults (centroid placement, default value accessor), or an object to configure any `ArcLabel` props — placement, offset, value accessor, callout line lengths, leader line style, text class, etc.
53+
54+
```svelte
55+
<PieChart {data} labels={{ placement: 'callout', value: 'fruit' }} />
56+
```
57+
358
## 2.0.0-next.51
459

560
### Minor Changes

packages/layerchart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"repository": "techniq/layerchart",
77
"homepage": "https://layerchart.com",
8-
"version": "2.0.0-next.51",
8+
"version": "2.0.0-next.52",
99
"scripts": {
1010
"dev": "pnpm package:watch",
1111
"package": "svelte-package",

0 commit comments

Comments
 (0)