Bar Chart Legend Position


Author
Message
Mike Holmes
Mike Holmes
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 11, Visits: 45
How can I, move the Bar Chart Legend Position to be away from the chart, also ideally I would like to remove the boxhttps://www.nevron.com/forum/uploads/images/bae595a8-ede6-45e7-9245-c82f.jpg
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
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);

    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);
    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.DisplayOnLegend = 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.html

We hope this helps - let us know if you have any questions.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search