Fiddle: https://jsfiddle.net/kindersingh/5eb3hzts/1/
var chart = new ej.charts.Chart({
primaryXAxis: {
title: 'Years',
lineStyle: { width: 0 },
labelFormat: 'y',
intervalType: 'Years',
valueType: 'DateTime',
edgeLabelPlacement: 'Shift'
},
primaryYAxis:
{
title: 'Currency ($)',
// minimum: 0, maximum: 20, interval: 2,
labelFormat: 'C0'
},
series: [
{
type: 'StepLine',
dataSource: chartData, xName: 'x', yName: 'y',
width: 2, name: 'China',
marker: {
visible: true, width: 10, height: 10
},
},
{
type: 'StepLine',
dataSource: chartData, xName: 'x', yName: 'y1',
width: 2, name: 'Australia',
marker: {
visible: true, width: 10, height: 10
},
},
{
type: 'StepLine',
dataSource: chartData, xName: 'x', yName: 'y2',
width: 2, name: 'Japan',
marker: {
visible: true, width: 10, height: 10
},
},
],
title: 'Unemployment Rates 1975-2010',
tooltip: {
enable: true,
}
}, '#element');
I want to show Currency in a line chart for syncfusion EJ2 Line chart with proper commas.
I have tried putting a custom function for Tooltip.format and also tried a custom function for Charts.PrimaryYAxis.labelFormat but it is giving an error.
Also tried Data Label formats https://ej2.syncfusion.com/javascript/documentation/chart/data-labels#format but not getting commas.
How to put commas with currency? Is there an in-built way?
How to do it via custom functions without an in-built way?