on GitHub

ScatterChart

One point per row: x against y, for correlations and clusters. The rows come straight from SQL.

Loading…
<ScatterChart
  data="db.iris"
  x="sepal_length"
  y="petal_length"
  xTitle="sepal length (cm)"
  yTitle="petal length (cm)"
/>

Color and size the points

A hue column colors points by category, and a size column scales each point, a fourth dimension on the same plot.

Loading…
<ScatterChart
  data="db.iris"
  x="sepal_length"
  y="petal_length"
  hue="species"
  size="petal_width"
  xTitle="sepal length (cm)"
  yTitle="petal length (cm)"
  legend="bottom"
/>

Props

PropTypeNotes
data / queryrelation | SQLSource rows; a relation, or full SQL. Mutually exclusive.
x / ycolumnPoint coordinates.
huecolumnColor points by a category.
sizecolumnScale point area by a numeric column.
xTitle / yTitlestringAxis titles.
xFormat / valueFormatd3-format specHow the axis and y values render.
legend"top" | "bottom" | "left" | "right" | "none"Legend placement.

Expressions in query and filters values support {{binding}} interpolation against the surrounding BindingProvider.

Installation

ScatterChart ships in @n6k.io/ui/components. Nothing to install. Register the namespace once in src/app/mdx-components.tsx and the tag resolves in both .mdx and page.py pages:

import * as n6k from "@n6k.io/ui/components";

export function useMDXComponents(components: MDXComponents): MDXComponents {
  return {
    ...n6k, // ScatterChart, and every other n6k component
    ...components,
  } as unknown as MDXComponents;
}