SheetXL - v0.8.0-beta.25
    Preparing search index...

    Interface ChartKindBeta

    A kind of chart group: how its series are laid out. The built-in kinds (bar, line, area, scatter, bubble, pie, of-pie, radar, surface) are registered through ChartKinds the way a custom kind is, and a custom group (ChartModel.Group.type === 'custom') is laid out by the kind registered under custom:<its kind>.

    The layout lays out the chart's chrome (title, legend, plot area, axes and their scales) and asks each group's kind for the group: where its bars, points, slices or whatever it draws go.

    The context a kind is given speaks the layout's frame units today: points from the frame's origin, as the layout works in them, with at and px to convert. This may change to px, as ChartLayout uses, while the API is in beta.

    coordinates says what the chrome lays out for the kind: cartesian, a pair of axes (category and value, or a scatter's two value axes) whose scales are fit to what ChartKind.categoryAxis says the group plots; plot, nothing but the plot's inside (a pie); own, the kind lays out the whole plot area and its axes itself (a radar, a surface).

    interface ChartKind {
        coordinates: "own" | "cartesian" | "plot";
        types: readonly string[];
        categoryAxis?(group: Group): "x" | "y" | null;
        drawn?(group: Group): boolean;
        hitTest?(group: GroupLayout, point: Point): Hit | null;
        layout?(group: Group, context: LayoutContext): GroupLayout;
        layoutChart?(groups: Group[], context: ChartContext): ChartLayout;
        plotRect?(groups: Group[], inner: Box): Box;
        pointBounds?(
            group: GroupLayout,
            series: number,
            point: number,
        ): Bounds | null;
        stack?(group: Group): Stack;
    }
    Index
    coordinates: "own" | "cartesian" | "plot"

    What the chrome lays out for a group of the kind.

    types: readonly string[]

    The group types the kind lays out: a built-in group type ('bar', 'line', 'stock'...), or custom:<kind> for a custom group's kind.

    • Beta

      A cartesian kind: which of the group's axes carries its categories, 'x' along the bottom or top, 'y' up a side (horizontal bars), or null for a group on two value axes (a scatter), whose x values the horizontal axis's scale is fit to.

      Parameters

      • group: Group

      Returns "x" | "y" | null

      'x'

    • Beta

      Whether a group of the kind is drawn at all. A group not drawn takes no axis, no legend key and no room.

      Parameters

      • group: Group

      Returns boolean

      true

    • Beta

      What the group drew at point, in px from the chart's top-left as its layout speaks: the series there and, where one can be told, its point; null where the group drew nothing. A series drawn later covers one drawn before it, as Excel draws them. Without it a press on the group's drawing selects the plot area.

      Parameters

      Returns Hit | null

    • Beta

      An own kind: the whole chart's layout, given its chrome, for the chart's groups, which are all of the kind.

      Parameters

      Returns ChartLayout

    • Beta

      A plot kind: the inside the groups of the kind take of the plot's inside (a pie's square). Asked of the first plot kind among the chart's drawn groups, with every drawn group of it.

      Parameters

      • groups: Group[]
      • inner: Box

      Returns Box

    • Beta

      The box a point of the group is drawn in, in px: a bar, the marker's box about a line's point, a slice's box; null for a point not drawn. A series' box is the union of its points'.

      Parameters

      Returns Bounds | null

    • Beta

      A cartesian kind: what each series plots against its value axis, which the value axis's scale is fit to (tops), and each series' part of it (own). By default the series' values, stacked as the group's grouping says.

      Parameters

      • group: Group

      Returns Stack