The Dash style of the legend items

Hi,
I wanted to change manually the dash style of the legends items.
I tried the following code:
chartControl.Legend.Items(0).Border.DashStyle = Drawing2D.DashStyle.Dot

But it makes no change.
The legend representation type I use is ChartLegendRepresentationType.StraightLine

If I try to change the symbol displayed on a specific Legend Item, it works perfectly using the code:
chartControl.Legend.Items(0).Symbol.Shape = ChartSymbolShape.Square

How to change the dash style o the legend items?

Thank you in advance for your help.



4 Replies

SC Subash Chandran M Syncfusion Team December 8, 2010 07:31 AM UTC

Hi Leila,

Thanks for using Syncfusion products.

I am afraid, that I was unable to reproduce this issue. We have created a sample to meet your requirement, which shows the legend item dash style correctly.

Please check the code snippet below :
[C#]

chartControl1.Legend.Items[0].Border.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;

Kindly provide us the details of the Syncfusion Essential studio version that you are using to render Chart.

Please let me know if any concerns.

Regards,
Subash Chandran M




LB Leïla Benakezouh December 8, 2010 09:16 AM UTC

Hi,
Thank you for your quick answer.

The code you write works perfectly except if the legend representation type is set to StraightLine
chartControl.Legend.RepresentationType = ChartLegendRepresentationType.StraightLine

In this particular case, the dash style cannot be changed.

I use the version Essential Studio V8.3.0.21

Regards.



LB Leïla Benakezouh December 8, 2010 09:21 AM UTC

Hi,
Thank you for your quick answer.

The code you write works perfectly except if the legend representation type is set to StraightLine
chartControl.Legend.RepresentationType = ChartLegendRepresentationType.StraightLine

In this particular case, the dash style cannot be changed.

I use the version Essential Studio V8.3.0.21

Regards.



SC Subash Chandran M Syncfusion Team December 9, 2010 08:37 AM UTC

Hi Leila,

Thanks for the update.

Internally, we are not using border setting of the legend item for the Cross, Line, StraightLine RepresentationType since it’s a single line. So, we suggest you to use LegendRepresentationType as SeriesType to have dash style for the borders.

Please check the code snippet below :
[C#]

chartControl1.Legend.RepresentationType = ChartLegendRepresentationType.SeriesType;
chartControl1.Legend.Items[0].Border.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;


Let me know if any concerns.

Regards,
Subash Chandran M




Loader.
Up arrow icon