Having trouble getting help?
Contact Support
Contact Support
Marker customization in EJ2 JavaScript Chart control
8 May 20237 minutes to read
By using the pointRender
, you can customize the marker shape.
To Customize the marker shape, follow the given steps:
Step 1:
Customize the marker shape in each data point by using the pointRender
event. Using this event, you can set the shape
value to the argument.
var shapes = [
'Diamond', 'Circle','Rectangle', 'Line', 'Triangle', 'Rectangle'
];
var shapeRender = function(args) {
args.shape = shapes[args.point.index];
}
var chart = new ej.charts.Chart({
//Initializing Primary X Axis
primaryXAxis: {
title: 'Countries', valueType: 'Category',
interval: 1
},
//Initializing Primary Y Axis
primaryYAxis:
{
title: 'Penetration', rangePadding: 'None',
labelFormat: '{value}%', minimum: 0,
maximum: 75, interval: 15
},
//Initializing Chart Series
series: [
{
type: 'Line',
dataSource: [{ x: 'WW', y: 12, text: 'World Wide' },
{ x: 'EU', y: 5, text: 'Europe' },
{ x: 'APAC', y: 15, text: 'Pacific' },
{ x: 'LATAM', y: 6.4, text: 'Latin' },
{ x: 'MEA', y: 30, text: 'Africa' },
{ x: 'NA', y: 25.3, text: 'America' }],
name: 'December 2007',
marker: {
visible: true, width: 10, height: 10,
shape: 'Diamond', dataLabel: { name: 'text' }
},
xName: 'x', width: 2,
yName: 'y',
},
],
//Initializing Chart title
title: 'FB Penetration of Internet Audience',
legendSettings: { visible: false },
pointRender: shapeRender,
width:'650px',
height: '350px'
}, '#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="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/29.1.33/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div class="col-sm-8">
<div class="row">
<div class="col-sm-4">
<div id="container">
<div id="element" style="width:350px; height:350px;float:left">
</div>
<label id="lbl"></label>
</div>
</div>
<div class="col-sm-4" style="width:200px; height:350px;float: right">
<div id="Grid">
</div>
</div>
</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>