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

Line chart populated from uint[]

3 Answers 40 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Oct 2012, 06:05 PM
Hi,

I'm new to Telerik controls and WPF for that matter.  I have an array of uint, always will have 2048 items and I'd like to plot a line chart using the ChartView.  I cannot figure out the right combination of what type of data series and how to format the axis. This array will be updating periodically, so is there away for the chart to get updated when the array does?  Also is there a way to fill in the area beneath the line chart?

Looking for some code snippets, or a sample project.  We are looking to buy a WPF toolkit in the very near future for up to 5 developers.

Thanks!

3 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 16 Oct 2012, 08:12 PM
I basically figured out how to populate the chart with data for a Line chart from my array:

 

 

 

//globally defined    
private uint[] _EDSData = new uint[2048];   
    
  
void timer_Tick(object sender, EventArgs e) 
 
   RandomlyPopulateArray(_EDSData);      
   radCartesianChart1.Series[0].ItemsSource = null;    
   radCartesianChart1.Series[0].ItemsSource = _EDSData;    

My XAML looks as follows:

<telerik:RadCartesianChart Grid.Row="0"  Name="radCartesianChart1">
    
  <telerik:RadCartesianChart.HorizontalAxis>
    <telerik:CategoricalAxis MajorTickInterval="256"
                             LabelInterval="128"
                             ShowLabels="True"
                             />
  </telerik:RadCartesianChart.HorizontalAxis>
    
  <telerik:RadCartesianChart.VerticalAxis>
    <telerik:LinearAxis />
  </telerik:RadCartesianChart.VerticalAxis>
    
  <telerik:RadCartesianChart.Series>
    <telerik:LineSeries Stroke="Orange"
                        StrokeThickness="2">
    </telerik:LineSeries>
      
  </telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>

I would like to know how I can label my X-axis, basically just the index of the data point in the array.  Also I would like to know how to fill the area under the line.

Thanks!

0
Petar Marchev
Telerik team
answered on 17 Oct 2012, 08:15 AM
Hi David,

how I can label my X-axis
Try decreasing the LabelInterval. Try a value of 2 and see how it goes.

how to fill the area under the line
Try the AreaSeries instead of the LineSeries.

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
David
Top achievements
Rank 1
answered on 17 Oct 2012, 03:49 PM
Thank you for your help Peter!
Tags
ChartView
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Petar Marchev
Telerik team
Share this question
or