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

What Series to use to get Category val for TrackBall

2 Answers 84 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 18 Oct 2012, 07:00 PM

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

Sort by
0
David
Top achievements
Rank 1
answered on 19 Oct 2012, 01:12 PM
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?
0
Petar Marchev
Telerik team
answered on 22 Oct 2012, 08:07 AM
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.

Tags
ChartView
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Petar Marchev
Telerik team
Share this question
or