# chart-line

> Line chart comparing annual crude steel production by country with labels and tooltips.

**Framework:** react  **Component:** Chart  **Variant:** line

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/ts/chart-line.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-charts
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/chart-line/Chart.tsx

```tsx
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, type ILoadedEventArgs, LineSeries, Legend, Double, Tooltip, Highlight, SeriesLabel } from '@syncfusion/ej2-react-charts';
import { Browser } from '@syncfusion/ej2-base';
import { vietnamData, indonesiaData, franceData, polandData, mexicoData } from '../datasource/chart-data';

const Line = () => {
    const onChartLoad = (_args: ILoadedEventArgs): void => {
        const chart: Element | null = document.getElementById('charts');
        if (chart) chart.setAttribute('title', '');
    };

    return (
        <div className='control-pane'>
            <div className='control-section'>
                <ChartComponent
                    id='charts'
                    style={{ textAlign: 'center' }}
                    primaryXAxis={{ valueType: 'Double', edgeLabelPlacement: 'Shift', majorGridLines: { width: 0 } }}
                    primaryYAxis={{ title: 'Volume in million metric tons', labelFormat: '{value}', rangePadding: 'None', minimum: 0, maximum: 25, interval: 5, lineStyle: { width: 0 }, majorTickLines: { width: 0 }, minorTickLines: { width: 0 } }}
                    chartArea={{ border: { width: 0 }, margin: { bottom: 12 } }}
                    tooltip={{ enable: true, enableHighlight: true, showNearestTooltip: true, header: '<b>${series.name}</b>', format: '${point.x} : <b>${point.y}M</b>' }}
                    legendSettings={{ enableHighlight: true }}
                    width={Browser.isDevice ? '100%' : '75%'}
                    title='Annual Crude Steel Production by Country (2016–2024)'
                    subTitle='Source: wikipedia.org'
                    loaded={onChartLoad}
                >
                    <Inject services={[LineSeries, Double, Legend, Tooltip, Highlight, SeriesLabel]} />
                    <SeriesCollectionDirective>
                        <SeriesDirective dataSource={vietnamData} xName='x' yName='y' name='Vietnam' width={2} marker={{ visible: true, width: 7, height: 7, shape: 'Circle', isFilled: true }} type='Line' labelSettings={{ visible: true }} />
                        <SeriesDirective dataSource={indonesiaData} xName='x' yName='y' name='Indonesia' width={2} marker={{ visible: true, width: 6, height: 6, shape: 'Triangle', isFilled: true }} type='Line' labelSettings={{ visible: true }} />
                        <SeriesDirective dataSource={franceData} xName='x' yName='y' name='France' width={2} marker={{ visible: true, width: 7, height: 7, shape: 'Diamond', isFilled: true }} type='Line' labelSettings={{ visible: true }} />
                        <SeriesDirective dataSource={polandData} xName='x' yName='y' name='Poland' width={2} marker={{ visible: true, width: 5, height: 5, shape: 'Rectangle', isFilled: true }} type='Line' labelSettings={{ visible: true }} />
                        <SeriesDirective dataSource={mexicoData} xName='x' yName='y' name='Mexico' width={2} marker={{ visible: true, width: 7, height: 7, shape: 'Pentagon', isFilled: true }} type='Line' labelSettings={{ visible: true }} />
                    </SeriesCollectionDirective>
                </ChartComponent>
            </div>
        </div>
    );
};

export default Line;

```
