Releases: techniq/layerchart
layerchart@2.0.0-next.48
Patch Changes
- fix(ChartState): Don't create spurious implicit series when mark accessor matches chart's own axis accessor, fixing domain corruption for heatmap/Cell charts (#449)
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.transformState
- <BrushContext bind:brushContext> + <BrushContext bind:state> - <TransformContext bind:transformContext> + <TransformContext bind:state>
-
breaking(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:- <Chart transform={{ domainExtent: 'original' }}> + <Chart transform={{ domainExtent: 'data' }}>
-
breaking(GeoContext): Rename
GeoContextcomponent toGeoProjection(#663)The
GeoContextcomponent has been renamed toGeoProjectionto better describe its purpose. Update your imports and template usage:- import { GeoContext } from 'layerchart' + import { GeoProjection } from 'layerchart'
- <GeoContext projection={geoAlbersUsa}> + <GeoProjection projection={geoAlbersUsa}>
-
breaking: Rename render context APIs to layer context (#663)
getRenderContext()→getLayerContext()setRenderContext()→setLayerContext()supportedContextsprop →layersprop on components- Internal
layout/directory moved tolayers/(affects deep imports)
- import { getRenderContext } from 'layerchart' + import { getLayerContext } from 'layerchart'
-
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:
- if (chartContext.isVertical) { ... } + if (chartContext.valueAxis === 'y') { ... }
When using
<Chart>directly (not simplified charts):- <Chart ...> + <Chart valueAxis="x" ...>
-
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().transformState
- import { getTooltipContext } from 'layerchart' - const tooltip = getTooltipContext() + import { getChartContext } from 'layerchart' + const chart = getChartContext() + // access via chart.tooltip
-
breaking(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 bandwidth
-
feat: 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:
- Remove
modeprop ('integrated' | 'separated') — sync behavior is now driven by presence ofx/yprops - Remove
resetOnEnd— calle.brush.reset()in youronBrushEndhandler instead - Remove
ignoreResetClick— replaced byclickToReset(defaulttrue) - Remove
onResetevent — checkbrush.active === falseinonBrushEnd/onChangeinstead
New features:
- Add
BrushState.move({ x?, y? })for programmatic selection control (like d3'sbrush.move()) - Add
BrushState.selectAll()to select the full domain extent - Add
BrushState.reset()to clear the selection - Add
clickToResetprop (defaulttrue) - Add
zoomOnBrushprop on Chart for simplified charts to opt into brush-to-zoom - Move domain clamping, edge adjustment, and range computation logic into
BrushStateclass - Add
BrushChartContextinterface for easier testing
- Remove
-
feat: Unified component tree for Canvas rendering with proper Group transform scoping. Fixes #662 (#663)
- New
registerComponentNode({ name, kind, canvasRender })API replaces bothregisterCanvasComponentand theInsideCompositeMarkboolean context with a single unified component tree. - Canvas rendering now walks the tree recursively with proper
save()/restore()scoping, fixing Group transforms (translate, opacity) leaking to sibling components instead of only affecting children. - Composite marks (Area, Threshold, Hull, Labels, Grid) register as
'composite-mark'nodes, automatically preventing child marks from registering with the chart without manual_skipRegistrationprops. - Removed
retainStateandnamefromComponentRendertype — Group's transform scoping is handled by tree position, and component names live on the tree node.
- New
-
feat: add
downloadImage,downloadSvg,getChartImageBlob, andgetChartSvgStringutilities to export charts as PNG/JPEG/WebP images or SVG files (#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)
- Marks (Spline, Area, Points, Bars) now register their data, accessors, and colors with the Chart via
registerMark(). - Chart automatically aggregates y/x accessors from marks, removing the need to pass
y={['apples', 'oranges']}when each mark specifies its owny. Works for both horizontal (valueAxis='y') and vertical (valueAxis='x') charts. - Per-mark
dataprops are included in the chart's domain calculation automatically. - Implicit series are generated from mark registrations when no explicit
seriesprop is provided, enabling tooltip and legend support without requiring series definitions.
- Marks (Spline, Area, Points, Bars) now register their data, accessors, and colors with the Chart via
-
feat: Add inertia (momentum) support for transform drag gestures (#663)
-
breaking(Chart): Rename
tooltipprop totooltipContextto better describ...
layerchart@2.0.0-next.46
layerchart@2.0.0-next.45
Major Changes
- feat: New docs site (#449)
Minor Changes
-
breaking: Extract
Pathprimitive component fromSplinefor better separation of concerns (#659) -
breaking: Rename simplified charts
renderContextprop tolayer(#659) -
breaking: Change
defaultChartPadding(axis, legend)todefaultChartPadding({ axis, legend })and support overrides (ex.defaultChartPadding({ left: 50 })) (#659)
Patch Changes
-
feat(Chart): Support passing explicit
widthandheightinstead of requiring parent dimensions (#659) -
feat: Support global settings (layer type, debug, etc) (#659)
-
feat(Layer): Allow
typeto be optional, fallbacking back tosettings.layertype (#659) -
feat(Chart|Svg|Html): Support passing
clipprop to hide overflown content (#659) -
feat(Circle|Rect): Support passing children snippet for Html layers (#659)
-
feat(Layer): Support showing chart and full frame boundaries with
settings.debug(#659) -
fix(Threshold): Properly clip
abovesnippet (resolving 1/2 width clipping issues when using Spline) (#659) -
fix(AnnotationRange|TooltipContext|Highlight): Fix using interval scales with reversed data (ex. xReverse) (#659)
-
fix(Canavs): Support
styleattribute (#659) -
fix(Rect): Support rounded (rx/ry) in Canvas layers (fixes #481) (#659)
-
fix(Bar): Fix browser lockup when switching between group and stack layouts (#659)
-
fix(Bar): Fix bar rounding direction when using xReverse/yReverse with interval scales (#659)
-
fix(Text): Support explicit "\n" and set line-height (to match svg/canvas) for html layers (#659)
-
feat(Chart): Support
classprop (#659) -
refactor: Move contexts to separate
$lib/contextsmodule (#659) -
refactor: Removed lodash-es dependency (#659)
layerchart@1.0.13
Patch Changes
- fix(Canvas): Fix pointer events (hit canvas) when using Brave browser with fingerprinting protection enabled (#755)
layerchart@2.0.0-next.44
Patch Changes
- fix(Canvas): Fix pointer events (hit canvas) when using Brave browser with fingerprinting protection enabled (#449)
layerchart@2.0.0-next.43
Patch Changes
- fix(Highlight|TooltipContext): Support xInterval / yInterval (#449)
layerchart@2.0.0-next.42
Patch Changes
- fix(Calendar): Respect
startinstead of always start of year (#657)
layerchart@2.0.0-next.41
Patch Changes
- fix(Tooltip): Correctly set tooltip position on chart enter and exit (#655)
layerchart@2.0.0-next.40
Patch Changes
- fix(LineChart): Restore passing xScale / yScale overrides (#449)