/// <summary> /// Creates the Segments of RadarSeries. /// </summary> public override void CreateSegments() { Segments.Clear(); Segment = null; if (DrawType == ChartSeriesDrawType.Area) { double Origin = this.ActualXAxis != null ? this.ActualXAxis.Origin : 0; List <double> xValues = GetXValues().ToList(); List <double> tempYValues = new List <double>(); tempYValues = (from val in YValues select val).ToList(); if (xValues != null) { if (!IsClosed) { xValues.Insert((int)DataCount - 1, xValues[(int)DataCount - 1]); xValues.Insert(0, xValues[0]); tempYValues.Insert(0, Origin); tempYValues.Insert(tempYValues.Count, Origin); } else { xValues.Insert(0, xValues[0]); tempYValues.Insert(0, YValues[0]); xValues.Insert(0, xValues[(int)DataCount]); tempYValues.Insert(0, YValues[(int)DataCount - 1]); } if (Segment == null) { Segment = new AreaSegment(xValues, tempYValues, this, null); Segment.SetData(xValues, tempYValues); Segments.Add(Segment); } else { Segment.SetData(xValues, tempYValues); } if (AdornmentsInfo != null) { AddAreaAdornments(YValues); } } } else if (DrawType == ChartSeriesDrawType.Line) { int index = -1; int i = 0; double xIndexValues = 0d; List <double> xValues = ActualXValues as List <double>; if (IsIndexed || xValues == null) { xValues = xValues != null ? (from val in (xValues)select(xIndexValues++)).ToList() : (from val in (ActualXValues as List <string>)select(xIndexValues++)).ToList(); } if (xValues != null) { for (i = 0; i < this.DataCount; i++) { index = i + 1; if (index < this.DataCount) { if (i < Segments.Count) { (Segments[i]).SetData(xValues[i], YValues[i], xValues[index], YValues[index]); } else { LineSegment line = new LineSegment(xValues[i], YValues[i], xValues[index], YValues[index], this, this); Segments.Add(line); } } if (AdornmentsInfo != null) { if (i < Adornments.Count) { Adornments[i].SetData(xValues[i], YValues[i], xValues[i], YValues[i]); } else { Adornments.Add(this.CreateAdornment(this, xValues[i], YValues[i], xValues[i], YValues[i])); } Adornments[i].Item = ActualData[i]; } } if (IsClosed) { LineSegment line = new LineSegment(xValues[0], YValues[0], xValues[i - 1], YValues[i - 1], this, this); Segments.Add(line); } if (ShowEmptyPoints) { UpdateEmptyPointSegments(xValues, false); } } } }
/// <summary> /// Creates the segments of AreaSeries. /// </summary> public override void CreateSegments() { List <double> yValues = new List <double>(); bool isGrouped = (ActualXAxis is CategoryAxis && !(ActualXAxis as CategoryAxis).IsIndexed); List <double> xValues = null; if (isGrouped) { xValues = GroupedXValuesIndexes; } else { xValues = GetXValues(); } yValues = YValues.ToList(); if (AdornmentsInfo != null) { ClearUnUsedAdornments(this.DataCount); } if (isGrouped) { if (xValues != null && xValues.Count > 1) { Segments.Clear(); Adornments.Clear(); if (Segment == null || Segments.Count == 0) { Segment = new AreaSegment(xValues, GroupedSeriesYValues[0] as List <double>, this, ActualData); Segment.SetData(xValues, GroupedSeriesYValues[0] as List <double>); Segments.Add(Segment); } } if (AdornmentsInfo != null) { AddAreaAdornments(GroupedSeriesYValues[0]); } } else { if (xValues != null && xValues.Count > 1) { if (Segment == null || Segments.Count == 0) { Segment = new AreaSegment(xValues, yValues, this, ActualData); Segment.SetData(xValues, yValues); Segments.Add(Segment); } else { Segment.Item = ActualData; Segment.SetData(xValues, yValues); } } if (AdornmentsInfo != null) { AddAreaAdornments(YValues); } } }