Skip to content

chart

Creates a ChartBuilder. This is the entry point for every GoFish chart.

js
gf.Chart(seafood)
  .flow(gf.spread("lake", { dir: "x" }))
  .mark(gf.rect({ h: "count" }))
  .render(root, { w: 400, h: 250, axes: true });

Signature

ts
chart(data, options?)

Parameters

ParameterTypeDescription
dataTThe dataset to visualize
options.wnumberWidth hint for the chart frame
options.hnumberHeight hint for the chart frame
options.coordCoordinateTransformCoordinate transform (e.g. polar())

Returns a ChartBuilder<T> with .flow(), .mark(), and .render() methods.

Example

ts
chart(data)
  .flow(spread("category", { dir: "x" }))
  .mark(rect({ h: "value" }))
  .render(container, { w: 500, h: 300, axes: true });