Type Alias: PlotDefinition
PlotDefinition =
object
Defined in: plots/registered.ts:232
A plot: D3 drawing code plus what the plot accepts and knows.
Built-in plots and user plots are both definitions, registered with registerPlot. Only name and draw are required; every other field is optional and refines the generic behavior.
Properties
annotations?
optionalannotations?:"reference"
Defined in: plots/registered.ts:234
Opts in to page-supplied reference annotations on positional axes.
arrange?
optionalarrange?: (context) =>void
Defined in: plots/registered.ts:291
Rearranges the drawing after every selection change (e.g. a table that keeps the selected rows on top). Called after each draw too.
Parameters
context
Returns
void
baseColor?
optionalbaseColor?: (rows) => (row) =>string
Defined in: plots/registered.ts:296
Color of a mark that is neither highlighted nor colored by an attribute (gray by default), from the rendered rows: e.g. a shade per subgroup.
Parameters
rows
Returns
(row) => string
color?
optionalcolor?:"fill"|"stroke"
Defined in: plots/registered.ts:256
Mark property the plot colors. Defaults to fill.
colorAttribute?
optionalcolorAttribute?:string
Defined in: plots/registered.ts:280
Row field the marks are colored by when attributes.color is unset (e.g. value).
colorDomain?
optionalcolorDomain?: (domain) => [number,number]
Defined in: plots/registered.ts:278
Adjusts a numeric color domain computed from the data; a configured domainSpec is kept.
Parameters
domain
[number, number]
Returns
[number, number]
defaultNumericInterpolator?
optionaldefaultNumericInterpolator?:ColorMapInterpolator
Defined in: plots/registered.ts:302
Numeric colormap used when none is configured.
defaults?
optionaldefaults?:Partial<PlotConfig> | ((config) =>Partial<PlotConfig>)
Defined in: plots/registered.ts:300
Defaults for options the configuration leaves unset (labels are merged field by field).
draw
draw: (
context) =>void| {highlight?:Partial<Record<MarkKind,HighlightRule>>;series?:PlotSeries[]; }
Defined in: plots/registered.ts:247
Draws the marks for the rendered rows. Called on every draw. It may return highlight parameters known only while drawing (e.g. the scale of members), which complete highlight per mark family (a word or a function is refused here: it belongs to highlight), and the series drawn through the marks.
Parameters
context
Returns
void | { highlight?: Partial<Record<MarkKind, HighlightRule>>; series?: PlotSeries[]; }
highlight?
optionalhighlight?:PlotHighlight
Defined in: plots/registered.ts:254
How a mark shows the part of it that a selection from another view produces: 'boolean', 'subset' (the default, inferred from the geometry), a custom preset, a highlight per mark family (families left out are inferred), or a function that draws the parts (give each element the class autkPartial and data-autk-provenance). See PlotHighlight.
label?
optionallabel?:string
Defined in: plots/registered.ts:240
Name shown in error messages. Defaults to name.
markStyle?
optionalmarkStyle?: (row,highlighted) =>Record<string,string|number>
Defined in: plots/registered.ts:286
Style of a mark besides its color, by whether it is highlighted (e.g. translucent links that become opaque). The part of a mark takes the highlighted style, since it is the highlighted share of the mark.
Parameters
row
highlighted
boolean
Returns
Record<string, string | number>
name
name:
string
Defined in: plots/registered.ts:238
Name used in { type: 'registered', plot: name } (the type itself for a built-in plot).
reducers?
optionalreducers?: readonlyTransformReducer[]
Defined in: plots/registered.ts:270
Reducers whose rows the plot can draw (e.g. ['count', 'sum'] when marks must add up to a whole). Any reducer when absent.
requiresTransform?
optionalrequiresTransform?:boolean
Defined in: plots/registered.ts:265
Whether the plot draws only transformed rows, refusing a configuration without one of transforms.
series?
optionalseries?:true
Defined in: plots/registered.ts:236
Opts in to grouped input on shared scales.
topK?
optionaltopK?:boolean
Defined in: plots/registered.ts:298
Whether rows can be cut to the top k (PlotConfig.topK). Defaults to true.
transformOptions?
optionaltransformOptions?: (area,options) =>Record<string,unknown>
Defined in: plots/registered.ts:276
Options the plot gives its transform at every draw, from the drawing area and the configured options (e.g. binning-hex bins in the plot's pixels; a Pareto chart orders by value unless told otherwise).
Parameters
area
height
number
width
number
options
Record<string, unknown>
Returns
Record<string, unknown>
transforms?
optionaltransforms?: readonlystring[]
Defined in: plots/registered.ts:263
Transforms the plot reads: transform names, or row shapes (RowShape) that any transform, built-in or user, may yield. Any transform when absent.
validate?
optionalvalidate?: (config) =>void
Defined in: plots/registered.ts:304
Checks the configuration before drawing; throws to refuse it.
Parameters
config
Returns
void
value?
optionalvalue?:string
Defined in: plots/registered.ts:258
Row field the marks encode, for the highlight inference. Defaults to the second axis field, or value.