Ejemplo n.º 1
0
        public ChartScaleInfo ComputeScaleSelf()
        {
            int startIndex = this.visibleStartIndex;
            int endIndex   = this.visibleEndIndex;

            if (!dirty && scaleSelf != null && !this.liveScrolling)
            {
                return(scaleSelf);
            }

            if (scaleSelf != null && this.liveScrolling)
            {
                // try and do incremental update of the scale for added efficiency!
                startIndex = this.smoothScrollScaleIndex;
            }
            else
            {
                scaleSelf = new ChartScaleInfo();
                this.smoothScrollScaleIndex = 0;
            }
            if (series == null)
            {
                return(scaleSelf);
            }

            int len = series.Values.Count;

            if (startIndex < 0)
            {
                startIndex = 0;
            }
            if (endIndex < 0 || endIndex > len)
            {
                endIndex = len;
            }

            if (this.ActualHeight == 0)
            {
                return(scaleSelf);
            }

            for (int i = startIndex; i < endIndex; i++)
            {
                DataValue d = series.Values[i];
                double    x = d.X;
                double    y = d.Y;
                scaleSelf.Add(x, y);
            }
            this.smoothScrollScaleIndex = endIndex;

            return(scaleSelf);
        }
Ejemplo n.º 2
0
        public ChartScaleInfo ComputeScaleSelf(int index)
        {
            if (scaleSelf == null)
            {
                scaleSelf = new ChartScaleInfo();
            }

            if (!dirty)
            {
                return(scaleSelf);
            }

            if (index > 0)
            {
                // this is an incremental update then so we pick up where we left off.
            }
            else
            {
                // start over
                scaleSelf = new ChartScaleInfo();
            }

            if (series == null)
            {
                return(scaleSelf);
            }

            int len = series.Values.Count;

            if (index < 0)
            {
                index = 0;
            }

            for (int i = index; i < len; i++)
            {
                DataValue d = series.Values[i];
                double    x = d.X;
                double    y = d.Y;
                scaleSelf.Add(x, y);
            }

            scaleIndex = len;

            return(scaleSelf);
        }