Conversation
bc0cbc9 to
9f0344a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated.
nextis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonnext.Releases
layerchart@2.0.0-next.47
Major Changes
breaking(BrushContext|TransformContext): Rename
bind:brushContext/bind:transformContexttobind:state(#663)Both
BrushContextandTransformContextnow usebind:stateinstead of their previous named bindings. Additionally, properties onChartStatehave been renamed:chartContext.brushContext→chartContext.brushStatechartContext.transformContext→chartContext.transformStatebreaking(TransformContext): Rename
domainExtent: 'original'todomainExtent: 'data'(#663)The
'original'value fordomainExtenthas been renamed to'data'to better describe that it constrains pan/zoom to the data's domain bounds:breaking(GeoContext): Rename
GeoContextcomponent toGeoProjection(#663)The
GeoContextcomponent has been renamed toGeoProjectionto better describe its purpose. Update your imports and template usage:breaking: Rename render context APIs to layer context (#663)
getRenderContext()→getLayerContext()setRenderContext()→setLayerContext()supportedContextsprop →layersprop on componentslayout/directory moved tolayers/(affects deep imports)breaking(Chart): Remove
isVerticalfrom ChartState, addvalueAxisprop toChart(#663)ChartState.isVerticalhas been removed in favor ofChartState.valueAxis('x'|'y'), which explicitly defines which axis represents the value (dependent variable).Simplified charts (
BarChart,LineChart,AreaChart,ScatterChart) still accept theorientationprop as before — each chart maps it to the correctvalueAxisinternally. The<Chart>component itself now usesvalueAxisdirectly, sinceorientationis ambiguous at that level (a "vertical" BarChart hasvalueAxis="y"while a "vertical" LineChart hasvalueAxis="x").When accessing chart state:
When using
<Chart>directly (not simplified charts):breaking: Remove standalone context getter/setter functions (#663)
The following standalone context functions have been removed in favor of the unified
getChartContext()API:getTooltipContext()/setTooltipContext()→ usegetChartContext().tooltipgetBrushContext()/setBrushContext()→ usegetChartContext().brushStategetTransformContext()/setTransformContext()→ usegetChartContext().transformStatebreaking(Arc|Pie|Calendar|GeoPath): Rename
tooltipContextto simpletooltip(boolean), simplifying use case (#663)Minor Changes
feat: Add BoxPlot component for box-and-whisker plots (#663)
New composite mark that renders whiskers, caps, IQR box, median line, and outlier dots. Supports both pre-computed statistics (
min,q1,median,q3,max,outliersaccessors) and automatic computation from raw values via thevaluesprop. Orientation-aware viavalueAxiscontext.feat: Add statistical utility functions
computeBoxStats()andkde()(#663)computeBoxStats(values, k?)computes the five-number summary and outliers using the Tukey IQR methodkde(values, options?)computes kernel density estimation using the Epanechnikov kernel with Silverman's rule-of-thumb bandwidthfeat: Add Violin component for violin plots (#663)
New composite mark that renders a symmetric density curve (mirrored area) from raw data using kernel density estimation (Epanechnikov kernel). Supports pre-computed density data via
densityprop or automatic KDE from raw values viavaluesprop. Optionalboxandmedianoverlays. Configurablebandwidth,thresholds, andcurve.feat(Spline): Support geo projection (#663)
feat: Add geo projection support for primitives (Circle, Rect, etc) (#663)
feat(Highlight): Add
rprop to scale highlight points using the chart's rScale. Supportsr={true}to use the chart's r config or a custom accessor. (#663)breaking(Brush): Redesign brush API (#663)
Breaking changes:
modeprop ('integrated' | 'separated') — sync behavior is now driven by presence ofx/ypropsresetOnEnd— calle.brush.reset()in youronBrushEndhandler insteadignoreResetClick— replaced byclickToReset(defaulttrue)onResetevent — checkbrush.active === falseinonBrushEnd/onChangeinsteadNew features:
BrushState.move({ x?, y? })for programmatic selection control (like d3'sbrush.move())BrushState.selectAll()to select the full domain extentBrushState.reset()to clear the selectionclickToResetprop (defaulttrue)zoomOnBrushprop on Chart for simplified charts to opt into brush-to-zoomBrushStateclassBrushChartContextinterface for easier testingfeat: Unified component tree for Canvas rendering with proper Group transform scoping. Fixes [Group] Fix positioning when using canvas layer #662 (#663)
registerComponentNode({ name, kind, canvasRender })API replaces bothregisterCanvasComponentand theInsideCompositeMarkboolean context with a single unified component tree.save()/restore()scoping, fixing Group transforms (translate, opacity) leaking to sibling components instead of only affecting children.'composite-mark'nodes, automatically preventing child marks from registering with the chart without manual_skipRegistrationprops.retainStateandnamefromComponentRendertype — Group's transform scoping is handled by tree position, and component names live on the tree node.feat: add
downloadImage,downloadSvg,getChartImageBlob, andgetChartSvgStringutilities to export charts as PNG/JPEG/WebP images or SVG files (#663)feat: Add Image component. Resolves feat: Image mark #628 (#663)
feat(SeriesState): Support passing
selectedas part of series declaration (Ex.<Chart series={...}>) (#663)feat: Add data mode to primitive components (Circle, Ellipse, Group, Line, Polygon, Rect, Text) (#663)
Primitives now accept string or function accessors for positional props (e.g.
x="date",y={d => d.value}) to automatically resolve values through chart scales and iterate over data. Components also accept an optionaldataprop to override chart context data.Color properties (
fill,stroke) can also be data-driven, resolving per-item through the chart's color scale (cScale). String values are disambiguated: data property names resolve throughcScale, while literal CSS colors pass through unchanged.feat: Mark registration for automatic domain calculation, accessor aggregation, and implicit series (#663)
registerMark().y={['apples', 'oranges']}when each mark specifies its owny. Works for both horizontal (valueAxis='y') and vertical (valueAxis='x') charts.dataprops are included in the chart's domain calculation automatically.seriesprop is provided, enabling tooltip and legend support without requiring series definitions.feat: Add inertia (momentum) support for transform drag gestures (#663)
feat: Add Cell mark. Resolves Add new
Cellmark #627. (#663)breaking(Chart): Rename
tooltipprop totooltipContextto better describe purpose and fix conflict with newtooltipsnippet (#663)feat: Add Chord layout and Ribbon primitive (#663)
breaking(TransformContext): Rename
initialScrollModetoscrollModeand make it reactive (#663)feat(TransformContext): Add
scrollActivationKeyoption to require a modifier key (meta, alt, control, shift) for scroll/wheel zoom/pan, preventing accidental page scroll from triggering transforms (#663)feat(Transform): Add zoom/pan constraints (
scaleExtent,translateExtent,constrain,domainExtent), replacegeo.applyTransformwithtransform.mode: 'projection' | 'rotate', and reactively sync initial transform values on projection changes (#663)feat(Bar): Support fixed
widthandheightprops to override scale-derived dimensions, centering the bar within its band. Resolves [BarChart] Support fixed width bars #360 (#663)feat: Auto-compute Bar/Bars mount animation initial values from chart scales (#663)
Bar now automatically derives
initialY/initialHeight(vertical) orinitialX/initialWidth(horizontal) from the chart's scale range whenmotionis configured, removing the need to hardcode pixel values.Also improves
valueAxisinference onChartState— when not explicitly set, it is now derived from scale types (band scale on y →valueAxis: 'x', band scale on x →valueAxis: 'y').feat(Chart): Add cartesian pan/zoom via
transform={{ mode: 'domain' }}with single or both axis support. Resolves Transform cartesian charts on pointer drag / scroll #366 (#663)feat(Spline): Add motion support for mount animation from baseline (#663)
feat: Support continuous color scales via
cScaleprop without requiringcRange(#663)cScale(e.g.scaleSequential(interpolateTurbo)) to activate withoutcRange, enabling pre-configured sequential/diverging color scalescreateScaleagainst undefinedrangeto avoid breaking interpolator-based scalescDomainvalues and useextentinstead ofunique, producing correct[min, max]domains for continuous scalescScalecolor over default series color in tooltip/highlight when a color scale is configuredfeat(Labels): Support
seriesKeyinlabelsprop to filter which series renders labels. Resolves [Labels] Apply series property accessors #633 (#663)feat(Rect): New edge-based props (
x0/x1/y0/y1) along with existing (x/y/width/height) andinsetssupport (#663)feat: Add Vector component (#663)
Patch Changes
fix(Area): Default y0 baseline to chart's yBaseline when set (#663)
Area's y0 fallback now respects the chart's
yBaselineprop (e.g.yBaseline={0}set by AreaChart) instead of always usingmin(yScale.domain()). This fixes areas filling to the bottom of the chart instead of to the baseline when data goes negative.fix(Points|Labels): Correctly position when using x1 / y1 scales (issue How to add custom labels in bar chart with array accessor (ex. duration)? #773) (#663)
refactor(Chart): Add
debugprop and updatesettingscontext (#663)fix: Default chart padding now applied when using ChartChildren layout (marks snippet) (#663)
When
<Chart>is used withmarks/grid/axissnippets (no explicitchildrensnippet), default padding is now applied to match the axes that ChartChildren renders by default. Whenchildrenis provided directly (e.g. Treemap, Pack), no default padding is applied since the user controls layout. This can still be overridden with explicitaxisorpaddingprops.fix(Tooltip): Apply inverse transform for quadtree lookup when zoomed/panned (#663)
fix(Area): Handle degenerate domains (e.g. all-zero data) and unify y0/y1 baseline logic (#663)
[0, 0]), which causedyScale()to returnNaNand break area path renderingfix(BarChart): automatically round the outer edge of each direction in
stackDiverginglayout (#663)fix:
flattenPathDatanow handles relative arc commands, fixing rounded bars starting below the baseline during mount animation (#663)fix(Area|Highlight): Properly handling diveraging stack layouts for negative values (line, highlight point) (#663)
fix(Points|Labels): Correctly position when using array accessors (duration charts, etc). Fixes [Labels] Apply series property accessors #633 (#663)
fix(TooltipContext): correct
bisect-bandhit detection by accounting for chart padding (#806)fix(ClipPath): Support canvas layers. Resolves [ClipPath] Suport canvas layers #660 (#663)
feat(Chart): Support
motionprop to transition x/y scales using tween or spring (#663)fix(Canavs): support
strokeOpacityfor Path component (#663)fix(Text): handle inline styles and CSS class-based text-anchor (#663)
fix(Tooltip): Fade non-highlighted series items on hover to match chart highlight state (#663)
fix(TooltipContext): Support band mode with array-based range accessors (e.g. histograms using
x={['x0', 'x1']}) (#663)