Syncfusion AI Assistant

How can I help you?

Data markers in EJ2 JavaScript Chart control

3 Feb 202624 minutes to read

Data markers are visual indicators placed at each data point on a series, helping to clearly identify and highlight individual values in your chart. Markers improve readability and accessibility, especially in line and area charts where data points may otherwise be unclear. Customize marker shape, color, size, and appearance to match your design requirements.

Marker

Enable markers for data points by setting the visible option to true in the marker property. Each series receives distinct markers by default, improving visual differentiation.

var numData = [{ x: 2005, y: 28, y1: 18 }, { x: 2006, y: 25, y1: 10 },{ x: 2007, y: 26, y1: 20 }, { x: 2008, y: 47, y1: 35 },
    { x: 2009, y: 32, y1: 23 }, { x: 2010, y: 35, y1: 25 }, { x: 2011, y: 30, y1: 15 }];

var chart = new ej.charts.Chart({
    series: [
        {
            type: 'Line',
            dataSource: numData, xName: 'x', yName: 'y',
            marker: {
                visible: true
            }
        },
        {
            type: 'Line',
            dataSource: numData, xName: 'x', yName: 'y1',
            marker: {
                visible: true
            }
        }
    ],
}, '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Shape

Assign different shapes to markers such as Rectangle, Circle, Diamond, Triangle, and others using the shape property. Shape selection helps distinguish between multiple series and improves visual clarity.

var chartData = [
    { x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
    { x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
    { x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
    { x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
    { x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
    { x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
var chart = new ej.charts.Chart({
        primaryXAxis: {
            title: 'Countries',
            valueType: 'Category', interval: 1,
            labelIntersectAction : 'Rotate45'
        },
        primaryYAxis:
        {
            title: 'Penetration (%)',
            labelFormat: '{value}%',
            minimum: 0, maximum: 90
        },
        series: [
            {
                type: 'Line', name: 'December 2007',
                dataSource: chartData, xName: 'x', yName: 'y', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Diamond'
                }
            }, {
                type: 'Line', name: 'December 2008',
                dataSource: chartData, xName: 'x', yName: 'y1', width: 2,
                //Marker for chart series
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Pentagon'
                }
            }, {
                type: 'Line', name: 'December 2009',
                dataSource: chartData, xName: 'x', yName: 'y2', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Triangle',
                }
            }, {
                type: 'Line', name: 'December 2010',
                dataSource: chartData, xName: 'x', yName: 'y3', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Circle'
                }
            }
        ],
        title: 'FB Penetration of Internet Audience'
}, '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Note : To know more about the marker shape type refer the shape.

Images

Use custom images as markers instead of predefined shapes by setting the imageUrl property. This allows branded or thematic markers that enhance visual appeal and user engagement.

var chartData = [
    { x: "Jan", y: 60 }, { x: "Feb", y: 50 },
    { x: "Mar", y: 64 }, { x: "Apr", y: 63 },
    { x: "May", y: 81 }, { x: "Jun", y: 64 },
    { x: "Jul", y: 82 }, { x: "Aug", y: 96 },
    { x: "Sep", y: 78 }, { x: "Oct", y: 60 },
    { x: "Nov", y: 58 }, { x: "Dec", y: 56 }
];
var chart = new ej.charts.Chart({
        primaryXAxis: {
            title: 'Month',
            valueType: 'Category'
        },
        primaryYAxis:
        {
            title: 'Temperature (Celsius)',
            labelFormat: '{value}°C'
        },
        series: [
            {
                type: 'Line', name: 'India',
                dataSource: chartData, xName: 'x', yName: 'y', width: 2,
                //Marker shape as image
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Image',
                    imageUrl:'sun_annotation.png'
                }
            }
        ],
        title: 'Temperature flow over months'
}, '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Customization

Customize marker appearance by modifying the fill (background color) and border properties. Combined with shape and image options, these customizations enable comprehensive marker styling to match your application design.

var chartData = [
    { x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
    { x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
    { x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
    { x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
    { x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
    { x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
var chart = new ej.charts.Chart({
        primaryXAxis: {
            title: 'Countries',
            valueType: 'Category', interval: 1,
            labelIntersectAction : 'Rotate45'
        },
        primaryYAxis:
        {
            title: 'Penetration (%)',
            labelFormat: '{value}%',
            minimum: 0, maximum: 90
        },
        series: [
            {
                type: 'Line', name: 'December 2007',
                dataSource: chartData, xName: 'x', yName: 'y', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Diamond'
                }
            }, {
                type: 'Line', name: 'December 2008',
                dataSource: chartData, xName: 'x', yName: 'y1', width: 2,
                //Marker for chart series
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Pentagon'
                }
            }, {
                type: 'Line', name: 'December 2009',
                dataSource: chartData, xName: 'x', yName: 'y2', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Triangle',
                }
            }, {
                type: 'Line', name: 'December 2010',
                dataSource: chartData, xName: 'x', yName: 'y3', width: 2,
                marker: {
                    visible: true,
                    width: 10, height: 10,
                    shape: 'Circle'
                }
            }
        ],
        title: 'FB Penetration of Internet Audience'
}, '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Customizing specific point

Use the pointRender event to customize markers for individual data points. This event allows you to conditionally change shape, color, and border properties based on data values or other criteria.

var chartData = [
    { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
    { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
    { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
    { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
    { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
    { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
];
var chart = new ej.charts.Chart({
    primaryXAxis: {
        title: 'Months',
        valueType: 'Category'
    },
    primaryYAxis:
    {
        title: 'Temperature (Celsius)',
        minimum: -20, maximum: 25, interval: 5,
        edgeLabelPlacement: 'Shift',
        labelFormat: '{value}°C'
    },
    series: [
        {
            type: 'Line', name: 'Warmest', width: 2,
            dataSource: chartData, xName: 'x', yName: 'y',
            marker: {
                visible: true,
                height: 10, width: 10,
                shape: 'Pentagon',
                dataLabel: { visible: true }
            }
        }
    ],
    title: 'Alaska Weather Statistics - 2016',
    // pointRender event for chart
    pointRender: (args) => {
        if (args.point.index === 6) {
            args.fill = 'red'
        }
    },
    textRender: (args) => {
        if (args.point.index === 6) {
            args.text = 'Maximum Temperature';
            args.color = 'red';
        }
    }
}, '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Fill marker with series color

Fill markers with the series color by enabling the isFilled property. This creates a cohesive visual design where markers inherit the series color automatically.

var chartData = [
  { x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
  { x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
  { x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
  { x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
  { x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
  { x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 },
];
var chart = new ej.charts.Chart(
  {
    primaryXAxis: {
      title: 'Countries',
      valueType: 'Category',
      interval: 1,
      labelIntersectAction: 'Rotate45',
    },
    primaryYAxis: {
      title: 'Penetration (%)',
      labelFormat: '{value}%',
      minimum: 0,
      maximum: 90,
    },
    series: [
      {
        type: 'Line',
        name: 'December 2007',
        dataSource: chartData,
        xName: 'x',
        yName: 'y',
        width: 2,
        marker: {
          visible: true,
          width: 10,
          height: 10,
          shape: 'Diamond',
          isFilled: true,
        },
      },
      {
        type: 'Line',
        name: 'December 2008',
        dataSource: chartData,
        xName: 'x',
        yName: 'y1',
        width: 2,
        //Marker for chart series
        marker: {
          visible: true,
          width: 10,
          height: 10,
          shape: 'Pentagon',
          isFilled: true,
        },
      },
      {
        type: 'Line',
        name: 'December 2009',
        dataSource: chartData,
        xName: 'x',
        yName: 'y2',
        width: 2,
        marker: {
          visible: true,
          width: 10,
          height: 10,
          shape: 'Triangle',
          isFilled: true,
        },
      },
      {
        type: 'Line',
        name: 'December 2010',
        dataSource: chartData,
        xName: 'x',
        yName: 'y3',
        width: 2,
        marker: {
          visible: true,
          width: 10,
          height: 10,
          shape: 'Circle',
          isFilled: true,
        },
      },
    ],
    title: 'FB Penetration of Internet Audience',
  },
  '#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://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

See also