CategoricalAxis VS DateTimeContinuousAxis

3 posts, 0 answers
  1. Nathan
    Nathan avatar
    3 posts
    Member since:
    Aug 2016

    Posted 29 Nov 2016 Link to this post

    I always see CategoricalAxis being used on the X-Axis, however, I would like to plot multiple series based on Categories on the Y-Axis and have DateTime on the X-Axis.

    How would I go about plotting:

    var points = new ObservaleCollection<MyPoint>()

    {

      (new MyPoint(){ Category = "ID1", Time = now }),

      (new MyPoint(){ Category = "ID2", Time = now }),

      (new MyPoint(){ Category = "ID3", Time = now + 1 }),

      (new MyPoint(){ Category = "ID1", Time = now + 1 }),

      (new MyPoint(){ Category = "ID2", Time = now + 2 }),

      etc, etc

    };

     

    I attached an image that shows what I'm trying to accomplish.

  2. Nathan
    Nathan avatar
    3 posts
    Member since:
    Aug 2016

    Posted 29 Nov 2016 Link to this post

    I am basically trying to create a jitter plot where the numbers on the y axis would be ID names
  3. Dinko
    Admin
    Dinko avatar
    266 posts

    Posted 02 Dec 2016 Link to this post

    Hello Nathan,

    Thank you for contacting us.

    Looking at the provided pictures we can suggest you using the PointSeries which can fit your needs. The PointSeries works with one LinearAxis and one CategoricalAxis. In your case, you can use DateTimeCategoricalAxis as the data is in DateTime format.

    As for your second question, in order to show ID names  on the vertical axis, you can specify custom DataTemplate for the LabelTemplate property of the LinearAxis.
    <telerik:LinearAxis>
        <telerik:LinearAxis.LabelTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="ID "/>
                    <TextBlock Text="{Binding}"/>
                </StackPanel>
            </DataTemplate>
        </telerik:LinearAxis.LabelTemplate>
    </telerik:LinearAxis>

     We have created sample project demonstrating this approach.

    Regards,
    Dinko
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top