public void DataBindXY(IEnumerable xValue, string xField, IEnumerable yValue, string yFields) { this.series.TraceWrite("ChartDataBinding", SR.TraceMessagePopulatingSeriesDataPoints(this.series.Name)); string[] array = null; if (yFields != null) { array = yFields.Replace(",,", "\n").Split(','); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ","); } } if (yValue == null) { throw new ArgumentNullException("yValue", SR.ExceptionDataPointInsertionYValueNotSpecified); } if (yValue is string) { throw new ArgumentException(SR.ExceptionDataBindYValuesToString, "yValue"); } if (xValue is string) { throw new ArgumentException(SR.ExceptionDataBindXValuesToString, "xValue"); } if (array != null && array.GetLength(0) <= this.series.YValuesPerPoint) { this.array.Clear(); IEnumerator enumerator = null; IEnumerator dataSourceEnumerator = DataPointCollection.GetDataSourceEnumerator(yValue); if (dataSourceEnumerator.GetType() != typeof(DbEnumerator)) { dataSourceEnumerator.Reset(); } if (xValue != null) { if (xValue != yValue) { enumerator = DataPointCollection.GetDataSourceEnumerator(xValue); if (enumerator.GetType() != typeof(DbEnumerator)) { enumerator.Reset(); } } else { enumerator = dataSourceEnumerator; } } bool flag = false; bool flag2 = true; object[] array2 = new object[array.Length]; object obj = null; bool flag3 = true; do { if (flag2) { flag2 = dataSourceEnumerator.MoveNext(); } if (xValue != null) { if (xValue != yValue) { flag = enumerator.MoveNext(); if (flag2 && !flag) { throw new ArgumentOutOfRangeException("xValue", SR.ExceptionDataPointInsertionXValuesQtyIsLessYValues); } } else { flag = flag2; } } if (flag3) { flag3 = false; DataPointCollection.AutoDetectValuesType(this.series, enumerator, xField, dataSourceEnumerator, array[0]); } if (flag || flag2) { DataPoint dataPoint = new DataPoint(this.series); bool flag4 = false; if (flag) { obj = DataPointCollection.ConvertEnumerationItem(enumerator.Current, xField); if (DataPointCollection.IsEmptyValue(obj)) { flag4 = true; obj = 0.0; } } if (array.Length == 0) { array2[0] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, null); if (DataPointCollection.IsEmptyValue(array2[0])) { flag4 = true; array2[0] = 0.0; } } else { for (int j = 0; j < array.Length; j++) { array2[j] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, array[j]); if (DataPointCollection.IsEmptyValue(array2[j])) { flag4 = true; array2[j] = 0.0; } } } if (flag4) { if (obj != null) { dataPoint.SetValueXY(obj, array2); } else { dataPoint.SetValueXY(0, array2); } this.DataPointInit(ref dataPoint); dataPoint.Empty = true; this.array.Add(dataPoint); } else { if (obj != null) { dataPoint.SetValueXY(obj, array2); } else { dataPoint.SetValueXY(0, array2); } this.DataPointInit(ref dataPoint); this.array.Add(dataPoint); } } }while (flag || flag2); this.series.TraceWrite("ChartDataBinding", SR.TraceMessageSeriesPopulatedWithDataPoints(this.series.Name, this.array.Count.ToString(CultureInfo.CurrentCulture))); return; } throw new ArgumentOutOfRangeException("yValue", SR.ExceptionDataPointYValuesCountMismatch(this.series.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))); }
public void DataBindXY(IEnumerable xValue, params IEnumerable[] yValues) { this.series.TraceWrite("ChartDataBinding", SR.TraceMessagePopulatingSeriesDataPoints(this.series.Name)); for (int i = 0; i < yValues.Length; i++) { if (yValues[i] is string) { throw new ArgumentException(SR.ExceptionDataBindYValuesToString, "yValues"); } } if (yValues != null && yValues.GetLength(0) != 0) { if (yValues.GetLength(0) > this.series.YValuesPerPoint) { throw new ArgumentOutOfRangeException("yValues", SR.ExceptionDataPointYValuesBindingCountMismatch(this.series.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))); } this.array.Clear(); IEnumerator enumerator = null; IEnumerator[] array = new IEnumerator[yValues.GetLength(0)]; if (xValue != null) { if (xValue is string) { throw new ArgumentException(SR.ExceptionDataBindXValuesToString, "xValue"); } enumerator = DataPointCollection.GetDataSourceEnumerator(xValue); if (enumerator.GetType() != typeof(DbEnumerator)) { enumerator.Reset(); } } for (int j = 0; j < yValues.Length; j++) { array[j] = DataPointCollection.GetDataSourceEnumerator(yValues[j]); if (array[j].GetType() != typeof(DbEnumerator)) { array[j].Reset(); } } bool flag = false; bool flag2 = true; object[] array2 = new object[this.series.YValuesPerPoint]; object obj = null; bool flag3 = true; do { flag2 = true; for (int k = 0; k < yValues.Length; k++) { if (flag2) { flag2 = array[k].MoveNext(); } } if (xValue != null) { flag = enumerator.MoveNext(); if (flag2 && !flag) { throw new ArgumentOutOfRangeException("xValue", SR.ExceptionDataPointInsertionXValuesQtyIsLessYValues); } } if (flag3) { flag3 = false; DataPointCollection.AutoDetectValuesType(this.series, enumerator, null, array[0], null); } if (flag || flag2) { DataPoint dataPoint = new DataPoint(this.series); bool flag4 = false; if (flag) { obj = DataPointCollection.ConvertEnumerationItem(enumerator.Current, null); if (obj is DBNull || obj == null) { flag4 = true; obj = 0.0; } } for (int l = 0; l < yValues.Length; l++) { array2[l] = DataPointCollection.ConvertEnumerationItem(array[l].Current, null); if (array2[l] is DBNull || array2[l] == null) { flag4 = true; array2[l] = 0.0; } } if (flag4) { if (obj != null) { dataPoint.SetValueXY(obj, array2); } else { dataPoint.SetValueXY(0, array2); } this.DataPointInit(ref dataPoint); dataPoint.Empty = true; this.array.Add(dataPoint); } else { if (obj != null) { dataPoint.SetValueXY(obj, array2); } else { dataPoint.SetValueXY(0, array2); } this.DataPointInit(ref dataPoint); this.array.Add(dataPoint); } } }while (flag || flag2); this.series.TraceWrite("ChartDataBinding", SR.TraceMessageSeriesPopulatedWithDataPoints(this.series.Name, this.array.Count.ToString(CultureInfo.CurrentCulture))); return; } throw new ArgumentNullException("yValues", SR.ExceptionDataPointBindingYValueNotSpecified); }
public void DataBindCrossTab(IEnumerable dataSource, string seriesGroupByField, string xField, string yFields, string otherFields, bool sort, PointsSortOrder sortingOrder) { ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); string[] array = null; if (yFields != null) { array = yFields.Replace(",,", "\n").Split(','); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ","); } } string[] array2 = null; string[] array3 = null; string[] array4 = null; DataPointCollection.ParsePointFieldsParameter(otherFields, ref array2, ref array3, ref array4); if (dataSource == null) { throw new ArgumentNullException("dataSource", SR.ExceptionDataPointInsertionNoDataSource); } if (dataSource is string) { throw new ArgumentException(SR.ExceptionDataBindSeriesToString, "dataSource"); } if (array != null && array.Length != 0) { if (seriesGroupByField != null && seriesGroupByField.Length != 0) { IEnumerator dataSourceEnumerator = DataPointCollection.GetDataSourceEnumerator(dataSource); if (dataSourceEnumerator.GetType() != typeof(DbEnumerator)) { try { dataSourceEnumerator.Reset(); } catch { } } bool flag = true; object[] array5 = new object[array.Length]; object obj2 = null; bool flag2 = true; do { if (flag) { flag = dataSourceEnumerator.MoveNext(); } if (flag) { object obj3 = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, seriesGroupByField); Series series = null; int num = arrayList2.IndexOf(obj3); if (num >= 0) { series = (Series)arrayList[num]; } else { series = new Series(); series.YValuesPerPoint = array.GetLength(0); if (arrayList.Count > 0) { series.XValueType = ((Series)arrayList[0]).XValueType; series.autoXValueType = ((Series)arrayList[0]).autoXValueType; series.YValueType = ((Series)arrayList[0]).YValueType; series.autoYValueType = ((Series)arrayList[0]).autoYValueType; } if (obj3 is string) { series.Name = (string)obj3; } else { series.Name = seriesGroupByField + " - " + obj3.ToString(); } arrayList2.Add(obj3); arrayList.Add(series); } if (flag2) { flag2 = false; DataPointCollection.AutoDetectValuesType(series, dataSourceEnumerator, xField, dataSourceEnumerator, array[0]); } DataPoint dataPoint = new DataPoint(series); bool flag3 = false; if (xField.Length > 0) { obj2 = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, xField); if (DataPointCollection.IsEmptyValue(obj2)) { flag3 = true; obj2 = 0.0; } } if (array.Length == 0) { array5[0] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, null); if (DataPointCollection.IsEmptyValue(array5[0])) { flag3 = true; array5[0] = 0.0; } } else { for (int j = 0; j < array.Length; j++) { array5[j] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, array[j]); if (DataPointCollection.IsEmptyValue(array5[j])) { flag3 = true; array5[j] = 0.0; } } } if (array2 != null && array2.Length > 0) { for (int k = 0; k < array3.Length; k++) { object obj4 = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, array3[k]); if (!DataPointCollection.IsEmptyValue(obj4)) { dataPoint.SetPointAttribute(obj4, array2[k], array4[k]); } } } if (flag3) { if (obj2 != null) { dataPoint.SetValueXY(obj2, array5); } else { dataPoint.SetValueXY(0, array5); } DataPointCollection.DataPointInit(series, ref dataPoint); dataPoint.Empty = true; series.Points.Add(dataPoint); } else { if (obj2 != null) { dataPoint.SetValueXY(obj2, array5); } else { dataPoint.SetValueXY(0, array5); } DataPointCollection.DataPointInit(series, ref dataPoint); series.Points.Add(dataPoint); } } }while (flag); if (sort) { ArrayList arrayList3 = (ArrayList)arrayList2.Clone(); arrayList2.Sort(); if (sortingOrder == PointsSortOrder.Descending) { arrayList2.Reverse(); } ArrayList arrayList4 = new ArrayList(); foreach (object item in arrayList2) { arrayList4.Add(arrayList[arrayList3.IndexOf(item)]); } arrayList = arrayList4; } foreach (Series item2 in arrayList) { base.common.Chart.Series.Add(item2); } return; } throw new ArgumentException(SR.ExceptionDataBindSeriesGroupByParameterIsEmpty, "seriesGroupByField"); } throw new ArgumentOutOfRangeException("yFields", SR.ExceptionChartDataPointsInsertionFailedYValuesEmpty); }
public void DataBind(IEnumerable dataSource, string xField, string yFields, string otherFields) { this.series.TraceWrite("ChartDataBinding", SR.TraceMessagePopulatingSeriesDataPoints(this.series.Name)); string[] array = null; if (yFields != null) { array = yFields.Replace(",,", "\n").Split(','); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ","); } } string[] array2 = null; string[] array3 = null; string[] array4 = null; DataPointCollection.ParsePointFieldsParameter(otherFields, ref array2, ref array3, ref array4); if (dataSource == null) { throw new ArgumentNullException("dataSource", SR.ExceptionDataPointInsertionNoDataSource); } if (dataSource is string) { throw new ArgumentException(SR.ExceptionDataBindSeriesToString, "dataSource"); } if (array != null && array.GetLength(0) <= this.series.YValuesPerPoint) { this.array.Clear(); IEnumerator dataSourceEnumerator = DataPointCollection.GetDataSourceEnumerator(dataSource); if (dataSourceEnumerator.GetType() != typeof(DbEnumerator)) { dataSourceEnumerator.Reset(); } bool flag = true; object[] array5 = new object[array.Length]; object obj = null; bool flag2 = true; do { if (flag) { flag = dataSourceEnumerator.MoveNext(); } if (flag2) { flag2 = false; DataPointCollection.AutoDetectValuesType(this.series, dataSourceEnumerator, xField, dataSourceEnumerator, array[0]); } if (flag) { DataPoint dataPoint = new DataPoint(this.series); bool flag3 = false; if (xField.Length > 0) { obj = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, xField); if (DataPointCollection.IsEmptyValue(obj)) { flag3 = true; obj = 0.0; } } if (array.Length == 0) { array5[0] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, null); if (DataPointCollection.IsEmptyValue(array5[0])) { flag3 = true; array5[0] = 0.0; } } else { for (int j = 0; j < array.Length; j++) { array5[j] = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, array[j]); if (DataPointCollection.IsEmptyValue(array5[j])) { flag3 = true; array5[j] = 0.0; } } } if (array2 != null && array2.Length > 0) { for (int k = 0; k < array3.Length; k++) { object obj2 = DataPointCollection.ConvertEnumerationItem(dataSourceEnumerator.Current, array3[k]); if (!DataPointCollection.IsEmptyValue(obj2)) { dataPoint.SetPointAttribute(obj2, array2[k], array4[k]); } } } if (flag3) { if (obj != null) { dataPoint.SetValueXY(obj, array5); } else { dataPoint.SetValueXY(0, array5); } this.DataPointInit(ref dataPoint); dataPoint.Empty = true; this.array.Add(dataPoint); } else { if (obj != null) { dataPoint.SetValueXY(obj, array5); } else { dataPoint.SetValueXY(0, array5); } this.DataPointInit(ref dataPoint); this.array.Add(dataPoint); } } }while (flag); this.series.TraceWrite("ChartDataBinding", SR.TraceMessageSeriesPopulatedWithDataPoints(this.series.Name, this.array.Count.ToString(CultureInfo.CurrentCulture))); return; } throw new ArgumentOutOfRangeException("yFields", SR.ExceptionDataPointYValuesCountMismatch(this.series.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))); }
public void DataBind(IEnumerable dataSource, ArrayList seriesList) { if (dataSource != null && base.common != null) { if (seriesList == null) { seriesList = new ArrayList(); foreach (Series item in base.common.Chart.Series) { if (base.common.Chart.IsDesignMode()) { if (item.ValueMembersY.Length > 0) { seriesList.Add(item); } } else { seriesList.Add(item); } } } foreach (Series series4 in seriesList) { if (series4.ValueMemberX.Length > 0 || series4.ValueMembersY.Length > 0) { series4.Points.Clear(); } } IEnumerator enumerator3 = dataSource.GetEnumerator(); if (enumerator3.GetType() != typeof(DbEnumerator)) { try { enumerator3.Reset(); } catch { } } bool flag = true; bool flag2 = true; do { flag = enumerator3.MoveNext(); foreach (Series series5 in seriesList) { if (series5.ValueMemberX.Length <= 0 && series5.ValueMembersY.Length <= 0) { continue; } string[] array = null; if (series5.ValueMembersY.Length > 0) { array = series5.ValueMembersY.Replace(",,", "\n").Split(','); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ",").Trim(); } } if (dataSource is string) { throw new ArgumentException(SR.ExceptionDataBindYValuesToString, "dataSource"); } if (array != null && array.GetLength(0) <= series5.YValuesPerPoint) { if (flag) { if (flag2) { flag2 = false; string text = array[0]; int num = 1; while (text.Length == 0 && num < array.Length) { text = array[num++]; } DataPointCollection.AutoDetectValuesType(series5, enumerator3, series5.ValueMemberX.Trim(), enumerator3, text); } DataPoint dataPoint = new DataPoint(series5); bool flag3 = false; bool flag4 = false; object[] array2 = new object[array.Length]; object obj2 = null; if (series5.ValueMemberX.Length > 0) { obj2 = DataPointCollection.ConvertEnumerationItem(enumerator3.Current, series5.ValueMemberX.Trim()); if (obj2 is DBNull || obj2 == null) { flag4 = true; flag3 = true; obj2 = 0.0; } } if (array.Length == 0) { array2[0] = DataPointCollection.ConvertEnumerationItem(enumerator3.Current, null); if (array2[0] is DBNull || array2[0] == null) { flag3 = true; array2[0] = 0.0; } } else { for (int j = 0; j < array.Length; j++) { if (array[j].Length > 0) { array2[j] = DataPointCollection.ConvertEnumerationItem(enumerator3.Current, array[j]); if (array2[j] is DBNull || array2[j] == null) { flag3 = true; array2[j] = 0.0; } } else { array2[j] = (((Series)seriesList[0]).IsYValueDateTime() ? DateTime.Now.Date.ToOADate() : 0.0); } } } if (!flag4) { if (flag3) { if (obj2 != null) { dataPoint.SetValueXY(obj2, array2); } else { dataPoint.SetValueXY(0, array2); } series5.Points.DataPointInit(ref dataPoint); dataPoint.Empty = true; series5.Points.Add(dataPoint); } else { if (obj2 != null) { dataPoint.SetValueXY(obj2, array2); } else { dataPoint.SetValueXY(0, array2); } series5.Points.DataPointInit(ref dataPoint); series5.Points.Add(dataPoint); } } if (base.common.Chart.IsDesignMode()) { ((DataPointAttributes)series5)["TempDesignData"] = "true"; } } continue; } throw new ArgumentOutOfRangeException("yValue", SR.ExceptionDataPointYValuesCountMismatch(series5.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))); } }while (flag); } }