Minor Changes
-
feat(Bar, Bars): Support
<Html>layer (#449)Bar/Bars now render in
<Html>layers in addition to<Svg>and<Canvas>, including per-cornerroundedvariants (top,bottom,left,right,edge, and individual corners). Previously, any non-uniformroundedvalue fell through to a<Path>and was SVG-only. -
feat(ClipPath, RectClipPath, CircleClipPath, GeoClipPath): HTML layer support + unified
pathAPI (#449)ClipPathnow accepts a singlepath: string(SVG pathdsyntax) that drives all three layers:- SVG: rendered as
<path d={path}>inside the<clipPath>element. - Canvas: wrapped in
Path2Dand applied viactx.clip(...). - HTML: emitted as
clip-path: path("${path}")on a wrapper<div>covering the chart container.
This replaces the previous
canvasClip/canvasClipDepscallbacks (and skipped HTML entirely) with a single declarative value. Theclipsnippet is still accepted for advanced/custom SVG content.RectClipPath,CircleClipPath, andGeoClipPathare rewritten on top of this — they each compute a path string (d3-geo-path already emits one natively) and pass it through. All three now support<Html>layers in addition to<Svg>and<Canvas>.Note:
clip-path: path()requires Chrome 88+, Safari 13.1+, Firefox 118+. - SVG: rendered as
-
feat(ClipPath, RectClipPath, CircleClipPath, GeoClipPath): Add
invertprop to render content outside the clip shape (cutouts/masks) across SVG, Canvas, and HTML layers (#449) -
feat(Line, Rect, Circle, Text): Multi-layer compatible
dashArrayand inline color props (#449)- Added a typed
dashArrayprop toLine,Rect, andCircle. Accepts a number, array, or SVG-style string and maps tostroke-dasharray(SVG),setLineDash(Canvas), and eitherrepeating-linear-gradient(HTML lines) orborder-style: dashed(HTML borders). Previously dashed styling was SVG-only when applied via CSS class or attribute. TextandLineHTML branches now honor thefill/strokeprops as inlinecolor/background, so prop-based colors work across all three layers (not just SVG/Canvas).Grid.x/Grid.yandAxis.gridnow acceptstroke,strokeWidth,opacity, anddashArrayin their object form, matching the props forwarded to the underlying line.Rulealready forwarded arbitrary Line props via spread;dashArraynow works there unchanged.- Exports
parseDashArrayanddashArrayToGradienthelpers frompathutils.
- Added a typed
-
feat(Tree, Link, Connector): Add radial support (#831)
Treenow detects<Chart radial>and lays out withd3.tree().size([2π, min(width, height)/2])plus radial separation. Nodes emit polar coords (x= angle,y= radius).Connectorgains aradialprop (defaults toctx.radial) that interpretssource/targetas polar and dispatches to newgetConnectorRadialPresetPath/getConnectorRadialD3Pathhelpers. Radial behavior per connectortype:straight— straight cartesian linesquare— radial → arc at midR → radialbeveled— chord at source radius with chamfered corner (controlled byradius)rounded— visx LinkRadialCurve Bezierd3—d3.linkRadialby default; with acurveprop,curveStep/curveStepBefore/curveStepAftermap to polar arcs/radials, other curves go throughd3.lineRadial
LinkforwardsradialtoConnectorautomatically when inside a radial<Chart>. -
feat(Rect): Add
cornersprop for per-corner rounding (#449)New
cornersprop accepts either a number (equivalent torx), a[topLeft, topRight, bottomRight, bottomLeft]tuple, or{ topLeft, topRight, bottomRight, bottomLeft }. Works across<Svg>,<Canvas>, and<Html>layers — Svg renders a<rect>when corners are uniform and a<path>when they differ, Canvas usesroundRect's per-corner radii, and Html uses the 4-valueborder-radiusshorthand.Also exports a shared
roundedRectPath(x, y, width, height, [tl, tr, br, bl])helper frompathutils for building per-corner rounded-rect path data.
Patch Changes
-
fix(canvas): Compose globalAlpha multiplicatively so Group opacity propagates to children (#831)
Canvas
renderPathDatawas overwritingctx.globalAlphawith absolute values for element opacity, fill opacity, and stroke opacity. This meant a parent<Group opacity={0.2}>had no effect on child marks rendered on canvas — the child's own opacity (defaulting to 1) would replace the inherited value.Now all three sites multiply against the current
globalAlpha, which correctly composes with ancestor Group opacity set viasave()/restore()scoping. Also removes double-application of elementopacityinside the fill/stroke blocks (it's already applied at the element level).