Hi Kevin,
The MarginsArea, BorderArea and ContentArea of each content panel are calculated at layout phase. This is why you cannot use them when configuring the control reliably as they indeed "lag" by one repaint. They can be used when you use custom painting only.
The following code snippet for example shows how to achieve a layout where the legend and chart top edge are aligned:
nChartControl1.Panels.Clear();
NLabel label = nChartControl1.Labels.AddHeader("Chart Header");
label.Size = new NSizeL(0, 100);
label.Margins = new NMarginsL(10, 10, 10, 0);
label.Dock = DockStyle.Top;
// content panel
NDockPanel content = new NDockPanel();
content.Margins = new NMarginsL(10, 10, 10, 10);
content.PositionChildPanelsInContentBounds = true;
nChartControl1.Document.RootPanel.ChildPanels.Add(content);
content.Dock = DockStyle.Fill;
// create legend
NLegend legend = new NLegend();
legend.Margins = new NMarginsL(10, 0, 0, 0);
legend.FitAlignment = ContentAlignment.TopCenter;
content.ChildPanels.Add(legend);
legend.Dock = DockStyle.Right;
// create chart
NCartesianChart chart = new NCartesianChart();
chart.Dock = DockStyle.Fill;
content.ChildPanels.Add(chart);
chart.DisplayOnLegend = legend;
chart.BoundsMode = BoundsMode.Stretch;
NPointSeries point = new NPointSeries();
chart.Series.Add(point);
for (int i = 0; i < 10; i++)
{
point.Values.Add(i);
point.XValues.Add(i);
}
Is this similar to the layout configuration you want?
Best Regards,
Nevron Support Team