Jump to content
Software FX Community

Problem in setting dashed line in user legend box item.


B.Zak
 Share

Recommended Posts

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. 

 

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...