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

Extra space in between "Y" axis scale and chartarea

Hi All,

I am adding seperate axis scale for my chart series and also i am allocating location and size by manually

below is my code.

series.YAxis.LocationType = ChartAxisLocationType.Set;
series.YAxis.Location = new PointF(this.chartControl1.PrimaryYAxis.Location.X, this.chartControl1.ChartArea.RenderBounds.Bottom - (count * height));
series.YAxis.AutoSize = false;
series.YAxis.Size = new SizeF(0, height);

but it shows some extra space between "Y" axis sclae and chartArea,

Please reply me,How do i solve this problem ?

I attached my screen shot also.

With Regards
K.Sathishkumar

ChartAxisProblem.zip

6 Replies

RR Ramya R Syncfusion Team January 30, 2007 09:06 AM UTC

Hi Sathishkumar,

Thank You for your interest in Syncfusion products.

To display the axes added by you to the ChartSeries along the location of PrimaryYAxis change the code snippet as shown below ,

series.YAxis.LocationType = ChartAxisLocationType.Set;
series.YAxis.Location = new PointF(this.chartControl1.PrimaryXAxis.Location.X, this.chartControl1.ChartArea.RenderBounds.Bottom - (count * height));
series.YAxis.AutoSize = false;
series.YAxis.Size = new SizeF(0, height);

Let me know if you have any queries.

Thanks & Regards,
Ramya.


SK Sathishkumar Kaliavaradhan January 30, 2007 01:55 PM UTC

Hi Ramya,

I did whatever you suggested in last mail,now there is no space between "Y" axis and chartarea but it drawing some extra line beside the chart axis.

I attached my example code also.

Can you please look into my code then reply as soon as possible.

Thanks and Regards
K.Sathishkumar.

chartAxis.zip


SK Sathishkumar Kaliavaradhan January 31, 2007 05:54 AM UTC

Hi Ramya,

I waiting for your update only...

Can you please give me solutions for my problem.

With Regards
K.Sathishkumar


AD Administrator Syncfusion Team January 31, 2007 10:15 AM UTC

Hi Satishkumar,

Sorry for the inconvenience caused.

I modified the code snippet of SetAxis method as shown below,

private void SetAxis()
{
if (this.chartControl1.Series.Count > 0)
{
this.chartControl1.ChartArea.ChartAreaMargins.Bottom = 30;

axis0.LocationType = ChartAxisLocationType.Set;
axis0.Location = new PointF(this.chartControl1.PrimaryXAxis.Location.X, (this.chartControl1.ChartArea.RenderBounds.Bottom - this.chartControl1.ChartArea.RenderBounds.Height * 2 / 5+20));
axis0.AutoSize = false;
axis0.Size = new SizeF(0, (this.chartControl1.ChartArea.RenderBounds.Height / 3 - this.chartControl1.ChartArea.RenderBounds.Height / 12));

axis1.LocationType = ChartAxisLocationType.Set;
axis1.Location = new PointF(this.chartControl1.PrimaryXAxis.Location.X, (this.chartControl1.ChartArea.RenderBounds.Bottom - this.chartControl1.ChartArea.RenderBounds.Height * 3 / 5-20));
axis1.AutoSize = false;
axis1.Size = new SizeF(0, (this.chartControl1.ChartArea.RenderBounds.Height / 3 - this.chartControl1.ChartArea.RenderBounds.Height / 12));
}
}

I have also attached the modified sample with this post.

Kindly take a look at the code snippet and let me know if you have any queries.

Thanks & Regards,
Ramya.

ChartAxesSample0.zip


SK Sathishkumar Kaliavaradhan January 31, 2007 10:33 AM UTC

Hi Ramya,

Can you please modify the sample such way that chart axis will occupy the full height of chart control.

Waiting for your update...

Thanks and Regards
K.Sathishkumar.


AD Administrator Syncfusion Team February 2, 2007 07:24 AM UTC

Hi Satishkumar,

If your intention is to draw the the secondary Y-axes to occupy the height of the PrimaryYAxis then it can be done by adjusting the size and location of the secondary-Y axes as shown in the code snippet below,

private void SetAxis()
{
if (this.chartControl1.Series.Count > 0)
{
this.chartControl1.ChartArea.ChartAreaMargins.Bottom = 30;
this.chartControl1.ChartArea.ChartAreaMargins.Left = 30;

axis0.LocationType = ChartAxisLocationType.Set;
axis0.Location = new PointF(this.chartControl1.PrimaryXAxis.Location.X, this.chartControl1.PrimaryXAxis.Location.Y);
axis0.AutoSize = false;
axis0.Size = new SizeF(0, this.chartControl1.PrimaryYAxis.Size.Height);
axis1.LocationType = ChartAxisLocationType.Set;
axis1.Location = new PointF(this.chartControl1.PrimaryXAxis.Location.X-40, this.chartControl1.PrimaryXAxis.Location.Y);
axis1.AutoSize = false;
axis1.Size = new SizeF(0, this.chartControl1.PrimaryYAxis.Size.Height);
}
}

In this SetAxis( ) method I have drawn the axis1 to be away from the PrimaryYAxis since both axis0 and axis1 get overlapped as they are of the same height.

I have also attached the modified sample with this post.

Let me know whether this helps you.

Thanks & Regards,
Ramya.


ChartAxesSample1.zip

Loader.
Live Chat Icon For mobile
Up arrow icon