Legend & DashArray?

5 posts, 1 answers
  1. Chris
    Chris avatar
    7 posts
    Member since:
    Jan 2012

    Posted 20 Jun 2012 Link to this post

    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,

  2. Answer
    Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 21 Jun 2012 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Chris
    Chris avatar
    7 posts
    Member since:
    Jan 2012

    Posted 21 Jun 2012 Link to this post

    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

  5. Chris
    Chris avatar
    7 posts
    Member since:
    Jan 2012

    Posted 22 Jun 2012 Link to this post

    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.
  6. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 27 Jun 2012 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready