Example #1
0
        /// <summary>
        /// Creates the segments of FastLineSeries.
        /// </summary>
        public override void CreateSegments()
        {
            if (GroupedSeriesYValues != null && GroupedSeriesYValues[0].Contains(double.NaN))
            {
                List <List <double> > yValList;
                List <List <double> > xValList;
                this.CreateEmptyPointSegments(GroupedSeriesYValues[0], out yValList, out xValList);
            }
            else if (YValues.Contains(double.NaN))
            {
                List <List <double> > yValList;
                List <List <double> > xValList;
                this.CreateEmptyPointSegments(YValues, out yValList, out xValList);
            }
            else
            {
                bool isGrouping = this.ActualXAxis is CategoryAxis ? (this.ActualXAxis as CategoryAxis).IsIndexed : true;
                if (!isGrouping)
                {
                    xValues = GroupedXValuesIndexes;
                }
                else
                {
                    xValues = (ActualXValues is IList <double> && !IsIndexed) ? ActualXValues as IList <double> : GetXValues();
                }
                if (!isGrouping)
                {
                    Segments.Clear();
                    Adornments.Clear();

                    if (Segment == null || Segments.Count == 0)
                    {
                        FastLineSegment segment = new FastLineSegment(xValues, GroupedSeriesYValues[0], this);
                        Segment = segment;
                        Segments.Add(segment);
                    }
                }
                else
                {
                    ClearUnUsedAdornments(this.DataCount);

                    if (Segment == null || Segments.Count == 0)
                    {
                        FastLineSegment segment = new FastLineSegment(xValues, YValues, this);
                        Segment = segment;
                        Segments.Add(segment);
                    }
                    else if (ActualXValues != null)
                    {
                        Segment.SetData(xValues, YValues);
                        (Segment as FastLineSegment).SetRange();
                        Segment.Item = ActualData;
                    }
                }

                isAdornmentPending = true;
            }
        }
Example #2
0
        /// <summary>
        /// Creates the segments of LineSeries3D.
        /// </summary>
        public override void CreateSegments()
        {
            List <double> xValues    = null;
            bool          isGrouping = this.ActualXAxis is CategoryAxis3D && !(this.ActualXAxis as CategoryAxis3D).IsIndexed;

            if (isGrouping)
            {
                xValues = this.GroupedXValuesIndexes;
            }
            else
            {
                xValues = this.GetXValues();
            }

            if (xValues == null)
            {
                return;
            }

            var depthInfo = GetSegmentDepth(this.Area.Depth);

            if (isGrouping)
            {
                Segments.Clear();
                Adornments.Clear();
                if (this.GroupedSeriesYValues != null && GroupedSeriesYValues[0].Contains(double.NaN))
                {
                    List <List <double> > yValList;
                    List <List <double> > xValList;
                    this.CreateEmptyPointSegments(this.GroupedSeriesYValues[0], out yValList, out xValList);
                }
                else if (xValues != null)
                {
                    if (this.Segment == null || Segments.Count == 0)
                    {
                        this.Segment = new LineSegment3D(xValues, GroupedSeriesYValues[0], depthInfo.Start, depthInfo.End, this);
                        this.Segment.SetData(xValues, this.GroupedSeriesYValues[0], depthInfo.Start, depthInfo.End);
                        Segments.Add(this.Segment);
                    }
                }

                for (var i = 0; i < xValues.Count; i++)
                {
                    if (this.AdornmentsInfo != null)
                    {
                        this.AddAdornments(xValues[i], this.GroupedSeriesYValues[0][i], i, depthInfo.Start);
                    }
                }
            }
            else
            {
                this.ClearUnUsedSegments(this.DataCount);
                this.ClearUnUsedAdornments(this.DataCount);
                if (YValues.Contains(double.NaN))
                {
                    List <List <double> > yValList;
                    List <List <double> > xValList;
                    this.CreateEmptyPointSegments(this.YValues, out yValList, out xValList);
                }
                else if (xValues != null)
                {
                    if (this.Segment == null || Segments.Count == 0)
                    {
                        this.Segment = new LineSegment3D(xValues, YValues, depthInfo.Start, depthInfo.End, this);
                        this.Segment.SetData(xValues, this.YValues, depthInfo.Start, depthInfo.End);
                        Segments.Add(this.Segment);
                    }
                    else
                    {
                        this.Segment.SetData(xValues, this.YValues, depthInfo.Start, depthInfo.End);
                    }
                }

                for (var i = 0; i < this.DataCount; i++)
                {
                    if (this.AdornmentsInfo != null)
                    {
                        this.AddAdornments(xValues[i], this.YValues[i], i, depthInfo.Start);
                    }
                }
            }
        }