A JavaScript helper to plot data.
This article describes the PointList class.
Creates a new point list that contains the points that are drawn on the canvas.
Syntax:
const pointList = new Plotter.PointList()
Arguments: none.
Returns:
PointList: a new instance of PointListAll properties have corresponding getters and setters which you can use to read or write the properties’ values. The setters return the instance of the point itself.
array<Point> points: the list of points (default: []).Along with the getters and setters, the PointList class has the following methods:
addPointAdds a point to the point list.
Syntax:
PointList pointList.addPoint(Point point)
Arguments:
Point point: the point to be addedReturns:
PointList: the same instance of PointListaddPointsAdds points to the point list.
Syntax:
PointList pointList.addPoints(Point... points)
Arguments:
Point... points: an arbitrary amount of points to be addedReturns:
PointList: the same instance of PointListsortBring the points in the list into a special order.
Syntax:
PointList pointList.sort(((Point a, Point b) => number) sortingFunction = PointList.prototype.defaultSortingFunction)
Arguments:
((Point a, Point b) => number) sortingFunction (optional): a function that determines the order the point’s will be brought into be returning the result of a comparison between two points. More on this topic: MDN on Array.prototype.sortReturns:
PointList: the same instance of PointListdefaultSortingFunctionCompares two points.
Syntax:
number pointList.defaultSortingFunction(Point a, Point b)
Arguments:
Point a, Point b: two points that should be comparedReturns:
number: the result of the comparisongetMinimumX, getMaximumX, getMinimumY, getMaximumYReturns the minimum or maximum extent of the points in the list in x or y direction.
Syntax:
number pointList.getMinimumX()
number pointList.getMaximumX()
number pointList.getMinimumY()
number pointList.getMaximumY()
Arguments: none.
Returns:
number: the minimum or maximum extent of the points in the list in x or y direction