HelpBot Assistant

How can I help you?

Scatter Chart in EJ2 TypeScript Charts

3 Feb 202624 minutes to read

Scatter Chart

To render a scatter series in your chart, you need to follow a few steps to configure it correctly. Here’s a concise guide on how to do this:

  • Set the series type: Define the series type as Scatter in your chart configuration. This indicates that the data should be displayed as individual points scattered across the chart.

  • Inject the ScatterSeries module: Use the Chart.Inject(ScatterSeries) method to inject the ScatterSeries module into your chart. This step is essential, as it ensures that the necessary functionalities for rendering the scatter series are available in your chart.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        minimum: 120, maximum: 180,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
    },
    primaryYAxis:
    {
        title: 'Weight (kg)',
        minimum: 60, maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
    },
    series: [
        {
            //Series type as scatter
            type: 'Scatter',
            dataSource: series1, xName: 'x', yName: 'y',
            name: 'Male',
            marker: { width: 10, height: 10 }
        },
        {
            type: 'Scatter',
            dataSource: series2, xName: 'x', yName: 'y',
            name: 'Female',
            marker: { width: 10, height: 10 }
        }
    ],
    title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Binding data with series

You can bind data to the chart using the dataSource property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName and yName properties.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        minimum: 120, maximum: 180,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
    },
    primaryYAxis:
    {
        title: 'Weight (kg)',
        minimum: 60, maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
    },
    series: [
        {
            //Series type as scatter
            type: 'Scatter',
            dataSource: series1, xName: 'x', yName: 'y',
            name: 'Male',
            marker: { width: 10, height: 10 }
        },
        {
            type: 'Scatter',
            dataSource: series2, xName: 'x', yName: 'y',
            name: 'Female',
            marker: { width: 10, height: 10 }
        }
    ],
    title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Series customization

The following properties can be used to customize the scatter series.

Fill

The fill property determines the color applied to the series.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        minimum: 120,
        maximum: 180,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
      },
      primaryYAxis: {
        title: 'Weight (kg)',
        minimum: 60,
        maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
      },
      series: [
        {
          type: 'Scatter',
          dataSource: series1,
          xName: 'x',
          yName: 'y',
          name: 'Male',
          marker: { width: 5, height: 5 }
        },
        {
          type: 'Scatter',
          dataSource: series2,
          xName: 'x',
          yName: 'y',
          name: 'Female',
          fill: 'red',
          marker: { width: 3, height: 3 }
        }
      ],
      title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Opacity

The opacity property controls the transparency of the fill and affects how the series blends with background or overlapping series.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        minimum: 120,
        maximum: 180,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
      },
      primaryYAxis: {
        title: 'Weight (kg)',
        minimum: 60,
        maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
      },
      series: [
        {
          type: 'Scatter',
          dataSource: series1,
          xName: 'x',
          yName: 'y',
          name: 'Male',
          opacity: 0.7,
          marker: { width: 5, height: 5 }
        },
        {
          type: 'Scatter',
          dataSource: series2,
          xName: 'x',
          yName: 'y',
          name: 'Female',
          opacity: 0.7,
          fill: 'red',
          marker: { width: 3, height: 3 }
        }
      ],
      title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Shape

The shape property allows you to customize the appearance of the markers by specifying different shapes.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 120; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        minimum: 120,
        maximum: 180,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
      },
      primaryYAxis: {
        title: 'Weight (kg)',
        minimum: 60,
        maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
      },
      series: [
        {
          type: 'Scatter',
          dataSource: series1,
          xName: 'x',
          yName: 'y',
          name: 'Male',
          opacity: 0.7,
          marker: { width: 5, height: 5, shape: 'Triangle' }
        },
        {
          type: 'Scatter',
          dataSource: series2,
          xName: 'x',
          yName: 'y',
          name: 'Female',
          opacity: 0.7,
          fill: 'red',
          marker: { width: 3, height: 3, shape: 'Square' }
        }
      ],
      title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Border

Use the border property to configure the border width, color, and dasharray of the scatter series.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
Chart.Inject(ScatterSeries, Legend);

let series1: Object[] = [];
let series2: Object[] = [];
let point1: Object;
let value: number = 80;
let value1: number = 70;
let i: number;
for (i = 1; i < 8; i++) {
    if (Math.random() > 0.5) {
        value += Math.random();
    } else {
        value -= Math.random();
    }
    value = value < 60 ? 60 : value > 90 ? 90 : value;
    point1 = { x: 120 + (i / 2), y: value.toFixed(1) };
    series1.push(point1);
}
for (i = 1; i < 8; i++) {
    if (Math.random() > 0.5) {
        value1 += Math.random();
    } else {
        value1 -= Math.random();
    }
    value1 = value1 < 60 ? 60 : value1 > 90 ? 90 : value1;
    point1 = { x: 120 + (i / 2), y: value1.toFixed(1) };
    series2.push(point1);
}

let chart: Chart = new Chart({
    primaryXAxis: {
        title: 'Height (cm)',
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}cm'
      },
      primaryYAxis: {
        title: 'Weight (kg)',
        minimum: 60,
        maximum: 90,
        labelFormat: '{value}kg',
        rangePadding: 'None'
      },
      series: [
        {
          type: 'Scatter',
          dataSource: series1,
          xName: 'x',
          yName: 'y',
          name: 'Male',
          opacity: 0.7,
          border: { width: 2, color: 'red' },
          marker: { width: 22, height: 22, shape: 'Circle' },
        },
        {
          type: 'Scatter',
          dataSource: series2,
          xName: 'x',
          yName: 'y',
          name: 'Female',
          opacity: 0.7,
          fill: 'red',
          border: { width: 2, color: 'Blue', dashArray: '15,2' },
          marker: { width: 22, height: 22, shape: 'Circle' },
        }
      ],
      title: 'Height Vs Weight'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>

Empty points

Data points with null or undefined values are considered empty. Empty data points are ignored and not plotted on the chart.

Mode

Use the mode property to control handling of empty points. Available modes: Gap, Drop, Zero, Average. The default mode is Gap.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
import { scatterData } from './datasource.ts';
Chart.Inject(ScatterSeries, Legend);

let chart: Chart = new Chart({
    primaryXAxis: {
        minimum: 0,
        maximum: 21,
        interval: 3,
        majorGridLines: { width: 0 },
        title: 'Study Hours (Per Week)'
    },
    primaryYAxis:
    {
        title: 'Test Scores (%)',
        minimum: 0,
        maximum: 120,
        interval: 20,
        labelFormat: '{value}%'
    },
    series: [
        {
            type: 'Scatter',
            dataSource: scatterData,
            xName: 'x',
            yName: 'y', 
            marker: {
                visible: false,
                width: 10,
                height: 10,
                shape: 'Circle'
            },
            emptyPointSettings: {
                mode: 'Zero'
            }
        }
    ],
    title: 'Relationship Between Study Hours and Test Scores'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>
export let scatterData: Object[] = [
    { x: 1, y: 15 },
    { x: 2, y: 25 },
    { x: 3, y: 35 },
    { x: 4, y: null },
    { x: 5, y: 55 },
    { x: 6, y: 60 },
    { x: 7, y: 65 },
    { x: 8, y: 70 },
    { x: 9, y: 75 },
    { x: 10, y: 80 },
    { x: 11, y: undefined },
    { x: 12, y: 90 },
    { x: 13, y: 92 },
    { x: 14, y: 94 },
    { x: 15, y: 96 },
    { x: 16, y: null },
    { x: 17, y: 98 },
    { x: 18, y: 99 },
    { x: 19, y: 100 },
    { x: 20, y: 100 }
];

Fill

Use the fill property to set the fill color for empty points.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
import { scatterData } from './datasource.ts';
Chart.Inject(ScatterSeries, Legend);

let chart: Chart = new Chart({
    primaryXAxis: {
        minimum: 0,
        maximum: 21,
        interval: 3,
        majorGridLines: { width: 0 },
        title: 'Study Hours (Per Week)'
    },
    primaryYAxis:
    {
        title: 'Test Scores (%)',
        minimum: 0,
        maximum: 120,
        interval: 20,
        labelFormat: '{value}%'
    },
    series: [
        {
            type: 'Scatter',
            dataSource: scatterData,
            xName: 'x',
            yName: 'y', 
            marker: {
                visible: false,
                width: 10,
                height: 10,
                shape: 'Circle'
            },
            emptyPointSettings: {
                mode: 'Average',
                fill: 'red'
            }
        }
    ],
    title: 'Relationship Between Study Hours and Test Scores'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>
export let scatterData: Object[] = [
    { x: 1, y: 15 },
    { x: 2, y: 25 },
    { x: 3, y: 35 },
    { x: 4, y: null },
    { x: 5, y: 55 },
    { x: 6, y: 60 },
    { x: 7, y: 65 },
    { x: 8, y: 70 },
    { x: 9, y: 75 },
    { x: 10, y: 80 },
    { x: 11, y: undefined },
    { x: 12, y: 90 },
    { x: 13, y: 92 },
    { x: 14, y: 94 },
    { x: 15, y: 96 },
    { x: 16, y: null },
    { x: 17, y: 98 },
    { x: 18, y: 99 },
    { x: 19, y: 100 },
    { x: 20, y: 100 }
];

Border

Use the border property to customize the border width and color for empty points.

import { Chart, ScatterSeries, Legend } from '@syncfusion/ej2-charts';
import { scatterData } from './datasource.ts';
Chart.Inject(ScatterSeries, Legend);

let chart: Chart = new Chart({
    primaryXAxis: {
        minimum: 0,
        maximum: 21,
        interval: 3,
        majorGridLines: { width: 0 },
        title: 'Study Hours (Per Week)'
    },
    primaryYAxis:
    {
        title: 'Test Scores (%)',
        minimum: 0,
        maximum: 120,
        interval: 20,
        labelFormat: '{value}%'
    },
    series: [
        {
            type: 'Scatter',
            dataSource: scatterData,
            xName: 'x',
            yName: 'y', 
            marker: {
                visible: false,
                width: 10,
                height: 10,
                shape: 'Circle'
            },
            emptyPointSettings: {
                mode: 'Average',
                fill: 'red',
                border: { width: 2, color: 'green' }
            }
        }
    ],
    title: 'Relationship Between Study Hours and Test Scores'
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>
export let scatterData: Object[] = [
    { x: 1, y: 15 },
    { x: 2, y: 25 },
    { x: 3, y: 35 },
    { x: 4, y: null },
    { x: 5, y: 55 },
    { x: 6, y: 60 },
    { x: 7, y: 65 },
    { x: 8, y: 70 },
    { x: 9, y: 75 },
    { x: 10, y: 80 },
    { x: 11, y: undefined },
    { x: 12, y: 90 },
    { x: 13, y: 92 },
    { x: 14, y: 94 },
    { x: 15, y: 96 },
    { x: 16, y: null },
    { x: 17, y: 98 },
    { x: 18, y: 99 },
    { x: 19, y: 100 },
    { x: 20, y: 100 }
];

Events

Series render

The seriesRender event enables modification of series properties (for example, data, fill, or name) immediately before rendering. Use this event to adjust series appearance or to dynamically swap data sources.

import { Chart, ScatterSeries, Legend, ISeriesRenderEventArgs } from '@syncfusion/ej2-charts';
import { scatterData } from './datasource.ts';
Chart.Inject(ScatterSeries, Legend);

let chart: Chart = new Chart({
    primaryXAxis: {
        minimum: 0,
        maximum: 21,
        interval: 3,
        majorGridLines: { width: 0 },
        title: 'Study Hours (Per Week)'
    },
    primaryYAxis:
    {
        title: 'Test Scores (%)',
        minimum: 0,
        maximum: 120,
        interval: 20,
        labelFormat: '{value}%'
    },
    series: [
        {
            type: 'Scatter',
            dataSource: scatterData,
            xName: 'x',
            yName: 'y', 
            marker: {
                visible: false,
                width: 10,
                height: 10,
                shape: 'Circle'
            }
        }
    ],
    title: 'Relationship Between Study Hours and Test Scores',
    seriesRender: (args: ISeriesRenderEventArgs) => {
        args.fill = '#ff6347';
    }
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>
export let scatterData: Object[] = [
    { x: 1, y: 15 },
    { x: 2, y: 25 },
    { x: 3, y: 35 },
    { x: 4, y: 45 },
    { x: 5, y: 55 },
    { x: 6, y: 60 },
    { x: 7, y: 65 },
    { x: 8, y: 70 },
    { x: 9, y: 75 },
    { x: 10, y: 80 },
    { x: 11, y: 85 },
    { x: 12, y: 90 },
    { x: 13, y: 92 },
    { x: 14, y: 94 },
    { x: 15, y: 96 },
    { x: 16, y: 97 },
    { x: 17, y: 98 },
    { x: 18, y: 99 },
    { x: 19, y: 100 },
    { x: 20, y: 100 }
];

Point render

The pointRender event provides a hook to customize each data point (for example, marker shape, border, or fill) before it is drawn. Use this to apply per-point styling rules or conditional formatting.

import { Chart, ScatterSeries, Legend, IPointRenderEventArgs } from '@syncfusion/ej2-charts';
import { scatterData } from './datasource.ts';
Chart.Inject(ScatterSeries, Legend);

let chart: Chart = new Chart({
    primaryXAxis: {
        minimum: 0,
        maximum: 21,
        interval: 3,
        majorGridLines: { width: 0 },
        title: 'Study Hours (Per Week)'
    },
    primaryYAxis:
    {
        title: 'Test Scores (%)',
        minimum: 0,
        maximum: 120,
        interval: 20,
        labelFormat: '{value}%'
    },
    series: [
        {
            type: 'Scatter',
            dataSource: scatterData,
            xName: 'x',
            yName: 'y', 
            marker: {
                visible: false,
                width: 10,
                height: 10,
                shape: 'Circle'
            }
        }
    ],
    title: 'Relationship Between Study Hours and Test Scores',
    pointRender: (args: IPointRenderEventArgs) => {
        if (args.point.index % 2 !== 0) {
            args.fill = '#ff6347';
        }
        else {
            args.fill = '#009cb8';
        }
    }
}, '#element');
<!DOCTYPE html>
<html lang="en">

<head>
    <title>EJ2 Animation</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="index.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
    <script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>

<body>
    <div id='loader'>Loading....</div>
    <div id='container'>
        <div id='element'></div>
    </div>
</body>

</html>
export let scatterData: Object[] = [
    { x: 1, y: 15 },
    { x: 2, y: 25 },
    { x: 3, y: 35 },
    { x: 4, y: 45 },
    { x: 5, y: 55 },
    { x: 6, y: 60 },
    { x: 7, y: 65 },
    { x: 8, y: 70 },
    { x: 9, y: 75 },
    { x: 10, y: 80 },
    { x: 11, y: 85 },
    { x: 12, y: 90 },
    { x: 13, y: 92 },
    { x: 14, y: 94 },
    { x: 15, y: 96 },
    { x: 16, y: 97 },
    { x: 17, y: 98 },
    { x: 18, y: 99 },
    { x: 19, y: 100 },
    { x: 20, y: 100 }
];

See also