# chart-combination-chart

> Combination chart blends columns and a trend line to compare performance metrics.

**Framework:** react  **Component:** Chart  **Variant:** combination-chart

## 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-combination-chart.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-combination-chart/Chart.tsx

```tsx

import {
    ChartComponent,
    SeriesCollectionDirective,
    SeriesDirective,
    AxesDirective,
    AxisDirective,
    Inject,
    Category,
    SplineSeries,
    SplineAreaSeries,
    ColumnSeries,
    Legend,
    Tooltip,
    Crosshair,
    StripLine,
    DataLabel,
    type AxisModel,
    type LegendSettingsModel,
   type  ILegendRenderEventArgs
} from '@syncfusion/ej2-react-charts';

interface BusinessData {
    month: string;
    revenue: number;
    profit: number;
    orders: number;
    revenueLabel: string;
    profitLabel: string;
}

const businessData: BusinessData[] = [
    { month: 'Jan', revenue: 65000, profit: 18000, orders: 240, revenueLabel: '$65K', profitLabel: '$18K' },
    { month: 'Feb', revenue: 72000, profit: 22000, orders: 270, revenueLabel: '$72K', profitLabel: '$22K' },
    { month: 'Mar', revenue: 81000, profit: 25000, orders: 340, revenueLabel: '$81K', profitLabel: '$25K' },
    { month: 'Apr', revenue: 76000, profit: 21000, orders: 310, revenueLabel: '$76K', profitLabel: '$21K' },
    { month: 'May', revenue: 94000, profit: 31000, orders: 390, revenueLabel: '$94K', profitLabel: '$31K' },
    { month: 'Jun', revenue: 102000, profit: 34000, orders: 420, revenueLabel: '$102K', profitLabel: '$34K' }
];

// Custom legend template.
// Avoid fixed widths so the legend layout can calculate item spacing naturally.
const legendTemplate =
    '<div style="display:inline-flex;align-items:center;gap:12px;padding:10px 16px;min-height:68px;box-sizing:border-box;border:1px solid #e2e8f0;border-radius:10px;background:#ffffff;white-space:nowrap;cursor:pointer;">' +
        '<span style="display:flex;align-items:center;justify-content:center;min-width:28px;font-size:25px;font-weight:600;color:{{color}};">{{icon}}</span>' +
        '<div style="display:flex;flex-direction:column;gap:3px;">' +
            '<span style="font-size:16px;font-weight:600;color:#1e293b;">{{title}}</span>' +
            '<span style="font-size:12px;color:#64748b;">{{description}}</span>' +
        '</div>' +
    '</div>';

const legendSettings: LegendSettingsModel = {
    visible: true,
    position: 'Top',
    alignment: 'Center',
    layout: 'Horizontal',
    width: '100%',
    height: '95px',
    itemPadding: 15,
    enablePages: false,
    template: legendTemplate
};

// Customize legend content for each series.
const handleLegendRender = (args: ILegendRenderEventArgs): void => {
    const legendDetails: Record<string, { icon: string; description: string }> = {
        Revenue: {
            icon: '↗',
            description: '($ in Thousands)'
        },
        Profit: {
            icon: '⌁',
            description: '($ in Thousands)'
        },
        Orders: {
            icon: '▮',
            description: '(Count)'
        }
    };

    const details = legendDetails[args.text];

    if (!details) {
        return;
    }

    args.template = legendTemplate
        .replace('{{color}}', args.fill)
        .replace('{{icon}}', details.icon)
        .replace('{{title}}', args.text)
        .replace('{{description}}', details.description);
};

// X-axis with April promotional campaign strip line.
const primaryXAxis: AxisModel = {
    valueType: 'Category',
    majorGridLines: { width: 0 },
    majorTickLines: { width: 0 },
    lineStyle: {
        color: '#cbd5e1',
        width: 1
    },
    labelStyle: {
        color: '#64748b',
        size: '12px'
    },
    stripLines: [
        {
            start: 3,
            end: 4,
            color: '#a855f7',
            opacity: 0.14,
            visible: true,
            text: 'April Promotion',
            horizontalAlignment: 'Middle',
            verticalAlignment: 'Middle',
            rotation: -90,
            zIndex: 'Behind',
            textStyle: {
                color: '#7e22ce',
                size: '11px',
                fontWeight: '600'
            }
        }
    ]
};

// Primary Y-axis with $80K revenue target.
const primaryYAxis: AxisModel = {
    minimum: 0,
    maximum: 120000,
    interval: 20000,
    title: 'Amount ($ in Thousands)',
    labelFormat: '${value}',
    majorGridLines: {
        width: 1,
        color: '#e2e8f0',
        dashArray: '3,3'
    },
    majorTickLines: { width: 0 },
    lineStyle: { width: 0 },
    labelStyle: {
        color: '#64748b',
        size: '11px'
    },
    stripLines: [
        {
            start: 80000,
            end: 80500,
            color: '#f59e0b',
            opacity: 0.12,
            visible: true,
            text: 'Revenue Target: $80K',
            horizontalAlignment: 'End',
            verticalAlignment: 'Start',
            rotation: 0,
            zIndex: 'Over',
            textStyle: {
                color: '#b45309',
                size: '11px',
                fontWeight: '600'
            },
            border: {
                color: '#f59e0b',
                width: 1
            }
        }
    ]
};

// Revenue data labels: name maps revenueLabel to point.text.
const revenueMarker = {
    visible: true,
    width: 7,
    height: 7,
    shape: 'Circle' as const,
    fill: '#ffffff',
    border: {
        color: '#1683ed',
        width: 2
    },
    dataLabel: {
        visible: true,
        name: 'revenueLabel',
        template:
            '<div style="padding:4px 7px;border:1px solid #1683ed;border-radius:5px;background:#ffffff;color:#1683ed;font-size:11px;font-weight:600;white-space:nowrap;">${point.text}</div>',
        position: 'Top' as const
    }
};

// Profit data labels: name maps profitLabel to point.text.
const profitMarker = {
    visible: true,
    width: 6,
    height: 6,
    shape: 'Circle' as const,
    fill: '#ffffff',
    border: {
        color: '#16a765',
        width: 2
    },
  
};

function App() {
    return (
        <div className="business-performance">
            <style>{`
                .business-performance {
                    width: 100%;
                    padding: 16px;
                    box-sizing: border-box;
                    background: #ffffff;
                    border: 1px solid #e2e8f0;
                    border-radius: 12px;
                    font-family: Arial, sans-serif;
                }

                .business-chart-title {
                    text-align: center;
                    color: #1e293b;
                    font-size: 24px;
                    font-weight: 600;
                    margin: 8px 0 4px;
                }

                .business-chart-subtitle {
                    text-align: center;
                    color: #64748b;
                    font-size: 14px;
                    margin-bottom: 4px;
                }

                .business-performance .e-legend-item {
                    cursor: pointer;
                }

                .business-performance .e-legend-item:hover {
                    opacity: 0.88;
                }

                @media (max-width: 850px) {
                    .business-chart-title {
                        font-size: 20px;
                    }

                    .business-performance .e-legend {
                        height: auto !important;
                    }
                }

                @media (max-width: 600px) {
                    .business-performance {
                        padding: 8px;
                    }

                    .business-chart-title {
                        font-size: 18px;
                    }

                    .business-chart-subtitle {
                        font-size: 12px;
                    }
                }
            `}</style>

            <div className="business-chart-title">
                Business Revenue, Profit and Order Performance
            </div>

            <div className="business-chart-subtitle">
                Monthly performance analysis | January – June 2024
            </div>

            <ChartComponent
                id="business-performance-chart"
                height="500px"
                width="100%"
                primaryXAxis={primaryXAxis}
                primaryYAxis={primaryYAxis}
                tooltip={{
                    enable: true,
                    shared: true
                }}
                crosshair={{
                    enable: true,
                    lineType: 'Vertical',
                    line: {
                        color: '#94a3b8',
                        width: 1,
                        dashArray: '4,4'
                    }
                }}
                legendSettings={legendSettings}
                legendRender={handleLegendRender}
                chartArea={{
                    border: { width: 0 }
                }}
                background="transparent"
            >
                <Inject services={[
                    Category,
                    SplineSeries,
                    SplineAreaSeries,
                    ColumnSeries,
                    Legend,
                    Tooltip,
                    Crosshair,
                    StripLine,
                    DataLabel
                ]} />

                <AxesDirective>
                    <AxisDirective
                        name="ordersAxis"
                        opposedPosition={true}
                        minimum={0}
                        maximum={600}
                        interval={100}
                        title="Orders (Count)"
                        majorGridLines={{ width: 0 }}
                        majorTickLines={{ width: 0 }}
                        lineStyle={{ width: 0 }}
                    />
                </AxesDirective>

                <SeriesCollectionDirective>
                    {/* Revenue - Spline */}
                    <SeriesDirective
                        dataSource={businessData}
                        xName="month"
                        yName="revenue"
                        name="Revenue"
                        type="Spline"
                        width={2.5}
                        fill="#1683ed"
                        marker={revenueMarker}
                    />

                    {/* Profit - Spline Area */}
                    <SeriesDirective
                        dataSource={businessData}
                        xName="month"
                        yName="profit"
                        name="Profit"
                        type="SplineArea"
                        width={2}
                        fill="#16a765"
                        opacity={0.20}
                        border={{
                            color: '#16a765',
                            width: 2
                        }}
                        marker={profitMarker}
                    />

                    {/* Orders - Column */}
                    <SeriesDirective
                        dataSource={businessData}
                        xName="month"
                        yName="orders"
                        name="Orders"
                        type="Column"
                        yAxisName="ordersAxis"
                        fill="#9747ff"
                        columnWidth={0.5}
                        columnSpacing={0.2}
                    />
                </SeriesCollectionDirective>
            </ChartComponent>

            <div style={{
                textAlign: 'center',
                color: '#64748b',
                fontSize: '11px',
                marginTop: '4px'
            }}>
                April represents the promotional campaign period.
                The orange strip line indicates the $80K revenue target.
            </div>
        </div>
    );
}

export default App;

```
