Skip to content

Releases: techniq/layerchart

layerchart@2.0.0-next.48

31 Mar 17:47
f7fe3e3

Choose a tag to compare

Pre-release

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

31 Mar 15:26
4a93215

Choose a tag to compare

Pre-release

Major Changes

  • breaking(BrushContext|TransformContext): Rename bind:brushContext / bind:transformContext to bind:state (#663)

    Both BrushContext and TransformContext now use bind:state instead of their previous named bindings. Additionally, properties on ChartState have been renamed:

    • chartContext.brushContextchartContext.brushState
    • chartContext.transformContextchartContext.transformState
    - <BrushContext bind:brushContext>
    + <BrushContext bind:state>
    
    - <TransformContext bind:transformContext>
    + <TransformContext bind:state>
  • breaking(TransformContext): Rename domainExtent: 'original' to domainExtent: 'data' (#663)

    The 'original' value for domainExtent has 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 GeoContext component to GeoProjection (#663)

    The GeoContext component has been renamed to GeoProjection to 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()
    • supportedContexts prop → layers prop on components
    • Internal layout/ directory moved to layers/ (affects deep imports)
    - import { getRenderContext } from 'layerchart'
    + import { getLayerContext } from 'layerchart'
  • breaking(Chart): Remove isVertical from ChartState, add valueAxis prop to Chart (#663)

    ChartState.isVertical has been removed in favor of ChartState.valueAxis ('x' | 'y'), which explicitly defines which axis represents the value (dependent variable).

    Simplified charts (BarChart, LineChart, AreaChart, ScatterChart) still accept the orientation prop as before — each chart maps it to the correct valueAxis internally. The <Chart> component itself now uses valueAxis directly, since orientation is ambiguous at that level (a "vertical" BarChart has valueAxis="y" while a "vertical" LineChart has valueAxis="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() → use getChartContext().tooltip
    • getBrushContext() / setBrushContext() → use getChartContext().brushState
    • getTransformContext() / setTransformContext() → use getChartContext().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 tooltipContext to simple tooltip (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, outliers accessors) and automatic computation from raw values via the values prop. Orientation-aware via valueAxis context.

  • feat: Add statistical utility functions computeBoxStats() and kde() (#663)

    • computeBoxStats(values, k?) computes the five-number summary and outliers using the Tukey IQR method
    • kde(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 density prop or automatic KDE from raw values via values prop. Optional box and median overlays. Configurable bandwidth, thresholds, and curve.

  • feat(Spline): Support geo projection (#663)

  • feat: Add geo projection support for primitives (Circle, Rect, etc) (#663)

  • feat(Highlight): Add r prop to scale highlight points using the chart's rScale. Supports r={true} to use the chart's r config or a custom accessor. (#663)

  • breaking(Brush): Redesign brush API (#663)

    Breaking changes:

    • Remove mode prop ('integrated' | 'separated') — sync behavior is now driven by presence of x/y props
    • Remove resetOnEnd — call e.brush.reset() in your onBrushEnd handler instead
    • Remove ignoreResetClick — replaced by clickToReset (default true)
    • Remove onReset event — check brush.active === false in onBrushEnd/onChange instead

    New features:

    • Add BrushState.move({ x?, y? }) for programmatic selection control (like d3's brush.move())
    • Add BrushState.selectAll() to select the full domain extent
    • Add BrushState.reset() to clear the selection
    • Add clickToReset prop (default true)
    • Add zoomOnBrush prop on Chart for simplified charts to opt into brush-to-zoom
    • Move domain clamping, edge adjustment, and range computation logic into BrushState class
    • Add BrushChartContext interface for easier testing
  • feat: Unified component tree for Canvas rendering with proper Group transform scoping. Fixes #662 (#663)

    • New registerComponentNode({ name, kind, canvasRender }) API replaces both registerCanvasComponent and the InsideCompositeMark boolean 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 _skipRegistration props.
    • Removed retainState and name from ComponentRender type — Group's transform scoping is handled by tree position, and component names live on the tree node.
  • feat: add downloadImage, downloadSvg, getChartImageBlob, and getChartSvgString utilities to export charts as PNG/JPEG/WebP images or SVG files (#663)

  • feat: Add Image component. Resolves #628 (#663)

  • feat(SeriesState): Support passing selected as 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 optional data prop 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 through cScale, 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 own y. Works for both horizontal (valueAxis='y') and vertical (valueAxis='x') charts.
    • Per-mark data props are included in the chart's domain calculation automatically.
    • Implicit series are generated from mark registrations when no explicit series prop 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 #627. (#663)

  • breaking(Chart): Rename tooltip prop to tooltipContext to better describ...

Read more

layerchart@2.0.0-next.46

19 Feb 14:23
300e7dd

Choose a tag to compare

Pre-release

Patch Changes

  • fix: Workaround Svelte 5.52+ regression (Parse failure: Expected '{', got '(') (#449)

  • chore: Update deps (including dagre from 1.x to 2.x) (#449)

layerchart@2.0.0-next.45

18 Feb 15:50

Choose a tag to compare

Pre-release

Major Changes

  • feat: New docs site (#449)

Minor Changes

  • breaking: Extract Path primitive component from Spline for better separation of concerns (#659)

  • breaking: Rename simplified charts renderContext prop to layer (#659)

  • breaking: Change defaultChartPadding(axis, legend) to defaultChartPadding({ axis, legend }) and support overrides (ex. defaultChartPadding({ left: 50 })) (#659)

Patch Changes

  • feat(Chart): Support passing explicit width and height instead of requiring parent dimensions (#659)

  • feat: Support global settings (layer type, debug, etc) (#659)

  • feat(Layer): Allow type to be optional, fallbacking back to settings.layer type (#659)

  • feat(Chart|Svg|Html): Support passing clip prop 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 above snippet (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 style attribute (#659)

  • fix(Canavs): Suppport dashed stroke (fix: #652) (#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 class prop (#659)

  • refactor: Move contexts to separate $lib/contexts module (#659)

  • refactor: Removed lodash-es dependency (#659)

layerchart@1.0.13

06 Jan 21:45
221f6da

Choose a tag to compare

Patch Changes

  • fix(Canvas): Fix pointer events (hit canvas) when using Brave browser with fingerprinting protection enabled (#755)

layerchart@2.0.0-next.44

06 Jan 22:04
2301ad8

Choose a tag to compare

Pre-release

Patch Changes

  • fix(Canvas): Fix pointer events (hit canvas) when using Brave browser with fingerprinting protection enabled (#449)

layerchart@2.0.0-next.43

14 Nov 00:12
ca4d66a

Choose a tag to compare

Pre-release

Patch Changes

  • fix(Highlight|TooltipContext): Support xInterval / yInterval (#449)

layerchart@2.0.0-next.42

15 Oct 03:12
aaa5282

Choose a tag to compare

Pre-release

Patch Changes

  • fix(Calendar): Respect start instead of always start of year (#657)

layerchart@2.0.0-next.41

10 Oct 15:46
0ec0f83

Choose a tag to compare

Pre-release

Patch Changes

  • fix(Tooltip): Correctly set tooltip position on chart enter and exit (#655)

layerchart@2.0.0-next.40

28 Sep 01:56
578fb49

Choose a tag to compare

Pre-release

Patch Changes

  • fix(LineChart): Restore passing xScale / yScale overrides (#449)