This is a migrated thread and some comments may be shown as answers.

Legend & DashArray?

4 Answers 235 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 20 Jun 2012, 12:54 PM

In my usage of the ChartCiew I have three line series drawn on a chart per date, all of which share the same colour which are distinguished by using the DashArray property of the LineSeries class to make one solid, one dotted (1,1) and one dashed (3,3).  Each different date shown on the chart uses a different colour.

I can't seem to figure out how to make a legend that replicates the line drawn on the chart using the dash array property, do you have any advice? 


I have looked at your examples and can't see one that does what I want.

I can't really attach the code but I have attached an image showing a chart containing two LineSeries (one solid and one dashed) and my desired legend to indicate my requirements.

Thanks,

4 Answers, 1 is accepted

Sort by
0
Accepted
Evgenia
Telerik team
answered on 21 Jun 2012, 10:51 AM
Hello Chris,

 Thanks for the sample image.
You can achieve such legend with StackPanel where each legend item is made of TextBlock and Line. To have your line dashed just use the StrokeDashArray property of the Line. I prepared a small project to demonstrate this. You can find it attached. I hope it helps.

Greetings,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Chris
Top achievements
Rank 1
answered on 21 Jun 2012, 01:00 PM
This is the wpf forum, why have you done your example in silverlight 5 which I don't have installed?

Anyway I opened up the MainPage.xaml in Notepad saw what you meant and it worked perfectly.

Thanks for your help

0
Chris
Top achievements
Rank 1
answered on 22 Jun 2012, 09:51 AM
I have implemented this now but please could you please make the PresenterCollection class used by the Series property of the Chart implement INotifyCollectionChanged?

I am dynamically adding series to and from the chart in code and because this interface is missing at the moment I have had to bind my legend control to a different collection that implements that interface that I need to keep in sync with the chart myself.
0
Evgenia
Telerik team
answered on 27 Jun 2012, 08:41 AM
Hello Chris,

I forwarded your suggestion to our developers and they will consider whether this will be made. As for the sample project - I'm sorry for omitting to see that you posted this in RadChartView for WPF forum thread. I'm glad that you converted the SL application to WPF on your own.

Greetings,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ChartView
Asked by
Chris
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Chris
Top achievements
Rank 1
Share this question
or