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

Takes more time (30 minutes)+Wpf Chart + Data Point with lineseries +Records more than 70000 records

1 Answer 70 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Satish Gutti
Top achievements
Rank 1
Satish Gutti asked on 09 Dec 2010, 06:59 AM
Hi

We are creating an Lineseries chart with datapoints which has around 70000+ records .It is taking more than 30 minutes to load the chart .we have disable the animations to false(ChartArea.EnableAnimations = false) and also SamplingSettings.SamplingThreshold = 0. so please help us.The code we are using are as below

 

 

private void BuildDiskIoDetailsGraph(ObservableCollection<DiskIoDetails> raw, Telerik.Windows.Controls.RadChart ctrlChart, string title, bool isPrefetch)

 

{

 

 

if (raw.Count > 0)

 

{

 

 

DataSeries chartSeries = new DataSeries();

 

chartSeries.Definition =

 

new LineSeriesDefinition() { ShowItemLabels = false, ShowItemToolTips = true };

 

ctrlChart.SamplingSettings.SamplingThreshold = 0;

ctrlChart.DefaultView.ChartArea.EnableAnimations =

 

false;

 

ctrlChart.DefaultView.ChartLegend.Visibility =

 

Visibility.Collapsed;

 

ctrlChart.DefaultView.ChartLegend.UseAutoGeneratedItems =

 

true;

 

ctrlChart.DefaultView.ChartArea.AxisX.Step = 20f;

ctrlChart.DefaultView.ChartArea.AxisX.AutoRange =

 

true;

 

ctrlChart.DefaultView.ChartArea.AxisX.Title =

 

"Time";

 

 

 

 

List<object> processList = raw.Select(d => d.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, d, null)).Distinct().ToList();

 

 

 

foreach (object process in processList)

 

{

 

 

Color color = GetNextColor();

 

 

 

if (process.ToString().ToLower().StartsWith("system")) color = Colors.Blue;

 

 

 

if (process.ToString().ToLower().StartsWith("winlogon")) color = Colors.Maroon;

 

 

 

if (process.ToString().ToLower().StartsWith("idle")) color = Colors.Green;

 

 

chartSeries.Definition.Appearance.Foreground =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.Fill =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.PointMark.Fill =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.Stroke =

 

new SolidColorBrush(Colors.LightGray);

 

 

chartSeries.Definition.Appearance.PointMark.Stroke =

 

new SolidColorBrush(color);

 

 

 

List<DiskIoDetails> dataList = raw.Where(d => d.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, d, null).ToString().Equals(process.ToString())).ToList();

 

 

 

foreach (object item in dataList)

 

{

 

 

string startTime = item.GetType().InvokeMember("StartTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string offset = item.GetType().InvokeMember("ByteOffset", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString().TrimStart("0x".ToCharArray());

 

 

 

string ioType = item.GetType().InvokeMember("IOType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string endTime = item.GetType().InvokeMember("EndTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string processName = item.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

if (ioType.ToLower().Contains("read")) ioType = "Read";

 

 

 

else ioType = "Write";

 

 

 

if (string.IsNullOrEmpty(offset)) offset = "0";

 

 

 

if (chartSeries != null)

 

{

 

 

double initTime = Convert.ToDouble(startTime) / _nsPerSec;

 

 

 

double complete = Convert.ToDouble(endTime) / _nsPerSec;

 

 

 

 

DataPoint dp = new DataPoint( (Convert.ToDouble(startTime) / _nsPerSec),long.Parse(offset, System.Globalization.NumberStyles.HexNumber));

 

dp.Tooltip =

 

string.Format("{0}{1}InitTime: {2}{1}Complete Time: {3}{1}{4}", ioType, Environment.NewLine, initTime, complete, processName);

 

 

chartSeries.Add(dp);

 

 

//m_Line.Interactivity.Tooltips.Add(string.Format("{0}{1}InitTime: {2}{1}Complete Time: {3}{1}{4}", ioType, Environment.NewLine, initTime, complete, processName));

 

 

 

 

 

 

}

}

}

ctrlChart.DefaultView.ChartArea.DataSeries.Add(chartSeries);

 

 

}

}

 

 

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 13 Dec 2010, 09:42 AM
Hello Satish Gutti,

Displaying that many points at once is quite a challenge and can produce some unexpected results. Thats why we have a sampling functionality that reduces your data to a digestible amount that can be displayed at once. You can modify the sampling threshold (setting it to 0 disables it) and also the sampling function.

If sampling is not suitable for your case than perhaps you can find our zooming functionality useful. Please take a look on our 100,000+ records example here.

Best wishes,
Yavor Ivanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
Chart
Asked by
Satish Gutti
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or