Example #1
0
        private void MapAndAddTrendLine()
        {
            if (dateLineGraph.DateTrendLine == null || dateLineGraph.DateTrendLine.DatePoints == null ||
                dateLineGraph.DateTrendLine.DatePoints.Count <= 0)
            {
                return;
            }

            DateLine trendLine = dateLineGraph.DateTrendLine;

            trendLine.Points = new LinePointCollection();

            for (int j = 0; j < trendLine.DatePoints.Count; j++)
            {
                DateLinePoint point = trendLine.DatePoints[j];
                DateTime      date  = point.Date;
                TimeSpan      ts    = date - startDate;

                if (dateMode == DateMode.Day || dateMode == DateMode.HalfDay)
                {
                    point.XValue = ts.Hours;
                }
                else
                {
                    point.XValue = ts.Days;
                }

                trendLine.Points.Add(point);
            }

            dateLineGraph.TrendLine = trendLine;
        }
Example #2
0
        private void MapAndAddLines()
        {
            dateLineGraph.Lines = new LineCollection();

            // Map dates to X Values
            for (int i = 0; i < dateLineGraph.DateLines.Count; i++)
            {
                DateLine dateLine = dateLineGraph.DateLines[i];
                dateLine.Points = new LinePointCollection();
                for (int j = 0; j < dateLine.DatePoints.Count; j++)
                {
                    DateLinePoint point = dateLine.DatePoints[j];
                    DateTime      date  = point.Date;
                    TimeSpan      ts    = date - startDate;

                    if (dateMode == DateMode.Day || dateMode == DateMode.HalfDay)
                    {
                        point.XValue = ts.Hours;
                    }
                    else
                    {
                        point.XValue = ts.Days;
                    }

                    dateLine.Points.Add(point);
                }

                dateLineGraph.Lines.Add(dateLine);
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateLineGraph"/> class.
 /// </summary>
 public DateLineGraph()
     : base()
 {
     dateLineCollection      = new DateLineCollection();
     dateXAxisTextCollection = new DateXAxisTextCollection();
     datePhaseLines          = new DateXAxisTextCollection();
     trendLine           = new DateLine();
     trendLine.Width     = 2.0F;
     MarginForTextOnAxis = 15;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DateLineGraph"/> class.
 /// </summary>
 /// <param name="startDate">The start date.</param>
 /// <param name="endDate">The end date.</param>
 /// <param name="dateMode">The date mode.</param>
 public DateLineGraph(DateTime startDate, DateTime endDate, DateMode dateMode)
     : base()
 {
     this.startDate          = startDate;
     this.endDate            = endDate;
     this.dateMode           = dateMode;
     dateLineCollection      = new DateLineCollection();
     dateXAxisTextCollection = new DateXAxisTextCollection();
     datePhaseLines          = new DateXAxisTextCollection();
     trendLine           = new DateLine();
     trendLine.Width     = 2.0F;
     MarginForTextOnAxis = 15;
 }
Example #5
0
        /// <summary>
        /// Gets the minimum date.
        /// </summary>
        /// <returns></returns>
        private DateTime GetMinimumDate()
        {
            DateTime retVal = DateTime.MaxValue;

            if (dateLineGraph.DateLines == null)
            {
                return(DateTime.MinValue);
            }

            for (int i = 0; i < dateLineGraph.DateLines.Count; i++)
            {
                DateLine dateLine = dateLineGraph.DateLines[i];

                for (int j = 0; j < dateLine.DatePoints.Count; j++)
                {
                    if (DateTime.Compare(dateLine.DatePoints[j].Date, retVal) < 0)
                    {
                        retVal = dateLine.DatePoints[j].Date;
                    }
                }
            }

            if (dateLineGraph.DateTrendLine != null && dateLineGraph.DateTrendLine.DatePoints != null &&
                dateLineGraph.DateTrendLine.DatePoints.Count > 0)
            {
                for (int j = 0; j < dateLineGraph.DateTrendLine.DatePoints.Count; j++)
                {
                    if (DateTime.Compare(dateLineGraph.DateTrendLine.DatePoints[j].Date, retVal) < 0)
                    {
                        retVal = dateLineGraph.DateTrendLine.DatePoints[j].Date;
                    }
                }
            }

            if (DateTime.Compare(dateLineGraph.StartDate, retVal) < 0)
            {
                return(dateLineGraph.StartDate);
            }
            else
            {
                return(retVal);
            }
        }
Example #6
0
 /// <summary>
 /// Determines whether [contains] [the specified value].
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>
 ///     <c>true</c> if [contains] [the specified value]; otherwise, <c>false</c>.
 /// </returns>
 public bool Contains(DateLine value)
 {
     return(List.Contains(value));
 }
Example #7
0
 /// <summary>
 /// Adds the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public int Add(DateLine value)
 {
     return(List.Add(value));
 }
Example #8
0
 /// <summary>
 /// Removes the specified value.
 /// </summary>
 /// <param name="value">The value.</param>
 public void Remove(DateLine value)
 {
     List.Remove(value);
 }
Example #9
0
 /// <summary>
 /// Inserts the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="value">The value.</param>
 public void Insert(int index, DateLine value)
 {
     List.Insert(index, value);
 }
Example #10
0
 /// <summary>
 /// Indexes the of.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public int IndexOf(DateLine value)
 {
     return(List.IndexOf(value));
 }