Hi Mike,
We would recommend that you docking to achive this layout. In this case you can dock the lagend to the right, the label to the top and finally dock the chart to fill the rest. That way the chart will automatically measure the sizes of the label and
legend and they'll not overlap - for example:
nChartControl1.Panels.Clear();
NLabel label = new NLabel("Bar Chart");
label.DockMode = PanelDockMode.Top;
label.Margins = new Nevron.GraphicsCore.NMarginsL(10);
nChartControl1.Panels.Add(label);
N
Legend legend = new N
Legend();
legend.DockMode = PanelDockMode.Right;
legend.FitAlignment = ContentAlignment.TopCenter;
legend.Margins = new Nevron.GraphicsCore.NMarginsL(10);
legend.OuterTopBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
legend.OuterLeftBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
legend.OuterRightBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
legend.OuterBottomBorderStyle.Width = new Nevron.GraphicsCore.NLength(0);
nChartControl1.Panels.Add(
legend);
NCartesianChart chart = new NCartesianChart();
chart.BoundsMode = Nevron.GraphicsCore.BoundsMode.Stretch;
chart.Margins = new Nevron.GraphicsCore.NMarginsL(10);
chart.DockMode = PanelDockMode.Fill;
nChartControl1.Panels.Add(chart);
chart.DisplayOn
Legend =
legend;
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
bar.DataLabelStyle.Visible = true;
chart.Series.Add(bar);
This code also shows how to turn off the border around the
legend.
You can take a look at the following topic in the documentation:
http://helpdotnetvision.nevron.com/#UsersGuide_Layout_Docking_Panels.htmlWe hope this helps - let us know if you have any questions.
Best Regards,
Nevron Support Team