Group: Forum Members
Last Active: 3 Years Ago
Posts: 11,
Visits: 45
|
How can I , move the & nbsp ; Bar Chart Legend Position to be away from the chart , also ideally I would like to remove the box 73% of original size (was 686x19) - Click to enlarge 
|
Group: Forum Members
Last Active: Last Month
Posts: 3,055,
Visits: 4,052
|
Hi Mike , We would recommend that you docking to achive this layout . In this case you can dock the lagend to the right ,& nbsp ; 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 : & nbsp ;& nbsp ;& nbsp ; nChartControl1 . Panels . Clear (); & nbsp ;& nbsp ;& nbsp ;& nbsp ; NLabel label = new NLabel (" Bar Chart "); & nbsp ;& nbsp ;& nbsp ;& nbsp ; label . DockMode = PanelDockMode . Top ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; label . Margins = new Nevron . GraphicsCore . NMarginsL ( 10 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; nChartControl1 . Panels . Add ( label ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; NLegend legend = new NLegend (); & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . DockMode = PanelDockMode . Right ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . FitAlignment = ContentAlignment . TopCenter ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . Margins = new Nevron . GraphicsCore . NMarginsL ( 10 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . OuterTopBorderStyle . Width = new Nevron . GraphicsCore . NLength ( 0 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . OuterLeftBorderStyle . Width = new Nevron . GraphicsCore . NLength ( 0 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . OuterRightBorderStyle . Width = new Nevron . GraphicsCore . NLength ( 0 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; legend . OuterBottomBorderStyle . Width = new Nevron . GraphicsCore . NLength ( 0 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; nChartControl1 . Panels . Add ( legend ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; NCartesianChart chart = new NCartesianChart (); & nbsp ;& nbsp ;& nbsp ;& nbsp ; chart . BoundsMode = Nevron . GraphicsCore . BoundsMode . Stretch ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; chart . Margins = new Nevron . GraphicsCore . NMarginsL ( 10 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; chart . DockMode = PanelDockMode . Fill ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; nChartControl1 . Panels . Add ( chart ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; chart . DisplayOnLegend = legend ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; NBarSeries bar = new NBarSeries (); & nbsp ;& nbsp ;& nbsp ;& nbsp ; bar . Values . Add ( 10 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; bar . Values . Add ( 20 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; bar . Values . Add ( 30 ); & nbsp ;& nbsp ;& nbsp ;& nbsp ; bar . DataLabelStyle . Visible = true ; & nbsp ;& nbsp ;& nbsp ;& nbsp ; 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
|