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

CategoricalAxis VS DateTimeContinuousAxis

2 Answers 170 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 29 Nov 2016, 01:05 PM

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 Answers, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 1
answered on 29 Nov 2016, 05:13 PM
I am basically trying to create a jitter plot where the numbers on the y axis would be ID names
0
Dinko | Tech Support Engineer
Telerik team
answered on 02 Dec 2016, 07:25 AM
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.
Tags
ChartView
Asked by
Nathan
Top achievements
Rank 1
Answers by
Nathan
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or