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

Multiple Axis Layouts

Hi,

Is it possible to control the height of the individual axis when using side-by-side layouts?

I have two Y axes vertically above each other and the height of each axis defaults to 50% of the overall chart height. Ideally I'd like to have the bottom axis occupying 20% of the overall chart height with the top axis taking the remaining 80%.

Best regards,

Gary

8 Replies

VV Venkata Vijayaraj B Syncfusion Team July 22, 2009 10:11 AM UTC

Hi Gary,

Use RealLength property of Axis, to get or set the length of axis.

Code Snippet:

ChartWebControl1.PrimaryXAxis.AutoSize = false;
ChartWebControl1.PrimaryXAxis.RealLength = 100;

ChartAxis secYAxis = new ChartAxis();
secYAxis.AutoSize = false;
secYAxis.RealLength = 150;

please let me know if this meets your requirement.

Regards,
Venkat.


VV Venkata Vijayaraj B Syncfusion Team July 22, 2009 10:13 AM UTC

Hi Gary,

Sorry. In my previous update, I given PrimaryXAxis instead of PrimaryYAxis. Please refer the modified code.

Code Snippet:

ChartWebControl1.PrimaryYAxis.AutoSize = false;
ChartWebControl1.PrimaryYAxis.RealLength = 100;

ChartAxis secYAxis = new ChartAxis();
secYAxis.AutoSize = false;
secYAxis.RealLength = 150;

please let me know if this meets your requirement.

Regards,
Venkat.


GN Gary Nicol July 22, 2009 12:58 PM UTC

Hi Venkat,

That's perfect - many thanks for the prompt response.

Best regards,

Gary


PJ Palak Jain March 11, 2010 04:13 PM UTC

I am using Windows Chart control. I tried the above code for resizing the chart axes but it didnot work.

chart1.PrimaryYAxis.AutoSize = false;
chart1.PrimaryYAxis.RealLength = 100;
yaxis.AutoSize = false;
yaxis.RealLength = 150;

Please let me know how to divide the axes lengths unequally.
Also is there a way to make the series and its axes disappear making the other series and axes take up the entire area?
For example I have a Price and Volume chart and I want the volume chart to hide and Price chart to take up the entire chart control.


VV Venkata Vijayaraj B Syncfusion Team March 12, 2010 11:41 AM UTC

Hi Palak,

Thanks for your interest in Syncfusion products. Please use your code in any one of the following event. It will work fine.


chartControl1.LayoutCompleted += new EventHandler(chartControl1_LayoutCompleted);

void chartControl1_LayoutCompleted(object sender, EventArgs e)
{
chart1.PrimaryYAxis.AutoSize = false;
chart1.PrimaryYAxis.RealLength = 100;
yaxis.AutoSize = false;
yaxis.RealLength = 150;
}


chartControl1.ChartAreaPaint += new PaintEventHandler(chartControl1_ChartAreaPaint);

void chartControl1_ChartAreaPaint(object sender, PaintEventArgs e)
{
chart1.PrimaryYAxis.AutoSize = false;
chart1.PrimaryYAxis.RealLength = 100;
yaxis.AutoSize = false;
yaxis.RealLength = 150;
}


We are not having direct support for your second requirement.
By customizing the value of RealLengths, you can meet this requirement.

Please let us know if this helps.

Regards,
Venkat.


PJ Palak Jain March 15, 2010 03:04 PM UTC

Thanks Venkat for the reply but I had tried that already and there's still an issue.

I have added the resizing code in the LayoutComplete event. The resizing of the axes works fine. But the problem is the tick labels are still being painted as if the axes were equal length.

Also, the first time the chart is created, the axes labels are painted along side the grid intervals. But after that everytime the chart updates/resizes, the label positions shift. ( I am attaching the screenshots.)


I also added code to set the TickLabelsDrawingMode for all the axes to AutomaticMode. It doesn't help!
chart1.PrimaryYAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.AutomaticMode;

Thanks again,
Palak.



Label Positions_7dc2545a.zip


PJ Palak Jain March 18, 2010 01:27 PM UTC

Hi,

I tried using the above code in ChartAreaPaint event and this doesnot even resize the axes.

Any clue on how to change the label positions to match the grid intervals?

Thanks,
Palak.


JB Jaffersathick B Syncfusion Team March 24, 2010 01:17 PM UTC

Hi Palak,


Thank you for your interest in Syncfusion products.


Sorry for the delay in getting back to you. We will have a follow up of for this forum in the Direct Trac incident id #66081.


Regards,
Jaffer.B

Loader.
Live Chat Icon For mobile
Up arrow icon