We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add Diagram Controls on Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

127143 Oct 28,2016 12:05 PM UTC Oct 31,2016 07:01 AM UTC WinForms 1
loading
Tags: Chart
Ani
Asked On October 28, 2016 12:05 PM UTC

Hi,

I need to add Diagram controls on the Chart Area above the plotted chart values. The diagram control needs to be fixed at that point. Is this possible?

Anandaraj T [Syncfusion]
Replied On October 31, 2016 07:01 AM UTC

Hi Ani, 

Thanks for using Syncfusion products. 

We have prepared a simple sample for your requirement and it can be downloaded from the following link 

Query #1: I need to add Diagram controls on the chart area above the plotted chart values 

We can add Diagram controls as child controls to chart and place them at desired location. 

Please refer the following code snippet to add Diagram control on Chart 

[C#] 
 
            //Add diagram as a child control to Chart 
            this.chartControl1.Controls.Add(this.diagram1); 
 
            //Ensure size of the diagram control will not change after resizing 
            this.diagram1.Dock = DockStyle.None; 
            this.diagram1.Anchor = AnchorStyles.None; 


Query #2: The diagram control needs to be fixed at that point 

We can use the Paint event of Chart control and GetPointByValue method of ChartArea to place the diagram at fixed location. 

Please refer the following code snippet to achieve this 

[C#] 
 
            //Place diagram contol at fixed location using Paint event 
            this.chartControl1.Paint += chartControl1_Paint; 
 
        //Paint event of Chart 
        void chartControl1_Paint(object sender, PaintEventArgs e) 
        { 
            ChartControl chart = sender as ChartControl; 
            //Place diagram at a fixed location (eg: [4, 80]) 
            this.diagram1.Location = chart.ChartArea.GetPointByValue(new ChartPoint(4, 80)); 
        } 


Please let us know if you have any concern. 

Regards, 
Anand

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;