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. Image for the cookie policy date

Title vertical margins

Hi all,
I have set the title's dock to Top and position to Far, I can use the Margin property of the Title object to set the horizontal margin, but I cannot see a way to decrease the vertical margin at all..
I would like the title text as close as possible to the top of the first layout..
Any help would be appreciated,

thanks
N

4 Replies

NM Nick Mesisca March 17, 2017 04:32 PM UTC

OK,
I think I have achieved more or less what I wanted by changing the ChartAreMargin.Top value to 0.. I noticed something though, by default ChartAreaMargin is 10,10,10,10 and if I try to change the Top value via code, the default seems to still overriding my value. I had to change the value from the designer to have it stick.. Is this normal behaviour?

thanks
regards
N


SK Sanjith Kesavan Syncfusion Team March 20, 2017 12:47 PM UTC

Hi Nick, 

Thanks for contacting Syncfusion support. We have analyzed your queries. Please find the response for your queries below.  
Query1: I would like the title text as close as possible to the top of the first layout 
Answer: We can place the chart title at the desired position in the chart area using the below code. 

[C#] 
chartControl1.Title.Position= Syncfusion.Windows.Forms.Chart.ChartDock.Floating; 
chartControl1.Title.Location = new Point(180, 0); 

In the above code, we have set the title position as floating and set the location as (180,0). Now the chart title will be place at 180px from left and 0px from the top margin. Please find the below screenshot. 
 

Query2: By default, ChartAreaMargin is 10,10,10,10 and if I try to change the Top value via code, the default seems to still overriding my value. I had to change the value from the designer to have it stick. Is this normal behaviour? 
Answer: Before we proceed further, we would like to explain that, ChartAreaMargin is space between border and chart. Please find the below screenshot.  
   
 
In the above screenshot, we have set the border style as fixedsingle. Now we can see that 10px space is given between the border and chart.  
 
Using below code we have set ChartAreaMargin as 0,0,0,0. 
[C#] 
chartControl1.ChartAreaMargins.Top = 0; 
chartControl1.ChartAreaMargins.Bottom = 0; 
chartControl1.ChartAreaMargins.Left = 0; 
chartControl1.ChartAreaMargins.Right = 0; 
chartControl1.Title.Position = Syncfusion.Windows.Forms.Chart.ChartDock.Floating; 
chartControl1.Title.Location = new Point(180, 0); 
 
Please find the output of the chart below. 
 

In the below link, we have attached sample for your reference.  
Sample link:  Sample 

If you are still facing any concern, please let us know by attaching the sample in which reported issue is occurring. And also, details about Essential studio version which you are using. This would be helpful for us to provide the solution that meet your requirement. 

Regards, 
Sanjith.  
  



NM Nick Mesisca March 22, 2017 06:30 PM UTC

Ah I see now..
So does that mean that positioning this item using Floating and Location, the user will be able to move it around during runtime though? I would like to avoid that..
None the less thank you so much for your help,

Nick


AT Anandaraj T Syncfusion Team March 24, 2017 07:18 AM UTC

Hi Nick, 

Thanks for the update. 

We can disable the interactive behavior (moving the chart title during runtime) by setting the Behavior property of ChartTitle to Dockable or None. Default value of this property is All

Note: Users can move chart title in all positions (not only floating) if Behavior property of title is Movable or All.  

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

[Chart with fixed title] 

 
Please refer the following code snippet to achieve this 

[C#] 
 
            //Disable movement of chart title during runtime 
            chartControl1.Title.Behavior = Syncfusion.Windows.Forms.Chart.ChartDockingFlags.Dockable; 
 

Please let us know if you have any concern. 

Regards, 
Anand

Loader.
Live Chat Icon For mobile
Up arrow icon