import {
ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject,
LineSeries, DateTime, Tooltip, Crosshair, Legend
} from '@syncfusion/ej2-react-charts';
const ChartSynfusion = () => {
const john = [{ x: new Date(2000, 2, 11), y: 15 }, { x: new Date(2000, 9, 14), y: 20 },
{ x: new Date(2001, 2, 11), y: 25 }, { x: new Date(2001, 9, 16), y: 21 },
{ x: new Date(2002, 2, 7), y: 13 }, { x: new Date(2002, 9, 7), y: 18 },
{ x: new Date(2003, 2, 11), y: 24 }, { x: new Date(2003, 9, 14), y: 23 },
{ x: new Date(2004, 2, 6), y: 19 }, { x: new Date(2004, 9, 6), y: 31 },
{ x: new Date(2005, 2, 11), y: 39 }, { x: new Date(2005, 9, 11), y: 50 },
{ x: new Date(2006, 2, 11), y: 24 }];
const andrew = [{ x: new Date(2000, 2, 11), y: 39 }, { x: new Date(2000, 9, 14), y: 30 },
{ x: new Date(2001, 2, 11), y: 28 }, { x: new Date(2001, 9, 16), y: 35 },
{ x: new Date(2002, 2, 7), y: 39 }, { x: new Date(2002, 9, 7), y: 41 },
{ x: new Date(2003, 2, 11), y: 45 }, { x: new Date(2003, 9, 14), y: 48 },
{ x: new Date(2004, 2, 6), y: 54 }, { x: new Date(2004, 9, 6), y: 55 },
{ x: new Date(2005, 2, 11), y: 57 }, { x: new Date(2005, 9, 11), y: 60 },
{ x: new Date(2006, 2, 11), y: 60 }];
const thomas = [{ x: new Date(2000, 2, 11), y: 60 }, { x: new Date(2000, 9, 14), y: 55 },
{ x: new Date(2001, 2, 11), y: 48 }, { x: new Date(2001, 9, 16), y: 57 },
{ x: new Date(2002, 2, 7), y: 62 }, { x: new Date(2002, 9, 7), y: 64 },
{ x: new Date(2003, 2, 11), y: 57 }, { x: new Date(2003, 9, 14), y: 53 },
{ x: new Date(2004, 2, 6), y: 63 }, { x: new Date(2004, 9, 6), y: 50 },
{ x: new Date(2005, 2, 11), y: 66 }, { x: new Date(2005, 9, 11), y: 65 },
{ x: new Date(2006, 2, 11), y: 79 }];
const mark = [{ x: new Date(2000, 2, 11), y: 75 }, { x: new Date(2000, 9, 14), y: 75 },
{ x: new Date(2001, 2, 11), y: 68 }, { x: new Date(2001, 9, 16), y: 75 },
{ x: new Date(2002, 2, 7), y: 71 }, { x: new Date(2002, 9, 7), y: 69 },
{ x: new Date(2003, 2, 11), y: 81 }, { x: new Date(2003, 9, 14), y: 84 },
{ x: new Date(2004, 2, 6), y: 85 }, { x: new Date(2004, 9, 6), y: 87 },
{ x: new Date(2005, 2, 11), y: 75 }, { x: new Date(2005, 9, 11), y: 70 },
{ x: new Date(2006, 2, 11), y: 85 }];
const william = [{ x: new Date(2000, 2, 11), y: 85 }, { x: new Date(2000, 9, 14), y: 83 },
{ x: new Date(2001, 2, 11), y: 85 }, { x: new Date(2001, 9, 16), y: 87 },
{ x: new Date(2002, 2, 7), y: 82 }, { x: new Date(2002, 9, 7), y: 74 },
{ x: new Date(2003, 2, 11), y: 73 }, { x: new Date(2003, 9, 14), y: 75 },
{ x: new Date(2004, 2, 6), y: 73 }, { x: new Date(2004, 9, 6), y: 60 },
{ x: new Date(2005, 2, 11), y: 48 }, { x: new Date(2005, 9, 11), y: 55 },
{ x: new Date(2006, 2, 11), y: 40 }];
return (
<>
<div className='control-pane'>
<div className='control-section'>
<ChartComponent style={{ textAlign: "center" }}
primaryXAxis={{
labelStyle: {size: '10px', fontFamily:'Lato'},
minimum: new Date(2000, 1, 1), maximum: new Date(2006, 2, 11),
valueType: 'DateTime',
skeleton: 'y',
lineStyle: { width: 0 },
majorGridLines: { width: 0, color:'#E0E0E0' },
minorGridLines: {width: 0, color:'green'},
minorTicksPerInterval:1,
edgeLabelPlacement: 'Shift'
}}
chartArea={{ border: { width: 0 } }}
primaryYAxis={{
title: 'Jutaan',
labelStyle: {size: '10px', fontFamily: 'Lato'},
labelFormat: '{value}',
majorTickLines: { width: 0 },
minimum: 10, maximum: 80,
lineStyle: { width: 0 },
majorGridLines: {width: 1, dashArray: '4', color: '#E0E0E0'},
minorTicksPerInterval: 1,
}}
isMultiSelect= {true}
legendSettings={{visible:true, alignment: 'Far', position: 'Top'}}
title='Average Sales per Person'
tooltip={{ enable: true, shared: true, template:'${x}' }}
crosshair={{ enable: true, lineType: 'Vertical', verticalLineColor: '#E0E0E0', line:{width: 0.5} }}>
<Inject services={[LineSeries, DateTime, Tooltip, Crosshair, Legend]} />
<SeriesCollectionDirective>
<SeriesDirective dataSource={john} xName='x' yName='y' width={2} name='John'
type='Line' marker={{ visible: false }}>
SeriesDirective>
<SeriesDirective dataSource={andrew} xName='x' yName='y' width={2} name='Andrew'
type='Line' marker={{ visible: false }}>
SeriesDirective>
<SeriesDirective dataSource={thomas} xName='x' yName='y' width={2} name='Thomas'
type='Line' marker={{ visible: false }}>
SeriesDirective>
SeriesCollectionDirective>
ChartComponent>
div>
div>
);
}
export default ChartSynfusion;
i don't use extra configuration, and i just use default project from nextjs typescript