public void Receive(Dictionary <string, object> Objects) { nowTime = nowTime.AddMilliseconds(500); LinesCollection temp = new LinesCollection(); Type t = temp.GetType(); DataLine aux = null; foreach (var line in Lines.Reference.Keys) { if (Objects.ContainsKey(line)) { //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, // (ThreadStart)(() => UpdateProperty(t, ref aux, line, Objects, nowTime))); string varProp = "Var" + Lines.Reference[line]; aux = (t.GetProperty(varProp).GetValue(temp, null) as DataLine); aux.Data = Convert.ToDouble(Objects[line]); aux.Time = nowTime; } } UpdateDataLive(temp); //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, // (ThreadStart)(() => SetUpAxisXRange(nowTime))); //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, // (ThreadStart)(() => RadChart1.ItemsSource = null)); //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, // (ThreadStart)(() => RadChart1.ItemsSource = data)); }
private void FillDataLine() { Type t = Lines.GetType(); DataLine aux = new DataLine(); for (int i = 0; i < Lines.Reference.Count; i++) { string propName = string.Format("Var{0}", Lines.Reference.Values.ElementAt(i)); aux = (t.GetProperty(propName).GetValue(Lines, null) as DataLine); if (aux.Active) { SeriesMapping lineDataMapping = new SeriesMapping(); lineDataMapping.LegendLabel = aux.VariableName; // lineDataMapping.CollectionIndex = i; lineDataMapping.SeriesDefinition = new LineSeriesDefinition(); (lineDataMapping.SeriesDefinition as LineSeriesDefinition).ShowPointMarks = false; (lineDataMapping.SeriesDefinition as LineSeriesDefinition).ShowItemLabels = false; if (aux.IsInput) { lineDataMapping.SeriesDefinition.AxisName = "Input"; } string xValue = propName + ".Time"; string yValue = propName + ".Data"; lineDataMapping.ItemMappings.Add(new ItemMapping(xValue, DataPointMember.XValue)); lineDataMapping.ItemMappings.Add(new ItemMapping(yValue, DataPointMember.YValue)); RadChart1.SeriesMappings.Add(lineDataMapping); } } }