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:
n
ChartControl1.Panels.Clear();
NLabel label = new NLabel("Bar
Chart");
label.DockMode = PanelDockMode.Top;
label.Margins = new Nevron.GraphicsCore.NMarginsL(10);
n
ChartControl1.Panels.Add(label);
NLegend legend = new NLegend();
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);
n
ChartControl1.Panels.Add(legend);
NCartesian
Chart chart = new NCartesian
Chart();
chart.BoundsMode = Nevron.GraphicsCore.BoundsMode.Stretch;
chart.Margins = new Nevron.GraphicsCore.NMarginsL(10);
chart.DockMode = PanelDockMode.Fill;
n
ChartControl1.Panels.Add(
chart);
chart.DisplayOnLegend = legend;
NBar
Series bar = new NBar
Series();
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