@graph-paper/datagraphic v0.0.0-alpha.15
@graph-paper/datagraphic
FIXME: fill out more of this doc
The main parent component for data graphic generation.
Props for <DataGraphic />
xType(string, defaultlinear) the type of x axis scale.yType(string, defaultlinear) the type of y axis scale.width(number) the width of the graph in pixels. If omitted, the data graphic will inflate to take up the width of the parent ofDataGraphic.height(number, default300) the height of the graph in pixels. If omitted, will default to 300. If passed in a value ofnull, the data graphic will inflate to take up the height of the parent ofDataGraphic.left/right/top/bottom(number) the padding between the edge and the plot body, in pixelsxMin/xMax(number) the x-axis min and maxxDomain(array of two numbers) an array that contains the min and max. If omitted, will be generated from the children ofDataGraphic. IfxMinorxMaxare specified, these individually take precedence over their respective values inxDomain.yMin/yMax(number, optional) the y-axis min and maxyDomain(array of two numbers) an array that contains the min and max of the y axis. If omitted, will be generated from the children ofDataGraphic. IfyMinoryMaxare specified, these individually take precedence over their respective values inyDomain.mousePositionFILL IN used primarily withbinddataGraphicMountedFILL IN used primarily withbindborder- (boolean, defaultfalse) draw all the graphic borders, which delineate the plot area from the margins. Render an individual border withleftBorder,rightBorder,topBorder, andbottomBorder.borderSize- (number, default 1) the thickness of the borders. Change a side's border sizing withleftBorderSize,rightBorderSize,topBorderSize, andbottomBorderSize. Requiresborderto betrue.borderColor- (string, defaultvar(--cool-gray-200)) the color of the borders. Change a side's border color withleftBorderColor,rightBorderColor,topBorderColor, andbottomBorderColor. Requiresborderto betrue.borderOpacity- (string, defaultvar(--cool-gray-200)) the opacity of the borders. Change a side's border opacity withleftBorderOpacity,rightBorderOpacity,topBorderOpacity, andbottomBorderOpacity. Requiresborderto betrue.
Slots
All slots in DataGraphic fit within the SVG element, best utilized through g
tags, eg <g slot="body">...</g>. These slots constitute the fundamental layers
of a data graphic. They render in this order:
body-backgrounda background layer clipped to the graphic bodybackgrounda background layer not clipped to the graphic bodybodythe main layer, clipped to the graphic body area- the unnamed slot
annotationused for markers, annotations, and the likeinteractionused for user interactions like mouse events, scrubbing, etc.
And they all contain the same slot props:
xScalethe current x scale functionyScalethe current y scale functionleft/right/top/bottomthe padding between the edge of the plot body, in pixelswidththe current width of the graph, in pixelsheightthe current height of the graph, in pixelsmousePositionthe current mouse position FILL THIS IN SOMEWHERE
These slot props allow users to mix and match Graph Paper components with custom ones / plain SVG.
The slots can be used in any way users prefer. The semantics of the slots are meant mostly to convey the order they render in.
Context keys / stores
Children of DataGraphic have a number of contexts available to them.
FIXME
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago