{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "chart-financial",
  "framework": "react",
  "type": "registry:component",
  "component": "Chart",
  "variant": "financial",
  "dependencies": [
    "@syncfusion/ej2-react-charts"
  ],
  "description": "Financial chart with candlestick and line series for a multi-day stock trend.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/ts/chart-financial.md"
  },
  "files": [
    {
      "target": "src/components/chart-financial/Chart.tsx",
      "content": "import { useMemo, useState } from 'react';\nimport {\n    ChartComponent,\n    SeriesCollectionDirective,\n    SeriesDirective,\n    AxesDirective,\n    AxisDirective,\n    Inject,\n    DateTime,\n    CandleSeries,\n    LineSeries,\n    HiloSeries,\n    HiloOpenCloseSeries,\n    StepLineSeries,\n    ColumnSeries,\n    Tooltip,\n    Crosshair,\n    Legend\n} from '@syncfusion/ej2-react-charts';\n\nimport type { AxisModel } from '@syncfusion/ej2-react-charts';\nimport { stockData1Completed } from '../datasource/chart-data';\n\ntype SeriesType =\n    | 'Candle'\n    | 'Line'\n    | 'Hilo'\n    | 'HiloOpenClose'\n    | 'StepLine';\n\ntype RangeType = '1M' | '3M' | '6M' | 'YTD' | '1Y' | 'All';\n\ninterface StockData {\n    date: Date;\n    open: number;\n    high: number;\n    low: number;\n    close: number;\n    volume: number;\n}\n\nconst periods: RangeType[] = ['1M', '3M', '6M', 'YTD', '1Y', 'All'];\n\nconst seriesOptions: SeriesType[] = [\n    'Candle',\n    'Line',\n    'Hilo',\n    'HiloOpenClose',\n    'StepLine'\n];\n\nexport default function App() {\n    const [seriesType, setSeriesType] = useState<SeriesType>('Candle');\n    const [selectedPeriod, setSelectedPeriod] = useState<RangeType>('All');\n\n    const bullColor = '#43A047';\n    const bearColor = '#E53935';\n\n    const allData = useMemo<StockData[]>(() => {\n        return stockData1Completed\n            .map((item) => ({\n                ...item,\n                date: new Date(item.date)\n            }))\n            .sort((a, b) => a.date.getTime() - b.date.getTime());\n    }, []);\n\n    const minDate = allData[0]?.date ?? new Date();\n    const maxDate = allData[allData.length - 1]?.date ?? new Date();\n\n    const axisRange = useMemo(() => {\n        const end = new Date(maxDate);\n        const start = new Date(end);\n\n        switch (selectedPeriod) {\n            case '1M':\n                start.setMonth(end.getMonth() - 1);\n                break;\n            case '3M':\n                start.setMonth(end.getMonth() - 3);\n                break;\n            case '6M':\n                start.setMonth(end.getMonth() - 6);\n                break;\n            case 'YTD':\n                start.setMonth(0, 1);\n                start.setHours(0, 0, 0, 0);\n                break;\n            case '1Y':\n                start.setFullYear(end.getFullYear() - 1);\n                break;\n            case 'All':\n                return { minimum: minDate, maximum: maxDate };\n        }\n\n        return { minimum: start, maximum: end };\n    }, [selectedPeriod, minDate, maxDate]);\n\n    const visibleData = useMemo(() => {\n        return allData.filter(\n            (item) =>\n                item.date >= axisRange.minimum &&\n                item.date <= axisRange.maximum\n        );\n    }, [allData, axisRange]);\n\n    const priceRange = useMemo(() => {\n        const lows = visibleData.map((item) => item.low);\n        const highs = visibleData.map((item) => item.high);\n\n        const minimum = Math.min(...lows);\n        const maximum = Math.max(...highs);\n        const padding = Math.max(1, (maximum - minimum) * 0.02);\n\n        return {\n            minimum: Math.floor((minimum - padding) / 20) * 20,\n            maximum: Math.ceil((maximum + padding) / 20) * 20\n        };\n    }, [visibleData]);\n\n    const volumeMaximum = useMemo(\n        () => Math.max(...visibleData.map((item) => item.volume), 1),\n        [visibleData]\n    );\n\n    const resistance = Math.max(...visibleData.map((item) => item.high));\n    const support = Math.min(...visibleData.map((item) => item.low));\n\n    const primaryXAxis: AxisModel = {\n        valueType: 'DateTime',\n        minimum: axisRange.minimum,\n        maximum: axisRange.maximum,\n        labelFormat: selectedPeriod === '1M' || selectedPeriod === '3M'\n            ? 'd MMM'\n            : 'MMM yyyy',\n        intervalType: selectedPeriod === '1M' || selectedPeriod === '3M'\n            ? 'Days'\n            : 'Months',\n        edgeLabelPlacement: 'Shift',\n        majorGridLines: { width: 0 },\n        crosshairTooltip: { enable: true }\n    };\n\n    const primaryYAxis: AxisModel = {\n        minimum: priceRange.minimum,\n        maximum: priceRange.maximum,\n        opposedPosition: true,\n        labelFormat: 'n2',\n        majorGridLines: { width: 1, color: '#eeeeee' },\n        crosshairTooltip: { enable: true },\n        stripLines: selectedPeriod === 'All'\n            ? [\n                {\n                    start: support,\n                    end: support + 0.1,\n                    text: 'Support',\n                    color: '#43A047',\n                    visible: true,\n                    opacity: 0.8,\n                    dashArray: '3,3'\n                },\n                {\n                    start: resistance - 0.1,\n                    end: resistance,\n                    text: 'Resistance',\n                    color: '#E53935',\n                    visible: true,\n                    opacity: 0.8,\n                    dashArray: '3,3'\n                }\n            ]\n            : []\n    };\n\n\n    const tooltip = {\n        enable: true,\n        shared: true,\n        showMarker: false,\n        format: '${series.name}: ${point.y}'\n    };\n\n   const crosshair = {\n    enable: true,\n    dashArray: '3,3',\n    lineType: 'Both' as const\n};\n    return (\n        <>\n            <style>{`\n                .stock-market-sample {\n                    box-sizing: border-box;\n                    width: 100%;\n                    height: calc(100vh - 105px);\n                    min-height: 520px;\n                    padding: 20px 24px 24px;\n                    overflow-y: auto;\n                    overflow-x: hidden;\n                    background: #f8fafc;\n                    scrollbar-gutter: stable;\n                }\n\n                .stock-market-header {\n                    text-align: center;\n                    margin: 2px 0 20px;\n                }\n\n                .stock-market-header h2 {\n                    margin: 0 0 6px;\n                    color: #172554;\n                    font-size: 25px;\n                    line-height: 1.3;\n                    font-weight: 650;\n                }\n\n                .stock-market-header p {\n                    margin: 0;\n                    color: #64748b;\n                    font-size: 14px;\n                }\n\n                .stock-market-toolbar {\n                    display: flex;\n                    align-items: center;\n                    justify-content: space-between;\n                    flex-wrap: wrap;\n                    gap: 12px 16px;\n                    width: 100%;\n                    min-width: 0;\n                    margin: 0 0 14px;\n                }\n\n                .stock-market-series-select {\n                    box-sizing: border-box;\n                    min-width: 155px;\n                    height: 38px;\n                    padding: 0 12px;\n                    border: 1px solid #cbd5e1;\n                    border-radius: 7px;\n                    background: #fff;\n                    color: #334155;\n                    font-size: 14px;\n                    outline: none;\n                }\n\n                .stock-market-series-select:focus-visible,\n                .stock-market-period-button:focus-visible {\n                    outline: 2px solid #38bdf8;\n                    outline-offset: 2px;\n                }\n\n                .stock-market-periods {\n                    display: flex;\n                    align-items: center;\n                    justify-content: flex-end;\n                    flex-wrap: wrap;\n                    gap: 7px;\n                    min-width: 0;\n                    max-width: 100%;\n                }\n\n                .stock-market-period-button {\n                    flex: 0 0 auto;\n                    min-width: 49px;\n                    height: 36px;\n                    padding: 0 13px;\n                    border: 1px solid #dbe2ea;\n                    border-radius: 7px;\n                    background: #fff;\n                    color: #475569;\n                    font-size: 13px;\n                    font-weight: 500;\n                    cursor: pointer;\n                    transition: background-color .15s ease, color .15s ease,\n                                border-color .15s ease, box-shadow .15s ease;\n                }\n\n                .stock-market-period-button:hover {\n                    border-color: #7dd3fc;\n                    background: #f0f9ff;\n                }\n\n                .stock-market-period-button.active {\n                    border-color: #0284c7;\n                    background: #0284c7;\n                    color: #fff;\n                    box-shadow: 0 1px 3px rgba(2, 132, 199, .2);\n                }\n\n                .stock-market-chart {\n                    width: 100%;\n                    min-width: 0;\n                    height: 470px;\n                    padding: 8px 10px 4px;\n                    box-sizing: border-box;\n                    border: 1px solid #e2e8f0;\n                    border-radius: 10px;\n                    background: #fff;\n                    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);\n                }\n\n                .stock-market-chart .e-chart {\n                    width: 100% !important;\n                }\n\n                @media (max-width: 900px) {\n                    .stock-market-sample {\n                        padding: 16px;\n                    }\n\n                    .stock-market-toolbar {\n                        align-items: flex-start;\n                        flex-direction: column;\n                    }\n\n                    .stock-market-periods {\n                        justify-content: flex-start;\n                    }\n                }\n\n                @media (max-width: 600px) {\n                    .stock-market-sample {\n                        height: calc(100vh - 90px);\n                        min-height: 480px;\n                        padding: 12px;\n                    }\n\n                    .stock-market-header h2 {\n                        font-size: 21px;\n                    }\n\n                    .stock-market-chart {\n                        height: 400px;\n                        padding: 4px;\n                    }\n\n                    .stock-market-periods {\n                        width: 100%;\n                        justify-content: flex-start;\n                    }\n                }\n            `}</style>\n\n            <div className=\"stock-market-sample\">\n                <div className=\"stock-market-header\">\n                    <h2>Acme Inc. Stock Market Analysis</h2>\n                    <p>Historical stock price and trading volume</p>\n                </div>\n\n                <div className=\"stock-market-toolbar\">\n                    <select\n                        className=\"stock-market-series-select\"\n                        value={seriesType}\n                        onChange={(event) =>\n                            setSeriesType(event.target.value as SeriesType)\n                        }\n                        aria-label=\"Select series type\"\n                    >\n                        {seriesOptions.map((option) => (\n                            <option key={option} value={option}>\n                                {option === 'HiloOpenClose'\n                                    ? 'Hilo Open/Close'\n                                    : option}\n                            </option>\n                        ))}\n                    </select>\n\n                    <div className=\"stock-market-periods\" role=\"group\" aria-label=\"Select period range\">\n                        {periods.map((period) => (\n                            <button\n                                key={period}\n                                type=\"button\"\n                                className={`stock-market-period-button ${selectedPeriod === period ? 'active' : ''}`}\n                                aria-pressed={selectedPeriod === period}\n                                onClick={() => setSelectedPeriod(period)}\n                            >\n                                {period}\n                            </button>\n                        ))}\n                    </div>\n                </div>\n\n                <div className=\"stock-market-chart\">\n            <ChartComponent\n                id=\"stock-market-analysis\"\n                height=\"450px\"\n                primaryXAxis={primaryXAxis}\n                primaryYAxis={primaryYAxis}\n                tooltip={tooltip}\n                crosshair={crosshair}\n                legendSettings={{ visible: false }}\n                title=\"\"\n                background=\"transparent\"\n            >\n                <Inject services={[\n                    DateTime,\n                    CandleSeries,\n                    LineSeries,\n                    HiloSeries,\n                    HiloOpenCloseSeries,\n                    StepLineSeries,\n                    ColumnSeries,\n                    Tooltip,\n                    Crosshair,\n                    Legend\n                ]} />\n\n                <AxesDirective>\n                    <AxisDirective\n                        name=\"volumeYAxis\"\n                        opposedPosition={false}\n                        minimum={0}\n                        maximum={volumeMaximum * 5}\n                        majorGridLines={{ width: 0 }}\n                        lineStyle={{ width: 0 }}\n                        majorTickLines={{ width: 0 }}\n                        labelStyle={{ color: 'transparent' }}\n                    />\n                </AxesDirective>\n\n                <SeriesCollectionDirective>\n                    <SeriesDirective\n                        dataSource={visibleData}\n                        xName=\"date\"\n                        name=\"Stock Price\"\n                        type={seriesType}\n                        low=\"low\"\n                        high=\"high\"\n                        open=\"open\"\n                        close=\"close\"\n                        yName=\"close\"\n                        bullFillColor={bullColor}\n                        bearFillColor={bearColor}\n                        enableTooltip={true}\n                        animation={{ enable: false }}\n                        opacity={seriesType === 'Candle' ? 0.8 : 1}\n                        width={2}\n                    />\n\n                    <SeriesDirective\n                        dataSource={visibleData}\n                        xName=\"date\"\n                        yName=\"volume\"\n                        name=\"Volume\"\n                        type=\"Column\"\n                        yAxisName=\"volumeYAxis\"\n                        fill=\"#90A4AE\"\n                        opacity={0.3}\n                        enableTooltip={false}\n                        animation={{ enable: false }}\n                    />\n                </SeriesCollectionDirective>\n                </ChartComponent>\n                </div>\n            </div>\n        </>\n    );\n}"
    }
  ]
}