JavaScript Point Clusters Chart

This example shows how to create clusters of differently colored points, how to get the boundaries of a series and use them to draw frames around each cluster.

The most efficient way to draw point cloud clusters is utilizing PointSeries. The description of how to configure the visual appearance of points can be found in previous tutorials and more information can be found in API documentation.

//  Create point series which represents a single cluster.
const cluster = chart.addPointSeries()

Boundaries

Each series automatically computes its boundaries based on the data input and configuration of a series. Get the boundaries in axis values using the following methods:

// Cache min corner of a series (this would be bottom left on progressive axes).
const minCorner = {
    x: series.getXMin(),
    y: series.getYMin(),
}

// Cache max corner of a series (this would be top right on progressive axes).
const maxCorner = {
    x: series.getXMax(),
    y: series.getYMax(),
}

The boundary rectangle is defined by two points in 2D space. The same methods are applicable to all the series as well as progressive series in any directions.