Skip to content

Allow greater control over layer rendering order #674

@nickofthyme

Description

@nickofthyme

Feature

Allower greater control over the layer rendering order on canvas layers. Should sync with legend and tooltip order somehow.

Proposed API

Very rough idea right now to start thinking about the best approach

// Render ordering
interface OrderFn = (series: SeriesIdentifier) => number; // number to use as global z-index
interface OrderSortFn = (seriesA: SeriesIdentifier, seriesB: SeriesIdentifier) => -1 | 0 | 1; // relative ordering of series
type Order = OrderFn | OrderSortFn | number // number would be the simplest ordering or spec
interface BasicSeriesSpec {
  order: Order;
}

// Edge clippings
interface EdgeClippingProps {
  lineWidth?: boolean; // including line width on edge
  points?: boolean; // including point radius on edge
  highlighter?: boolean; // include all highlighter elements outside of chart area
  padding?: number; // max padding for clippings
}
interface SettingsSpec {
  // not sure if Settings is the right place for this but it should be a global thing
  edgeClipping: EdgeClippingProps;
  ...
}

Related to #315, #303, #585 & #160

Examples

Overall ordering

Order rendering per spec, based on simple number or order.

Series ordering

Order rendering per series, overriding spec order. For example, select which line gets drawn on top of the other.

image

Edge clipping

Greater control for clipping at the edge for line widths and points

Image 2020-05-12 at 11 57 03 AM

Metadata

Metadata

Assignees

No one assigned

    Labels

    :chartChart element related issue:specsChart specifications related issue:xyBar/Line/Area chart relatedenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions