Re: Custom Labels on a Time X Axis

WPF

Windows Presentation Foundation controls

Custom Labels on a Time X Axis

  • rated by 0 users
  • This post has 1 Reply |
  • 2 Followers
  • Hi there,

    I want to plot a line using a Time XAxis (IsTime=True) but instead of the automatic dates, I want to display a custom label on the X Axis, which in my case is the difference from the start date, like so: 

    • 1 day
    • 1 week
    • 2 weeks
    • 1 month
    • 6 months
    • etc.

    So while my XYDataSeries contains date values for the X axis, I want to:

    1. Specify what are the data points for which labels are displayed (note from the list above that they are not evenly spaced)
    2. Display a custom label for each of those points, instead of the date

    Ideally I'd be able to create my XYDatSeries in this manner:

                return new XYDataSeries
                           {
                               XValuesSource = myData.Dates.ToArray(),
                               ValuesSource = myData.Values.ToArray(),

                               // This is what I'd like to do: specify a custom label for my dates
                               XLabelsSource = myData.DateLabels.ToArray()
                           };
     

    Thanks for your help

  • Hi,

    This feature will be available in new V2 release. The labels can be specified as pairs of label and axis value or with axis
    ItemsSource/ItemValueBinding/ItemLabelBinding properties.

    --
    Best regards,
    Alex

Page 1 of 1 (2 items)