internal override void GenerateComplexPropertyPoints(string[] yPaths, IList <double>[] yLists, GetReflectedProperty getPropertyValue) { IEnumerator enumerator = (ItemsSource as IEnumerable).GetEnumerator(); if (enumerator.MoveNext()) { for (int i = 0; i < UpdateStartedIndex; i++) { enumerator.MoveNext(); } XAxisValueType = GetDataType(ItemsSource as IEnumerable, XComplexPaths); if (XAxisValueType == ChartValueType.DateTime || XAxisValueType == ChartValueType.Double || XAxisValueType == ChartValueType.Logarithmic || XAxisValueType == ChartValueType.TimeSpan) { if (!(XValues is List <double>)) { this.ActualXValues = this.XValues = new List <double>(); } } else { if (!(XValues is List <string>)) { this.ActualXValues = this.XValues = new List <string>(); } } string[] tempYPath = YComplexPaths[0]; if (string.IsNullOrEmpty(yPaths[0])) { return; } object xVal = null, yVal = null; if (XAxisValueType == ChartValueType.String) { IList <string> xValue = this.XValues as List <string>; do { xVal = getPropertyValue(enumerator.Current, XComplexPaths); yVal = getPropertyValue(enumerator.Current, tempYPath); if (xVal == null) { return; } xValue.Add((string)xVal); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.Double || XAxisValueType == ChartValueType.Logarithmic) { IList <double> xValue = this.XValues as List <double>; do { xVal = getPropertyValue(enumerator.Current, XComplexPaths); yVal = getPropertyValue(enumerator.Current, tempYPath); if (xVal == null) { return; } XData = Convert.ToDouble(xVal); xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.DateTime) { IList <double> xValue = this.XValues as List <double>; do { xVal = getPropertyValue(enumerator.Current, XComplexPaths); yVal = getPropertyValue(enumerator.Current, tempYPath); if (xVal == null) { return; } XData = ((DateTime)xVal).ToOADate(); xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.TimeSpan) { IList <double> xValue = this.XValues as List <double>; do { xVal = getPropertyValue(enumerator.Current, XComplexPaths); yVal = getPropertyValue(enumerator.Current, tempYPath); if (xVal == null) { return; } XData = ((TimeSpan)xVal).TotalMilliseconds; xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } } IsPointGenerated = true; }
internal override void GeneratePropertyPoints(string[] yPaths, IList <double>[] yLists) { IEnumerator enumerator = ItemsSource.GetEnumerator(); if (enumerator.MoveNext()) { for (int i = 0; i < UpdateStartedIndex; i++) { enumerator.MoveNext(); } // To get the type of the x value and xGetMethod. PropertyInfo xPropertyInfo = ChartDataUtils.GetPropertyInfo(enumerator.Current, this.XBindingPath); IPropertyAccessor xPropertyAccessor = null; if (xPropertyInfo != null) { xPropertyAccessor = FastReflectionCaches.PropertyAccessorCache.Get(xPropertyInfo); } if (xPropertyAccessor == null) { return; } Func <object, object> xGetMethod = xPropertyAccessor.GetMethod; XAxisValueType = GetDataType(xPropertyAccessor, ItemsSource as IEnumerable); if (XAxisValueType == ChartValueType.DateTime || XAxisValueType == ChartValueType.Double || XAxisValueType == ChartValueType.Logarithmic || XAxisValueType == ChartValueType.TimeSpan) { if (!(ActualXValues is List <double>)) { this.ActualXValues = this.XValues = new List <double>(); } } else { if (!(ActualXValues is List <string>)) { this.ActualXValues = this.XValues = new List <string>(); } } // To get the yGetMethod. PropertyInfo yPropertyInfo = ChartDataUtils.GetPropertyInfo(enumerator.Current, yPaths[0]); IPropertyAccessor yPropertyAccessor = null; if (yPropertyInfo != null) { yPropertyAccessor = FastReflectionCaches.PropertyAccessorCache.Get(yPropertyInfo); } if (yPropertyAccessor == null) { return; } if (yPropertyAccessor == null) { return; } Func <object, object> yGetMethod = yPropertyAccessor.GetMethod; if (XAxisValueType == ChartValueType.String) { IList <string> xValue = this.XValues as List <string>; do { object xVal = xGetMethod(enumerator.Current); object yVal = yGetMethod(enumerator.Current); xValue.Add(xVal != null ? (string)xVal : string.Empty); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.Double || XAxisValueType == ChartValueType.Logarithmic) { IList <double> xValue = this.XValues as List <double>; do { object xVal = xGetMethod(enumerator.Current); object yVal = yGetMethod(enumerator.Current); XData = Convert.ToDouble(xVal != null ? xVal : double.NaN); xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.DateTime) { IList <double> xValue = this.XValues as List <double>; do { object xVal = xGetMethod(enumerator.Current); object yVal = yGetMethod(enumerator.Current); XData = ((DateTime)xVal).ToOADate(); xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } else if (XAxisValueType == ChartValueType.TimeSpan) { IList <double> xValue = this.XValues as List <double>; do { object xVal = xGetMethod(enumerator.Current); object yVal = yGetMethod(enumerator.Current); XData = ((TimeSpan)xVal).TotalMilliseconds; xValue.Add(XData); YCollection.Add((IList <double>)yVal ?? new double[0]); ActualData.Add(enumerator.Current); }while (enumerator.MoveNext()); DataCount = xValue.Count; } } IsPointGenerated = true; }