Select Range Area (Circle, Rectangle, Lasso) in Scatter Chart with LightningChart JS
LightningChart JS is a powerful and flexible JavaScript library for creating data visualization and charting applications. This article will focus on the scatter chart component of LightningChart JS, specifically on how to select a range area using different shapes such as circles, rectangles, and lassos.
Introduction to Scatter Charts
Scatter charts are used to visualize the relationship between two sets of data, typically displayed as points on a graph. LightningChart JS provides a scatter chart component that can be customized and configured to meet the needs of various applications. The scatter chart component supports various features, including selecting a range area using different shapes.
Selecting a Range Area
Selecting a range area in a scatter chart is an essential feature for analyzing and comparing data. LightningChart JS provides several options for selecting a range area, including circles, rectangles, and lassos. The following sections will cover each of these options in detail.
Selecting a Range Area using a Circle
To select a range area using a circle in LightningChart JS, you can use the chart.selectArea({ type: 'circle', x: x, y: y, radius: radius }) method. This method takes three parameters: the type of selection (in this case, 'circle'), the x and y coordinates of the center of the circle, and the radius of the circle. Once the circle is drawn, any points within the circle will be selected.
Selecting a Range Area using a Rectangle
To select a range area using a rectangle in LightningChart JS, you can use the chart.selectArea({ type: 'rectangle', x: x1, y: y1, x2: x2, y2: y2 }) method. This method takes four parameters: the type of selection (in this case, 'rectangle'), the x and y coordinates of the top-left corner of the rectangle, and the x and y coordinates of the bottom-right corner of the rectangle. Once the rectangle is drawn, any points within the rectangle will be selected.
Selecting a Range Area using a Lasso
To select a range area using a lasso in LightningChart JS, you can use the chart.selectArea({ type: 'lasso', points: points }) method. This method takes two parameters: the type of selection (in this case, 'lasso') and an array of points that define the lasso shape. Once the lasso is drawn, any points within the lasso will be selected.
Applications and Significance
Selecting a range area in a scatter chart is a crucial feature for data analysis and comparison. By selecting a range area, users can focus on a specific subset of data and perform further analysis. This feature is particularly useful in applications such as finance, engineering, and scientific research, where analyzing large datasets is a common task.
LightningChart JS provides a powerful and flexible scatter chart component that supports selecting a range area using different shapes such as circles, rectangles, and lassos. By using these selection options, users can focus on specific subsets of data and perform further analysis. This feature is essential for applications that require data analysis and comparison, making LightningChart JS an ideal choice for developers and data analysts alike.