Skip to content

Static/Responsive Scatterplot Graphs (w/ Units)

Choose a tag to compare

@pwoidke pwoidke released this 13 Dec 13:53
· 16 commits to master since this release

This release contains code for a demo page, jQuery, the Scatterplot.js plugin, and scatterplot.css. This plugin allows for a scatterplot-style chart to be created using $(target).scatter(); and for points to be plotted using $(target).plot();.

The responsive option can be added to .scatter(). When set to true, the graph, labels, and points display responsively by using percentages for positioning. These percentages are not perfect, but they will keep everything pretty close to accurate when scaling the scatterplot.

Units can be specified in the settings of .scatter(): xUnits for the units on the X-axis and yUnits for units on the Y-axis. These settings take an array and print the array items evenly spaced along their corresponding axis, such that the first is at the bottom-left corner, and the last is at the right or top edge.