Beispiel #1
0
        internal void GenerateData(NXYScatterSeries xyScatterSeries, double value, int nCount, NRange1DD range)
        {
            xyScatterSeries.ClearDataPoints();
            DateTime dt = new DateTime(2009, 1, 5);

            for (int nIndex = 0; nIndex < nCount; nIndex++)
            {
                bool upward = false;

                if (range.Begin > value)
                {
                    upward = true;
                }
                else if (range.End < value)
                {
                    upward = false;
                }
                else
                {
                    upward = Random.NextDouble() > 0.5;
                }

                xyScatterSeries.Values.Add(value);

                if (upward)
                {
                    value += (2 + (Random.NextDouble() * 20));
                }
                else
                {
                    value -= (2 + (Random.NextDouble() * 20));
                }

                while (true)
                {
                    dt = dt.AddDays(1);

                    if (dt.DayOfWeek != DayOfWeek.Saturday && dt.DayOfWeek != DayOfWeek.Sunday)
                    {
                        xyScatterSeries.XValues.Add(dt.ToOADate());
                        break;
                    }
                }
            }
        }
        public static void GenerateData(NXYScatterSeries xyScatterSeries, double value, int nCount, NRange1DD range)
        {
            xyScatterSeries.ClearDataPoints();
            DateTime dt = new DateTime(2009, 1, 5);

            for (int nIndex = 0; nIndex < nCount; nIndex++)
            {
                bool upward = false;

                if (range.Begin > value)
                {
                    upward = true;
                }
                else if (range.End < value)
                {
                    upward = false;
                }
                else
                {
                    upward = Random.NextDouble() > 0.5;
                }

                xyScatterSeries.Values.Add(value);

                if (upward)
                {
                    value += (2 + (Random.NextDouble() * 20));
                }
                else
                {
                    value -= (2 + (Random.NextDouble() * 20));
                }

                xyScatterSeries.XValues.Add(nIndex);
            }
        }