{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "chart-bubble",
  "framework": "angular",
  "type": "registry:component",
  "component": "Chart",
  "variant": "bubble",
  "dependencies": [
    "@syncfusion/ej2-angular-charts"
  ],
  "description": "Bubble chart comparing internet penetration, GDP, and population across world regions with custom legend.",
  "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-bubble.md"
  },
  "files": [
    {
      "target": "src/components/chart-bubble/bubble.component.html",
      "content": "<div class=\"control-pane country-development\">\n    <div class=\"sample-title\">\n        Global Country Development and Economic Analysis\n    </div>\n\n    <div class=\"sample-subtitle\">\n        Internet penetration, GDP growth and population comparison\n    </div>\n\n    <div class=\"control-section\">\n        <ejs-chart #chart id=\"country-development-chart\" style=\"display: block; text-align: center;\"\n            width=\"100%\" height=\"480px\" background=\"transparent\"\n            [primaryXAxis]=\"primaryXAxis\" [primaryYAxis]=\"primaryYAxis\"\n            [legendSettings]=\"legendSettings\" [tooltip]=\"tooltip\" [chartArea]=\"chartArea\"\n            (loaded)=\"loaded($event)\" (pointRender)=\"pointRender($event)\" (legendRender)=\"legendRender($event)\">\n            <e-series-collection>\n                <e-series [dataSource]=\"data\" name=\"Countries\" type=\"Bubble\" xName=\"x\" yName=\"y\" size=\"size\"\n                    [minRadius]=\"3\" [maxRadius]=\"8\" tooltipMappingName=\"tooltip\"\n                    [border]=\"border\" [marker]=\"marker\"></e-series>\n            </e-series-collection>\n        </ejs-chart>\n    </div>\n\n    <div class=\"sample-footer\">\n        Bubble size represents population. Gradient colors represent geographic regions.\n    </div>\n</div>\n"
    },
    {
      "target": "src/components/chart-bubble/bubble.component.ts",
      "content": "import { Component, ViewChild, ViewEncapsulation } from '@angular/core';\nimport {\n    ChartModule,\n    ChartComponent,\n    BubbleSeriesService,\n    TooltipService,\n    LegendService,\n    DataLabelService,\n    type IPointRenderEventArgs,\n    type ILegendRenderEventArgs,\n    type AxisModel,\n    type LegendSettingsModel,\n    type TooltipSettingsModel,\n    type MarkerSettingsModel,\n    type BorderModel,\n    type ChartAreaModel,\n    type SeriesModel,\n    ILoadedEventArgs\n} from '@syncfusion/ej2-angular-charts';\nimport { Browser } from '@syncfusion/ej2-base';\n\ninterface CountryData {\n    x: number;\n    y: number;\n    size: number;\n    country: string;\n    text: string;\n    region: string;\n    tooltip: string;\n}\n\ninterface RegionStyle {\n    fill: string;\n    border: string;\n    start: string;\n    end: string;\n}\n\nconst legendTemplate: string =\n    '<div style=\"display:flex;align-items:center;gap:' +\n    (Browser.isDevice ? '4px' : '8px') +\n    ';white-space:nowrap;opacity:1;padding:4px 8px;\">' +\n    '<span style=\"display:inline-block;width:12px;height:12px;flex-shrink:0;' +\n    'border-radius:50%;border:2px solid;box-sizing:border-box;\"></span>' +\n    '<span class=\"legend-label\" style=\"display:inline-block;font-size:' +\n    (Browser.isDevice ? '9px' : '13px') +\n    ';white-space:nowrap;\"></span>' +\n    '</div>';\n\n@Component({\n    selector: 'app-bubble',\n    standalone: true,\n    imports: [ChartModule],\n    providers: [BubbleSeriesService, TooltipService, LegendService, DataLabelService],\n    templateUrl: './bubble.component.html',\n    styleUrls: ['../styles/bubble.component.css'],\n    encapsulation: ViewEncapsulation.None\n})\nexport class BubbleComponent {\n    @ViewChild('chart')\n    public chart?: ChartComponent;\n\n    public data: CountryData[] = [\n        { x: 92.2, y: 7.8, size: 1.41, country: 'China', text: 'China', region: 'Asia', tooltip: 'China' },\n        { x: 74.0, y: 6.5, size: 1.45, country: 'India', text: 'India', region: 'Asia', tooltip: 'India' },\n        { x: 90.4, y: 6.0, size: 0.28, country: 'Indonesia', text: 'Indonesia', region: 'Asia', tooltip: 'Indonesia' },\n        { x: 99.4, y: 2.2, size: 0.34, country: 'United States', text: 'US', region: 'North America', tooltip: 'United States' },\n        { x: 88.6, y: 1.3, size: 0.21, country: 'Brazil', text: 'Brazil', region: 'South America', tooltip: 'Brazil' },\n        { x: 99.0, y: 0.7, size: 0.084, country: 'Germany', text: 'Germany', region: 'Europe', tooltip: 'Germany' },\n        { x: 72.0, y: 2.0, size: 0.114, country: 'Egypt', text: 'Egypt', region: 'Africa', tooltip: 'Egypt' },\n        { x: 99.6, y: 3.4, size: 0.144, country: 'Russia', text: 'Russia', region: 'Europe', tooltip: 'Russia' },\n        { x: 96.5, y: 0.2, size: 0.123, country: 'Japan', text: 'Japan', region: 'Asia', tooltip: 'Japan' },\n        { x: 86.1, y: 4.0, size: 0.024, country: 'Mali', text: 'MLI', region: 'Africa', tooltip: 'Mali' },\n        { x: 92.6, y: 5.2, size: 0.117, country: 'Philippines', text: 'PH', region: 'Asia', tooltip: 'Philippines' },\n        { x: 61.3, y: 1.45, size: 0.232, country: 'Nigeria', text: 'Nigeria', region: 'Africa', tooltip: 'Nigeria' },\n        { x: 82.2, y: 3.97, size: 0.0075, country: 'Hong Kong', text: 'Hong Kong', region: 'Asia', tooltip: 'Hong Kong' },\n        { x: 79.2, y: 4.9, size: 0.018, country: 'Netherlands', text: 'NL', region: 'Europe', tooltip: 'Netherlands' },\n        { x: 72.5, y: 4.5, size: 0.011, country: 'Jordan', text: 'Jordan', region: 'Asia', tooltip: 'Jordan' },\n        { x: 81.0, y: 2.5, size: 0.027, country: 'Australia', text: 'Australia', region: 'Oceania', tooltip: 'Australia' },\n        { x: 66.8, y: 3.9, size: 0.0035, country: 'Mongolia', text: 'MN', region: 'Asia', tooltip: 'Mongolia' },\n        { x: 78.4, y: 2.9, size: 0.023, country: 'Taiwan', text: 'Taiwan', region: 'Asia', tooltip: 'Taiwan' }\n    ];\n\n    public regionStyles: Record<string, RegionStyle> = {\n        Asia: { fill: '#A7E3DF', border: '#0F766E', start: '#E0F7F4', end: '#70CEC4' },\n        Europe: { fill: '#FFD6A5', border: '#C2410C', start: '#FFF0D9', end: '#FDBA74' },\n        Africa: { fill: '#FFBFC3', border: '#BE123C', start: '#FFE4E6', end: '#FDA4AF' },\n        'North America': { fill: '#BFDBFE', border: '#1D4ED8', start: '#EFF6FF', end: '#93C5FD' },\n        'South America': { fill: '#FBCFE8', border: '#BE185D', start: '#FCE7F3', end: '#F9A8D4' },\n        Oceania: { fill: '#DDD6FE', border: '#6D28D9', start: '#F3E8FF', end: '#C4B5FD' }\n    };\n\n    public primaryXAxis: AxisModel = {\n        minimum: 65,\n        maximum: 102,\n        interval: 5,\n        title: 'Internet Penetration (%)',\n        labelFormat: '{value}%',\n        majorGridLines: { width: 1, color: '#e2e8f0' },\n        lineStyle: { width: 1, color: '#cbd5e1' }\n    };\n\n    public primaryYAxis: AxisModel = {\n        minimum: 0,\n        maximum: 10,\n        interval: 2.5,\n        title: 'GDP Growth (%)',\n        labelFormat: '{value}%',\n        majorGridLines: { width: 1, color: '#e2e8f0' },\n        lineStyle: { width: 1, color: '#cbd5e1' }\n    };\n\n    public legendSettings: LegendSettingsModel = {\n        visible: true,\n        position: 'Top',\n        template: legendTemplate\n    };\n\n    public tooltip: TooltipSettingsModel = {\n        enable: true,\n        enableMarker: false,\n        header: '<b>${point.tooltip}</b>',\n        format:\n            'Internet Penetration: <b>${point.x}</b><br/>' +\n            'GDP Growth: <b>${point.y}</b><br/>' +\n            'Population: <b>${point.size} Billion</b>'\n    };\n\n    public chartArea: ChartAreaModel = { border: { width: 0 } };\n\n    public border: BorderModel = { width: 2 };\n\n    public marker: MarkerSettingsModel = {\n        dataLabel: {\n            visible: true,\n            name: 'text',\n            position: 'Middle',\n            font: { fontWeight: '600', color: '#263449', size: '11px' }\n        }\n    };\n\n    public loaded(args: ILoadedEventArgs): void {\n        const chartElement: HTMLElement | null = document.getElementById('country-development-chart');\n\n        if (chartElement) {\n            chartElement.setAttribute('title', '');\n        }\n\n        this.addBubbleGradients();\n    }\n\n    // Create SVG gradients inside the chart SVG.\n    private addBubbleGradients(): void {\n        const chartElement: HTMLElement | null = document.getElementById('country-development-chart');\n        const svg: SVGSVGElement | null | undefined = chartElement?.querySelector('svg');\n\n        if (!svg) {\n            return;\n        }\n\n        const existingDefs: Element | null = svg.querySelector('#country-bubble-gradients');\n\n        if (existingDefs) {\n            existingDefs.remove();\n        }\n\n        const svgNS: string = 'http://www.w3.org/2000/svg';\n        const defs: Element = document.createElementNS(svgNS, 'defs');\n        defs.setAttribute('id', 'country-bubble-gradients');\n\n        Object.keys(this.regionStyles).forEach((region: string, index: number) => {\n            const style: RegionStyle = this.regionStyles[region];\n            const gradient: Element = document.createElementNS(svgNS, 'linearGradient');\n\n            gradient.setAttribute('id', 'country-gradient-' + index);\n            gradient.setAttribute('x1', '0%');\n            gradient.setAttribute('y1', '0%');\n            gradient.setAttribute('x2', '100%');\n            gradient.setAttribute('y2', '100%');\n\n            const start: Element = document.createElementNS(svgNS, 'stop');\n            start.setAttribute('offset', '0%');\n            start.setAttribute('stop-color', style.start);\n\n            const end: Element = document.createElementNS(svgNS, 'stop');\n            end.setAttribute('offset', '100%');\n            end.setAttribute('stop-color', style.end);\n\n            gradient.appendChild(start);\n            gradient.appendChild(end);\n            defs.appendChild(gradient);\n        });\n\n        svg.insertBefore(defs, svg.firstChild);\n    }\n\n    public pointRender(args: IPointRenderEventArgs): void {\n        const point: CountryData = this.data[args.point.index];\n\n        if (!point) {\n            return;\n        }\n\n        const style: RegionStyle = this.regionStyles[point.region];\n        const regionIndex: number = Object.keys(this.regionStyles).indexOf(point.region);\n\n        args.fill = 'url(#country-gradient-' + regionIndex + ')';\n        args.border = { color: style.border, width: 2 };\n    }\n\n    // Legend template customization following the Olympic Medal sample.\n    public legendRender(args: ILegendRenderEventArgs): void {\n        const matchedSeries: SeriesModel | undefined = this.chart && this.chart.series\n            ? this.chart.series.find((series: SeriesModel) => series.name === args.text)\n            : undefined;\n\n        const opacity: string = matchedSeries && !matchedSeries.visible ? '0.5' : '1';\n\n        args.template = (args.template as string)\n            .replace('opacity:1;', 'opacity:' + opacity + ';')\n            .replace(\n                'border:2px solid;',\n                'background:linear-gradient(135deg, #E0F7F4, #70CEC4);' +\n                'border:2px solid #0F766E;'\n            )\n            .replace(\n                '<span class=\"legend-label\" style=\"display:inline-block;font-size:' +\n                (Browser.isDevice ? '9px' : '13px') +\n                ';white-space:nowrap;\"></span>',\n                '<span class=\"legend-label\" style=\"display:inline-block;' +\n                'font-size:' + (Browser.isDevice ? '9px' : '13px') +\n                ';white-space:nowrap;color:#0F766E;font-weight:bold;\">' +\n                args.text + '</span>'\n            );\n    }\n}\n"
    }
  ]
}