Profile Picture

Legend shape

Posted By David Clark 14 Years Ago
Author
Message
David Clark
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 7, Visits: 1
I would have thought it would be possible to set the shape of the legend like this:

legend.BorderStyle.Shape = BorderShape.RoundedRect;

But BorderStyle is null. Ok, I'll create a new border style instance:

legend.BorderStyle = new NBorderStyle(BorderShape.RoundedRect);

Nope, NBorderStyle is an abstract class. What class should I use? I can't seem to find this information anywhere in the online documentation.

bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi David,

More information can be found at:

http://helpdotnetvision.nevron.com/UsersGuide_Panels_BorderAndBackground.html


The following code snippet shows how to apply a rounded border to the legend, as well as how to turn off the legend grid:

nChartControl1.Panels.Clear();
NLegend legend =
new NLegend();
legend.Mode = LegendMode.Manual;
legend.UseAutomaticSize =
true;

for (int i = 0; i < 3; i++)
{
NLegendItemCellData licd =
new NLegendItemCellData();
licd.Text = i.ToString();
legend.Data.Items.Add(licd);
}

// optionally turn off border
legend.HorizontalBorderStyle.Width = new NLength(0);
legend.VerticalBorderStyle.Width =
new NLength(0);
legend.OuterBottomBorderStyle.Width =
new NLength(0);
legend.OuterTopBorderStyle.Width =
new NLength(0);
legend.OuterLeftBorderStyle.Width =
new NLength(0);
legend.OuterRightBorderStyle.Width =
new NLength(0);

// increase padding
legend.Padding = new NMarginsL(10, 10, 10, 10);

// set a border
NStrokeBorderStyle strokeBorder = new NStrokeBorderStyle(BorderShape.RoundedRect);
legend.BorderStyle = strokeBorder;
legend.BackgroundFillStyle =
new NColorFillStyle(Color.LightGray);
nChartControl1.Panels.Add(legend);

Hope I helped - let me know if you have any questions or comments.

Best regards,
Bob



David Clark
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 7, Visits: 1
Very helpful, thank you.

Is there a way to set the dockstyle to "top" without the new border expanding to fill the width of the control? I realise that that is normal behaviour for .NET, but then that doesn't happen with the default border.

I've also noticed that the Shadow of the legend still has square corners.

bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi David,

1. Is there a way to set the dockstyle to "top" without the new border expanding to fill the width of the control? I realise that that is normal behaviour for .NET, but then that doesn't happen with the default border.
No we don't have this feature yet - you can place the legend at the top by using Location/Content alignment position:

legend.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0));
legend.ContentAlignment = ContentAlignment.BottomCenter;

but that way you'll loose the docking functionality that related to other panels.

2. I've also noticed that the Shadow of the legend still has square corners.
Hmm that can easily be fixed - I'll make sure we have a shadow property for the border in the next edition or SP of the control.

Questions or comments - please feel free...

Best regards,
Bob





Similar Topics


Reading This Topic