Legend appears above chart


Author
Message
Devin Ellis
Devin Ellis
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 9, Visits: 87
We are using Nevron chart 18.7 for .NET.
We create our charts with two dock panels, one on the top for textual header information and one at the bottom for the actual chart. Whenever the chart has a legend, the legend appears in the middle of the header as seen in the attached image.
How do we make the legend appear below the chart in the chart's dock panel?

https://www.nevron.com/forum/uploads/images/63b138d9-a798-49d6-a2cb-45f1.png

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 Devin,

You can nest the chart and legend in a single dock panel - the following code shows how to create a layout configuration that docks a header to the top and a legend to the bottom:

   nChartControl1.Panels.Clear();

    NLabel label = new NLabel("Some Header");
    label.DockMode = PanelDockMode.Top;

    nChartControl1.Panels.Add(label);

    NDockPanel chartAndLegend = new NDockPanel();
    chartAndLegend.Margins = new NMarginsL(10);
    chartAndLegend.DockMode = PanelDockMode.Fill;
    chartAndLegend.PositionChildPanelsInContentBounds = true;
    nChartControl1.Panels.Add(chartAndLegend);

    NLegend legend = new NLegend();
    legend.DockMode = PanelDockMode.Bottom;
    chartAndLegend.ChildPanels.Add(legend);

    NCartesianChart chart = new NCartesianChart();
    chart.BoundsMode = BoundsMode.Stretch;
    chartAndLegend.ChildPanels.Add(chart);
    chart.DisplayOnLegend = legend;

    NBarSeries bar = new NBarSeries();
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);
    chart.Series.Add(bar);

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



Best Regards,
Nevron Support Team


Devin Ellis
Devin Ellis
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 9, Visits: 87
I was able to use your code to set the legend inside the chart. Thanks for the help.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search