{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "chart-embed-custom-control",
  "framework": "winforms",
  "type": "registry:component",
  "component": "Chart",
  "variant": "embed-custom-control",
  "dependencies": [
    "Syncfusion.Chart.Windows"
  ],
  "description": "Chart with a docked control panel rendered as a chart area region and bound to a data grid that drives the displayed series.",
  "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/winforms/llms.txt",
    "skillPack": "syncfusion/winforms-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/winforms/chart-embed-custom-control.md"
  },
  "files": [
    {
      "target": "src/components/chart-embed-custom-control/chart.Designer.cs",
      "content": "using System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Drawing;\nusing System.Windows.Forms;\nusing System.Data;\nusing Syncfusion.Windows.Forms;\nusing Syncfusion.Windows.Forms.Chart;\nusing Syncfusion.Drawing;\n\nnamespace EmbedCustomControl\n{\n    public partial class Form1 : Syncfusion.Windows.Forms.MetroForm\n    {\n        #region Windows Form Designer generated code\n        /// <summary>\n        /// Required method for Designer support - do not modify\n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            this.chartControl1 = new Syncfusion.Windows.Forms.Chart.ChartControl();\n            this.label10 = new System.Windows.Forms.Label();\n            this.radioButton2 = new System.Windows.Forms.RadioButton();\n            this.radioButton1 = new System.Windows.Forms.RadioButton();\n            this.gradientPanel1 = new Syncfusion.Windows.Forms.Tools.GradientPanel();\n            this.dataGridView1 = new System.Windows.Forms.DataGridView();\n            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();\n            ((System.ComponentModel.ISupportInitialize)(this.gradientPanel1)).BeginInit();\n            this.gradientPanel1.SuspendLayout();\n            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();\n            this.SuspendLayout();\n            // \n            // chartControl1\n            // \n            this.chartControl1.ChartArea.BorderColor = System.Drawing.Color.Transparent;\n            this.chartControl1.ChartArea.CursorLocation = new System.Drawing.Point(0, 0);\n            this.chartControl1.ChartArea.CursorReDraw = false;\n            this.chartControl1.ChartArea.XAxesLayoutMode = Syncfusion.Windows.Forms.Chart.ChartAxesLayoutMode.SideBySide;\n            this.chartControl1.ChartArea.YAxesLayoutMode = Syncfusion.Windows.Forms.Chart.ChartAxesLayoutMode.SideBySide;\n            this.chartControl1.ChartAreaMargins = new Syncfusion.Windows.Forms.Chart.ChartMargins(10, 10, 20, 10);\n            this.chartControl1.DataSourceName = \"\";\n            this.chartControl1.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 8.25F);\n            this.chartControl1.IsWindowLess = false;\n            // \n            // \n            // \n            this.chartControl1.Legend.Font = new System.Drawing.Font(\"Verdana\", 10F);\n            this.chartControl1.Legend.Location = new System.Drawing.Point(89, 472);\n            this.chartControl1.Legend.Orientation = Syncfusion.Windows.Forms.Chart.ChartOrientation.Horizontal;\n            this.chartControl1.Legend.Position = Syncfusion.Windows.Forms.Chart.ChartDock.Bottom;\n            this.chartControl1.Localize = null;\n            this.chartControl1.Location = new System.Drawing.Point(0, 0);\n            this.chartControl1.Name = \"chartControl1\";\n            this.chartControl1.PrimaryXAxis.Crossing = double.NaN;\n            this.chartControl1.PrimaryXAxis.GridLineType.ForeColor = System.Drawing.Color.LightGray;\n            this.chartControl1.PrimaryXAxis.Margin = true;\n            this.chartControl1.PrimaryXAxis.Title = \"Month\";\n            this.chartControl1.PrimaryXAxis.TitleFont = new System.Drawing.Font(\"Segoe UI\", 14F);\n            this.chartControl1.PrimaryYAxis.Crossing = double.NaN;\n            this.chartControl1.PrimaryYAxis.GridLineType.ForeColor = System.Drawing.Color.LightGray;\n            this.chartControl1.PrimaryYAxis.Margin = true;\n            this.chartControl1.PrimaryYAxis.Title = \"Sales in Millions\";\n            this.chartControl1.PrimaryYAxis.TitleFont = new System.Drawing.Font(\"Segoe UI\", 14F);\n            this.chartControl1.Size = new System.Drawing.Size(700, 580);\n            this.chartControl1.TabIndex = 0;\n            this.chartControl1.Text = \"Fruit Production Statistics\";\n            // \n            // \n            // \n            this.chartControl1.Title.Font = new System.Drawing.Font(\"Segoe UI\", 16F);\n            this.chartControl1.Title.Name = \"Def_title\";\n            this.chartControl1.Title.Text = \"Fruit Production Statistics\";\n            this.chartControl1.Titles.Add(this.chartControl1.Title);\n            // \n            // label10\n            // \n            this.label10.AutoSize = true;\n            this.label10.BackColor = System.Drawing.Color.Transparent;\n            this.label10.Font = new System.Drawing.Font(\"Segoe UI\", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(66)))), ((int)(((byte)(66)))));\n            this.label10.Location = new System.Drawing.Point(43, 30);\n            this.label10.Name = \"label10\";\n            this.label10.Size = new System.Drawing.Size(131, 25);\n            this.label10.TabIndex = 2;\n            this.label10.Text = \"Table Position\";\n            this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;\n            // \n            // radioButton2\n            // \n            this.radioButton2.AutoSize = true;\n            this.radioButton2.Checked = true;\n            this.radioButton2.FlatStyle = System.Windows.Forms.FlatStyle.System;\n            this.radioButton2.Font = new System.Drawing.Font(\"Segoe UI\", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.radioButton2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(66)))), ((int)(((byte)(66)))));\n            this.radioButton2.Location = new System.Drawing.Point(48, 95);\n            this.radioButton2.Name = \"radioButton2\";\n            this.radioButton2.Size = new System.Drawing.Size(85, 26);\n            this.radioButton2.TabIndex = 2;\n            this.radioButton2.TabStop = true;\n            this.radioButton2.Text = \"Bottom\";\n            this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);\n            // \n            // radioButton1\n            // \n            this.radioButton1.AutoSize = true;\n            this.radioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System;\n            this.radioButton1.Font = new System.Drawing.Font(\"Segoe UI\", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.radioButton1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(66)))), ((int)(((byte)(66)))));\n            this.radioButton1.Location = new System.Drawing.Point(48, 63);\n            this.radioButton1.Name = \"radioButton1\";\n            this.radioButton1.Size = new System.Drawing.Size(60, 26);\n            this.radioButton1.TabIndex = 3;\n            this.radioButton1.Text = \"Top\";\n            this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);\n            // \n            // gradientPanel1\n            // \n            this.gradientPanel1.Dock = DockStyle.Right;\n            this.gradientPanel1.BackColor = System.Drawing.Color.WhiteSmoke;\n            this.gradientPanel1.Border3DStyle = System.Windows.Forms.Border3DStyle.Flat;\n            this.gradientPanel1.BorderColor = System.Drawing.Color.White;\n            this.gradientPanel1.BorderSingle = System.Windows.Forms.ButtonBorderStyle.None;\n            this.gradientPanel1.BorderStyle = System.Windows.Forms.BorderStyle.None;\n            this.gradientPanel1.Controls.Add(this.label10);\n            this.gradientPanel1.Controls.Add(this.radioButton1);\n            this.gradientPanel1.Controls.Add(this.radioButton2);\n            this.gradientPanel1.Font = new System.Drawing.Font(\"Segoe UI\", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.gradientPanel1.Location = new System.Drawing.Point(700, 0);\n            this.gradientPanel1.Name = \"gradientPanel1\";\n            this.gradientPanel1.Size = new System.Drawing.Size(260, 585);\n            this.gradientPanel1.TabIndex = 4;\n            // \n            // dataGridView1\n            // \n            this.dataGridView1.AllowUserToAddRows = false;\n            this.dataGridView1.AllowUserToDeleteRows = false;\n            this.dataGridView1.AllowUserToResizeColumns = false;\n            this.dataGridView1.AllowUserToResizeRows = false;\n            this.dataGridView1.Dock = DockStyle.Bottom;\n            this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;\n            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\n            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {\n            this.Column1});\n            this.dataGridView1.Location = new System.Drawing.Point(83, 12);\n            this.dataGridView1.Name = \"dataGridView1\";\n            this.dataGridView1.Size = new System.Drawing.Size(560, 204);\n            this.dataGridView1.TabIndex = 1;\n            this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);\n            // \n            // Column1\n            // \n            this.Column1.HeaderText = \"Column1\";\n            this.Column1.Name = \"Column1\";\n            // \n            // Form1\n            // \n            this.BackColor = System.Drawing.Color.White;\n            this.ClientSize = new System.Drawing.Size(954, 581);\n            this.Controls.Add(this.chartControl1);\n            this.Controls.Add(this.gradientPanel1);\n            this.Controls.Add(this.dataGridView1);\n            this.MinimumSize = new System.Drawing.Size(545, 470);\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n            this.Name = \"Form1\";\n            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\n            this.Text = \"Embedding Custom Control\";\n            this.Load += new System.EventHandler(this.Form1_Load);\n            this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);\n            ((System.ComponentModel.ISupportInitialize)(this.gradientPanel1)).EndInit();\n            this.gradientPanel1.ResumeLayout(false);\n            this.gradientPanel1.PerformLayout();\n            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();\n            this.ResumeLayout(false);\n\n        }\n\n        #endregion\n\n        #region Private Members\n        private Syncfusion.Windows.Forms.Chart.ChartControl chartControl1;\n        private ChartDockControl chartDockControl1;\n        private int count = 0;\n        private DataTable dt;\n        private System.Windows.Forms.RadioButton radioButton1;\n        private System.Windows.Forms.RadioButton radioButton2;\n        private Label label10;\n        private Syncfusion.Windows.Forms.Tools.GradientPanel gradientPanel1;\n        private DataGridView dataGridView1;\n        private DataGridViewTextBoxColumn Column1;\n\n        private System.ComponentModel.IContainer components = null;\n        #endregion\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing && (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n    }\n}\n"
    },
    {
      "target": "src/components/chart-embed-custom-control/chart.cs",
      "content": "using System;\nusing System.Drawing;\nusing System.Collections;\nusing System.Windows.Forms;\nusing System.Data;\nusing Syncfusion.Windows.Forms.Chart;\nusing Syncfusion.Drawing;\n\nnamespace EmbedCustomControl\n{\n    public partial class Form1 : Syncfusion.Windows.Forms.MetroForm\n    {\n        #region Form Constructor\n\n        public Form1()\n        {\n            BorderColor = Color.FromArgb(0xFF, 0xCD, 0xCD, 0xCD);\n            BorderThickness = 3;\n            CaptionBarHeight = 75;\n            CaptionBarColor = Color.FromArgb(0xFF, 0x1B, 0xA1, 0xE2);\n            CaptionFont = new Font(\"Segoe UI\", 22.0f);\n            CaptionForeColor = Color.White;\n            CaptionAlign = HorizontalAlignment.Left;\n            ShowIcon = false;\n            CaptionButtonColor = Color.White;\n            CaptionButtonHoverColor = Color.White;\n            InitializeComponent();\n        }\n\n        #endregion\n\n        #region Form Load\n\n        private void Form1_Load(object sender, System.EventArgs e)\n        {\n            this.dataGridView1.ColumnCount = 0;\n            this.chartDockControl1 = new ChartDockControl(this.dataGridView1);\n            this.chartDockControl1.Alignment = ChartAlignment.Center;\n            this.chartDockControl1.Orientation = ChartOrientation.Horizontal;\n            this.chartDockControl1.Position = ChartDock.Bottom;\n            this.chartControl1.Controls.Add(chartDockControl1);\n            this.chartControl1.DockingManager.Add(this.chartDockControl1);\n            this.dataGridView1.Size = new Size(this.chartControl1.Width - 93, this.chartControl1.Height - 295);\n            InitializeChartData();\n            ChartAppearance.ApplyChartStyles(this.chartControl1);\n            PopulateDataGrid();\n            this.chartControl1.Dock = DockStyle.Fill;\n\n\n        }\n        #endregion\n\n        #region Helper Methods\n\n        #region InitializeChartData\n        /// <summary>\n        /// Initializes the ChartControl's data and sets the Chart type\n        /// </summary>\n        protected void InitializeChartData()\n        {\n\n            ChartSeries series1 = new ChartSeries();\n            series1.Type = ChartSeriesType.StackingColumn;\n            series1.Name = \"Banana\";\n            series1.Text = \"Banana\";\n\n            series1.Points.Add(1, 35);\n            series1.Points.Add(2, 30);\n            series1.Points.Add(3, 25);\n            this.chartControl1.Series.Add(series1);\n            ///////\n\n            ChartSeries series2 = new ChartSeries();\n            series2.Type = ChartSeriesType.StackingColumn;\n            series2.Name = \"Apple\";\n            series2.Text = \"Apple\";\n\n            series2.Points.Add(1, 25);\n            series2.Points.Add(2, 20);\n            series2.Points.Add(3, 18);\n            this.chartControl1.Series.Add(series2);\n\n\n            ChartSeries series3 = new ChartSeries();\n            series3.Type = ChartSeriesType.StackingColumn;\n            series3.Name = \"Orange\";\n            series3.Text = \"Orange\";\n            series3.Points.Add(1, 40);\n            series3.Points.Add(2, 35);\n            series3.Points.Add(3, 30);\n            this.chartControl1.Series.Add(series3);\n        }\n        #endregion\n\n        #region Populate Data Grid\n        /// <summary>\n        /// Populate the DataGrid with series values as data\n        /// </summary>\n        string[] strMonth = new string[] { \"Jan\", \"Feb\", \"Mar\" };\n        protected void PopulateDataGrid()\n        {\n            dt = new DataTable(\"SeriesValue\");\n            DataColumn ser = dt.Columns.Add(\"Fruits\", typeof(String));\n            for (int j = 0; j < this.chartControl1.Series[0].Points.Count; j++)\n            {\n                DataColumn dc = dt.Columns.Add(strMonth[j].ToString(), typeof(double));\n            }\n            for (int i = 0; i < this.chartControl1.Series.Count; i++)\n            {\n                ChartSeries series = this.chartControl1.Series[i];\n                if (dt != null)\n                {\n                    DataRow dr = dt.NewRow();\n                    dt.Rows.Add(dr);\n                    count = Math.Max(0, dt.Rows.Count - 1);\n                    if (count == 0)\n                        dt.Rows[count][\"Fruits\"] = \"Banana\";\n                    if (count == 1)\n                        dt.Rows[count][\"Fruits\"] = \"Apple\";\n                    if (count == 2)\n                        dt.Rows[count][\"Fruits\"] = \"Orange\";\n                    for (int j = 0; j < series.Points.Count; j++)\n                        dt.Rows[count][strMonth[j]] = series.Points[j].YValues[0];\n                }\n\n            }\n            this.dataGridView1.DataMember = \"SeriesValue\";\n\n            this.dataGridView1.DataSource = dt;\n            foreach (DataGridViewColumn column in this.dataGridView1.Columns)\n            {\n                column.Width = 28;\n            }\n            this.dataGridView1.Columns[0].Width = 60;\n            this.dataGridView1.Width = 600;\n            this.dataGridView1.Height = 150;\n            this.dataGridView1.RowHeadersVisible = false;\n            this.dataGridView1.Columns[0].ReadOnly = true;\n            this.dataGridView1.Font = new System.Drawing.Font(\"Segoe UI\", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));\n            this.dataGridView1.BackgroundColor = Color.White;\n            this.dataGridView1.DefaultCellStyle.BackColor = Color.FromArgb(147, 206, 242);\n            this.dataGridView1.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb(0, 159, 222);\n            this.dataGridView1.DefaultCellStyle.SelectionForeColor = Color.White;\n\n        }\n        #endregion\n\n        #region UpdateChartSeries()\n\n        /// <summary>\n        /// This updates the chart with the changed values\n        /// </summary>\n        protected void UpdateChartSeries()\n        {\n            try\n            {\n                int seriesCount = this.dataGridView1.SelectedCells[0].RowIndex;\n                int ColCount = this.dataGridView1.SelectedCells[0].ColumnIndex;\n                double pointValue = Convert.ToDouble(this.dataGridView1.SelectedCells[0].Value);\n                this.chartControl1.Series[seriesCount].Points[ColCount - 1].YValues[0] = pointValue;\n                this.chartControl1.Refresh();\n            }\n            catch\n            { }\n        }\n        #endregion\n\n        #endregion\n\n        #region Events\n\n        private void radioButton_CheckedChanged(object sender, System.EventArgs e)\n        {\n            if (this.radioButton1.Checked)\n                this.chartDockControl1.Position = ChartDock.Top;\n            else\n                this.chartDockControl1.Position = ChartDock.Bottom;\n        }\n\n        private void Form1_SizeChanged(object sender, System.EventArgs e)\n        {\n            this.dataGridView1.Width = this.chartControl1.Width - 50;\n            foreach (DataGridViewColumn column in this.dataGridView1.Columns)\n            {\n                column.Width = this.chartControl1.Width/16;\n            }\n            this.dataGridView1.Columns[0].Width = this.chartControl1.Width / 7;\n        }\n\n        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)\n        {\n            UpdateChartSeries();\n        }\n        #endregion\n\n      \n\n        \n    }\n}\n"
    }
  ]
}