{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "chart-financial",
  "framework": "angular",
  "type": "registry:component",
  "component": "Chart",
  "variant": "financial",
  "dependencies": [
    "@syncfusion/ej2-angular-charts"
  ],
  "description": "Financial chart with switchable candlestick, Hilo, and line series; time range filtering and trading volume.",
  "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/angular/llms.txt",
    "skillPack": "syncfusion/angular-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/angular/chart-financial.md"
  },
  "files": [
    {
      "target": "src/components/chart-financial/financial.component.html",
      "content": "<div class=\"stock-market-sample\">\n    <div class=\"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 class=\"stock-market-toolbar\">\n        <select class=\"stock-market-series-select\" [value]=\"seriesType\" (change)=\"onSeriesTypeChange($event)\"\n            aria-label=\"Select series type\">\n            @for (option of seriesOptions; track option) {\n                <option [value]=\"option\" [selected]=\"option === seriesType\">{{ getOptionText(option) }}</option>\n            }\n        </select>\n\n        <div class=\"stock-market-periods\" role=\"group\" aria-label=\"Select period range\">\n            @for (period of periods; track period) {\n                <button type=\"button\" class=\"stock-market-period-button\"\n                    [class.active]=\"selectedPeriod === period\"\n                    [attr.aria-pressed]=\"selectedPeriod === period\"\n                    (click)=\"onPeriodChange(period)\">\n                    {{ period }}\n                </button>\n            }\n        </div>\n    </div>\n\n    <div class=\"stock-market-chart\">\n        <ejs-chart id=\"stock-market-analysis\" height=\"450px\" title=\"\" background=\"transparent\"\n            [primaryXAxis]=\"primaryXAxis\" [primaryYAxis]=\"primaryYAxis\"\n            [tooltip]=\"tooltip\" [crosshair]=\"crosshair\" [legendSettings]=\"legendSettings\">\n            <e-axes>\n                <e-axis name=\"volumeYAxis\" [opposedPosition]=\"false\" [minimum]=\"0\" [maximum]=\"volumeMaximum * 5\"\n                    [majorGridLines]=\"zeroLine\" [lineStyle]=\"zeroLine\" [majorTickLines]=\"zeroLine\"\n                    [labelStyle]=\"transparentLabel\"></e-axis>\n            </e-axes>\n\n            <e-series-collection>\n                <e-series [dataSource]=\"visibleData\" xName=\"date\" name=\"Stock Price\" [type]=\"chartSeriesType\"\n                    low=\"low\" high=\"high\" open=\"open\" close=\"close\" yName=\"close\"\n                    [bullFillColor]=\"bullColor\" [bearFillColor]=\"bearColor\" [enableTooltip]=\"true\"\n                    [animation]=\"animation\" [opacity]=\"seriesOpacity\" [width]=\"2\"></e-series>\n\n                <e-series [dataSource]=\"visibleData\" xName=\"date\" yName=\"volume\" name=\"Volume\" type=\"Column\"\n                    yAxisName=\"volumeYAxis\" fill=\"#90A4AE\" [opacity]=\"0.3\" [enableTooltip]=\"false\"\n                    [animation]=\"animation\"></e-series>\n            </e-series-collection>\n        </ejs-chart>\n    </div>\n</div>\n"
    },
    {
      "target": "src/components/chart-financial/financial.component.ts",
      "content": "import { Component, ViewEncapsulation } from '@angular/core';\nimport {\n    ChartModule,\n    DateTimeService,\n    CandleSeriesService,\n    LineSeriesService,\n    HiloSeriesService,\n    HiloOpenCloseSeriesService,\n    StepLineSeriesService,\n    ColumnSeriesService,\n    TooltipService,\n    CrosshairService,\n    LegendService,\n    StripLineService,\n    type AxisModel,\n    type StripLineSettingsModel,\n    type TooltipSettingsModel,\n    type CrosshairSettingsModel,\n    type LegendSettingsModel,\n    type AnimationModel,\n    type ChartSeriesType\n} from '@syncfusion/ej2-angular-charts';\nimport { stockData1Completed } from '../datasource/chart-data';\n\ntype SeriesType = 'Candle' | 'Line' | 'Hilo' | 'HiloOpenClose' | '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\ninterface DateRange {\n    minimum: Date;\n    maximum: Date;\n}\n\n@Component({\n    selector: 'app-financial',\n    standalone: true,\n    imports: [ChartModule],\n    providers: [\n        DateTimeService, CandleSeriesService, LineSeriesService, HiloSeriesService,\n        HiloOpenCloseSeriesService, StepLineSeriesService, ColumnSeriesService,\n        TooltipService, CrosshairService, LegendService, StripLineService\n    ],\n    templateUrl: './financial.component.html',\n    styleUrls: ['../styles/financial.component.css'],\n    encapsulation: ViewEncapsulation.None\n})\nexport class FinancialComponent {\n    public periods: RangeType[] = ['1M', '3M', '6M', 'YTD', '1Y', 'All'];\n\n    public seriesOptions: SeriesType[] = ['Candle', 'Line', 'Hilo', 'HiloOpenClose', 'StepLine'];\n\n    public seriesType: SeriesType = 'Candle';\n    public selectedPeriod: RangeType = 'All';\n\n    public bullColor: string = '#43A047';\n    public bearColor: string = '#E53935';\n\n    private allData: StockData[] = stockData1Completed\n        .map((item: StockData) => ({ ...item, date: new Date(item.date) }))\n        .sort((a: StockData, b: StockData) => a.date.getTime() - b.date.getTime());\n\n    private minDate: Date = this.allData.length ? this.allData[0].date : new Date();\n    private maxDate: Date = this.allData.length ? this.allData[this.allData.length - 1].date : new Date();\n\n    // Values recomputed whenever the series type or period changes.\n    public visibleData: StockData[] = [];\n    public primaryXAxis: AxisModel = {};\n    public primaryYAxis: AxisModel = {};\n    public volumeMaximum: number = 1;\n    public seriesOpacity: number = 0.8;\n\n    public tooltip: TooltipSettingsModel = {\n        enable: true,\n        shared: true,\n        enableMarker: false, // React sample used 'showMarker', which is not a TooltipSettings property\n        format: '${series.name}: ${point.y}'\n    };\n\n    public crosshair: CrosshairSettingsModel = { enable: true, dashArray: '3,3', lineType: 'Both' };\n\n    public legendSettings: LegendSettingsModel = { visible: false };\n\n    public animation: AnimationModel = { enable: false };\n\n    public zeroLine: { width: number } = { width: 0 };\n\n    public transparentLabel: { color: string } = { color: 'transparent' };\n\n    constructor() {\n        this.updateChart();\n    }\n\n    public getOptionText(option: SeriesType): string {\n        return option === 'HiloOpenClose' ? 'Hilo Open/Close' : option;\n    }\n\n    public get chartSeriesType(): ChartSeriesType {\n        return this.seriesType as ChartSeriesType;\n    }\n\n    public onSeriesTypeChange(event: Event): void {\n        this.seriesType = (event.target as HTMLSelectElement).value as SeriesType;\n        this.updateChart();\n    }\n\n    public onPeriodChange(period: RangeType): void {\n        this.selectedPeriod = period;\n        this.updateChart();\n    }\n\n    private getAxisRange(): DateRange {\n        const end: Date = new Date(this.maxDate.getTime());\n        const start: Date = new Date(end.getTime());\n\n        switch (this.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: this.minDate, maximum: this.maxDate };\n        }\n\n        return { minimum: start, maximum: end };\n    }\n\n    private updateChart(): void {\n        const axisRange: DateRange = this.getAxisRange();\n        const visibleData: StockData[] = this.allData.filter(\n            (item: StockData) => item.date >= axisRange.minimum && item.date <= axisRange.maximum\n        );\n\n        const lows: number[] = visibleData.map((item: StockData) => item.low);\n        const highs: number[] = visibleData.map((item: StockData) => item.high);\n        const minimum: number = Math.min(...lows);\n        const maximum: number = Math.max(...highs);\n        const padding: number = Math.max(1, (maximum - minimum) * 0.02);\n\n        const resistance: number = maximum;\n        const support: number = minimum;\n        const isShortPeriod: boolean = this.selectedPeriod === '1M' || this.selectedPeriod === '3M';\n\n        const stripLines: StripLineSettingsModel[] = this.selectedPeriod === 'All'\n            ? [\n                { start: support, end: support + 0.1, text: 'Support', color: '#43A047', visible: true, opacity: 0.8, dashArray: '3,3' },\n                { start: resistance - 0.1, end: resistance, text: 'Resistance', color: '#E53935', visible: true, opacity: 0.8, dashArray: '3,3' }\n            ]\n            : [];\n\n        this.visibleData = visibleData;\n        this.volumeMaximum = Math.max(...visibleData.map((item: StockData) => item.volume), 1);\n        this.seriesOpacity = this.seriesType === 'Candle' ? 0.8 : 1;\n\n        this.primaryXAxis = {\n            valueType: 'DateTime',\n            minimum: axisRange.minimum,\n            maximum: axisRange.maximum,\n            labelFormat: isShortPeriod ? 'd MMM' : 'MMM yyyy',\n            intervalType: isShortPeriod ? 'Days' : 'Months',\n            edgeLabelPlacement: 'Shift',\n            majorGridLines: { width: 0 },\n            crosshairTooltip: { enable: true }\n        };\n\n        this.primaryYAxis = {\n            minimum: Math.floor((minimum - padding) / 20) * 20,\n            maximum: Math.ceil((maximum + padding) / 20) * 20,\n            opposedPosition: true,\n            labelFormat: 'n2',\n            majorGridLines: { width: 1, color: '#eeeeee' },\n            crosshairTooltip: { enable: true },\n            stripLines: stripLines\n        };\n    }\n}\n"
    }
  ]
}