What Series to use to get Category val for TrackBall

3 posts, 0 answers
  1. David
    David avatar
    22 posts
    Member since:
    Oct 2012

    Posted 18 Oct 2012 Link to this post

    I am using just a LineSeries and setting it's ItemSource to uint array and when I use the TrackBall I just get the Y-value and not the Category one.
    My guess is I need to use a different series type such as ScatterSpline, but I couldn't figure out how to specify data for that sort of series.  My array updates 30 times a sec so I'm constantly nulling out the series ItemSource and setting it back to the uint array
    Also, is it possible to change the "Category" label in the TrackInfo box to something else such as "Channel?"

    Thanks!

    My ChartView in XAML

    <telerik:RadCartesianChart Grid.Row="0"
                               Name="radCartesianChart1"
                               >
        
      <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:CategoricalAxis
                                 MajorTickInterval="255"
                                 LabelInterval="1"
                                 ShowLabels="True"
                                 />
      </telerik:RadCartesianChart.HorizontalAxis>
        
      <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis />
      </telerik:RadCartesianChart.VerticalAxis>
      <telerik:RadCartesianChart.Behaviors>
        <telerik:ChartPanAndZoomBehavior ZoomMode="Both"
                                         PanMode="Both">
        </telerik:ChartPanAndZoomBehavior>
        <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True"
                                        ShowTrackInfo="True"/>
      </telerik:RadCartesianChart.Behaviors>
      <telerik:RadCartesianChart.Series>
        <telerik:LineSeries Stroke="Orange"
                            StrokeThickness="2"/>        
      </telerik:RadCartesianChart.Series>
    </telerik:RadCartesianChart>


    My CodeBehind where I set the ItemSource when my array upda

    void setData(uint[] data)
    {      
      //may use with ScatterSplineSeries??
      //List<PlotInfo> dataList = new List<PlotInfo>();
      //for (int i = 0; i < _EDSData.Length; i++)
      //  dataList.Add(new PlotInfo() { XVal = i, YVal = _EDSData[i] });
      radCartesianChart1.Series[0].ItemsSource = null;
      radCartesianChart1.Series[0].ItemsSource = _EDSData;
    }


    Thanks!

  2. David
    David avatar
    22 posts
    Member since:
    Oct 2012

    Posted 19 Oct 2012 Link to this post

    To get the data to display all I needed to do was change my X-Axis to a LinearAxis.

    I'm still wondering if/how to customize the labels in the TrackInfo pop-up?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 22 Oct 2012 Link to this post

    Hi David,

    Thank you for the attached snapshot and code snippets.

    The reason you are not getting any Category in the TrackBall is that you have not set any CategoryBinding to the LineSeries. While the ChartView visualizes the uint array you have passed to it, it does not know what categories the DataPoints have (because you have omitted this setting). In order for the TrackBall behavior to work properly (and almost all of the chart features for that matter) you need to fully set up the series you are using, i.e. set up Category and Value bindings.

    This is not possible with an array of uint so you will need to create a new class which will hold the needed information. I have attached a simple app to demonstrate this.

    I suggest you invest some more time into exploring our online examples and help topics in which you will find valuable information how to properly set up a chart and how to customize labels, points, track ball and so on.

    Regards,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top