No doubt this chart alignment is kind of tricky. Assuming that the charts are called chart1, chart2 and chart3 where chart1 is the surface chart operating in contour mode the alignment code should look like:
nChartControl1.Panels.Clear();
nChartControl1.Panels.Add(chart1);
nChartControl1.Panels.Add(chart2);
nChartControl1.Panels.Add(chart3);
NMarginsL margins = new NMarginsL(20, 20, 20, 20);
chart1.Location = new NPointL(0, 0);
chart1.Size = new NSizeL( new NLength(50, NRelativeUnit.ParentPercentage),
new NLength(50, NRelativeUnit.ParentPercentage));
chart2.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0));
chart2.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage),
new NLength(50, NRelativeUnit.ParentPercentage));
chart3.Location = new NPointL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));
chart3.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage),
new NLength(50, NRelativeUnit.ParentPercentage));
chart1.BoundsMode = BoundsMode.Fit;
float horizontalMarginsInPixels = (margins.Left.Value + margins.Right.Value) * NResolution.ScreenResolution.DpiX / 72;
float verticalMarginsInPixels = (margins.Top.Value + margins.Bottom.Value) * NResolution.ScreenResolution.DpiY / 72;
chart1.Width = (nChartControl1.Width * chart1.Size.Width.Value) / 100.0f - horizontalMarginsInPixels;
chart1.Depth = (nChartControl1.Height * chart1.Size.Height.Value) / 100.0f - verticalMarginsInPixels;
chart1.Margins = margins;
chart1.Fit3DAxisContent = false;
chart2.BoundsMode = BoundsMode.Stretch;
chart2.MinDockZoneMargins = margins;
chart3.BoundsMode = BoundsMode.Stretch;
chart3.MinDockZoneMargins = margins;
There are two points of interest generally:
1. In order to assing widht and depth to the 3D chart, that will make it fit "exactly" in its designated place you should choose width and depth that have the same aspect as the chart panel - this achieved by:
chart1.BoundsMode = BoundsMode.Fit;
float horizontalMarginsInPixels = (margins.Left.Value + margins.Right.Value) * NResolution.ScreenResolution.DpiX / 72;
float verticalMarginsInPixels = (margins.Top.Value + margins.Bottom.Value) * NResolution.ScreenResolution.DpiY / 72;
chart1.Width = (nChartControl1.Width * chart1.Size.Width.Value) / 100.0f - horizontalMarginsInPixels;
chart1.Depth = (nChartControl1.Height * chart1.Size.Height.Value) / 100.0f - verticalMarginsInPixels;
2. Notice that I leave margins around the chart panels - this is intentional - the idea is that 2D charts will typically "eat" from the space available for the series plot depending on the size of texts/ticks on their axis - by forcing a 20 points margin and explicitly
locking the size of the axis area:
chart2.MinDockZoneMargins = margins;
chart3.MinDockZoneMargins = margins;
you actually ensure the chart plot size to be panelSize - marginsSize. Note that if the control changes size on the screen you'll have to execute the code again (as the nChartControl1.Width and nChartControl1.Height will change).
Hope this helps - let me know if you meet any problems.
Best regards,
Bob