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);
}
}