1.0.5 • Published 6 years ago
interactive-scatterplots v1.0.5
interactive-scatterplots
Installation
npm install interactive-scatterplots
API
import scatter from 'interactive-scatterplots'
const svg = scatter.plot(data, x, y[, options])
Parameters
data
an array of rowsx
a column name string or function specifying which data to use on the x axisy
a column name string or function specifying which data to use on the y axis
Options
The options
object can be used to set a number of options. Wherever functions are passed in, they take as their parameter the current data row.
width
(number)height
padding
padding around the chart's grid to fit axis labels and chart title. Object withtop
,right
,bottom
andleft
propertiestitle
the chart's titler
the (constant) radius for each circlerScale
a column name string or function to dynamically scale circle radii between 0 andr
insteadid
a column name string or function to use asdata-id
property on each circle, associated label and voronoi polygonxExtent
/yExtent
the extent (data domain) of the chart in either dimensionxStops
/yStops
the values at which to draw grid lines in the backgroundxLabel
/yLabel
the labels describing the two axesyLabelRight
whether to move the y axis' title to the right hand side of the chartclassCircles
a function returning a class string for each circlestyleCircles
a function returning a CSS properties object for each circlelabel
a function returning a circle's label string, ornull
if it shouldn't be labelledfitLine
whether to draw a line of best fitvoronoi
whether to compute and draw a voronoi grid overlay- ... full docs to follow
Default styles
These can be found in dist/scatter.css
. To import them in Sass:
@import 'node_modules/interactive-scatterplots/dist/scatter';