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; }
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); } }
/// <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; }
/// <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; }
/// <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); } }
/// <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)); }
/// <summary> /// Adds the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public int Add(DateLine value) { return(List.Add(value)); }
/// <summary> /// Removes the specified value. /// </summary> /// <param name="value">The value.</param> public void Remove(DateLine value) { List.Remove(value); }
/// <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); }
/// <summary> /// Indexes the of. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public int IndexOf(DateLine value) { return(List.IndexOf(value)); }