Jump to content
Software FX Community

Problem in setting dashed line in user legend box item.


B.Zak

Recommended Posts

Posted

Hi, I have faced a probem while setting dashed line in one of the item of User Legend Box.

I have set the following properties for item 2 of user legend box:

Chart1.UserLegendBoxObj.Item[2].MarkerShape = SoftwareFX.ChartFX.MarkerShape.HorzLine;Chart1.UserLegendBoxObj.Item[2].Pattern = System.Drawing.Drawing2D.HatchStyle.DashedHorizontal;

In fact I tried to set the following as well: 

Chart1.UserLegendBoxObj.Item[2].Attributes.LineStyle = System.Drawing.Drawing2D.

DashStyle.Dash;

Also I set:

Chart1.UserLegendBoxObj.Item[2].Color = System.Drawing.Color.Blue;

Chart1.UserLegendBoxObj.Item[2].AlternateColor = System.Drawing.

Color.White;

But still there is no effect. Please help. 

 

Posted

SoftwareFX.ChartFX.MarkerShape.HorzLine corresponds to basically a rectangle that has a fixed height, and a width determnined by the marker's size.

What do you want to get in your custom legend box?

 A dashed line can be obtained by setting the markershape to None and setting ShowLine to true. For example:

CustomLegendItem ci = new CustomLegendItem();

ci.ShowLine =

true;ci.MarkerShape = MarkerShape.None;

ci.Text =

"My Custom Item";ci.Border.Style = DashStyle.Dash;

ci.Border.Width = 2;

ci.Color =
Color.Red;

chart1.LegendBox.CustomItems.Add(ci);

Posted

Thank for your kind cooperation.

I am unable to find the mentioned class "CustomLegendItem" and also the Chart, I am using does not have any property called "LegendBox.CustomItems".

I am using Chartfx( Version 6.2.1342.0) with .NET 2.0.

Please help.

Posted

Sorry, I didn't realize you were using 6.2 (this forum is for Chart FX for VS 2005).

The code I gave you is for Chart FX for VS 2005 (7.0).

What you are looking for is not possible in 6.2, custom legend box items can not have a line with a specific style, they can only have markers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...