public void GetFirstGridDivision(ref EGridSize gridSize, ref double min, ref double max, ref DateTime firstDateTime) { if ((max - min) / (double)Session <= 10.0) { gridSize = Axis.CalculateSize(max - min); max = min + CalculateRealQuantityOfTicks_Right(min, max); } else { max = min + this.CalculateRealQuantityOfTicks_Right(min, max); gridSize = Axis.CalculateSize(max - min); } this.fGap = this.CalculateGap((long)min, (long)gridSize); if ((long)min / 864000000000L - (long)((long)min + this.fGap + gridSize) / 864000000000L < 0L && gridSize < (EGridSize)576000000000) { min += (double)this.CalculateJumpGap((long)min, (long)gridSize); this.fGap = this.CalculateGap((long)min, (long)gridSize); } if (gridSize < (EGridSize)576000000000) { firstDateTime = new DateTime((long)min + this.fGap); } else { this.fGap = -this.firstSessionTick; } }
public void GetFirstGridDivision(ref EGridSize gridSize, ref double min, ref double max, ref DateTime firstDateTime) { if ((max - min) / (double)this.session <= 10.0) { gridSize = Axis.CalculateSize(max - min); max = min + this.CalculateRealQuantityOfTicks_Right(min, max); } else { max = min + this.CalculateRealQuantityOfTicks_Right(min, max); gridSize = Axis.CalculateSize(max - min); } this.gWjCgJN3TA = this.af0CimWcds((long)min, (long)gridSize); if ((long)min / 864000000000L - (long)((long)min + this.gWjCgJN3TA + gridSize) / 864000000000L < 0L && gridSize < (EGridSize)576000000000) { min += (double)this.BOvCDY6BLq((long)min, (long)gridSize); this.gWjCgJN3TA = this.af0CimWcds((long)min, (long)gridSize); } if (gridSize < (EGridSize)576000000000) { firstDateTime = new DateTime((long)min + this.gWjCgJN3TA); } else { this.gWjCgJN3TA = -this.firstSessionTick; } }
public static long GetNextMajor(long prevMajor, EGridSize gridSize) { long num; switch (gridSize) { case EGridSize.year5: num = new DateTime(prevMajor).AddYears(5).Ticks; break; case EGridSize.year10: num = new DateTime(prevMajor).AddYears(10).Ticks; break; case EGridSize.year20: num = new DateTime(prevMajor).AddYears(20).Ticks; break; case EGridSize.year2: num = new DateTime(prevMajor).AddYears(2).Ticks; break; case EGridSize.year3: num = new DateTime(prevMajor).AddYears(3).Ticks; break; case EGridSize.year4: num = new DateTime(prevMajor).AddYears(4).Ticks; break; case EGridSize.month4: num = new DateTime(prevMajor).AddMonths(4).Ticks; break; case EGridSize.month6: num = new DateTime(prevMajor).AddMonths(6).Ticks; break; case EGridSize.year1: num = new DateTime(prevMajor).AddYears(1).Ticks; break; case EGridSize.month1: num = new DateTime(prevMajor).AddMonths(1).Ticks; break; case EGridSize.month2: num = new DateTime(prevMajor).AddMonths(2).Ticks; break; case EGridSize.month3: num = new DateTime(prevMajor).AddMonths(3).Ticks; break; default: num = (long)(prevMajor + gridSize); break; } return(num); }
public static long GetNextMajor(long prevMajor, EGridSize gridSize) { string name = typeof(EGridSize).GetEnumName(gridSize); var m = new Regex(@"^([a-z]+)(\d*)$").Match(name); var unit = m.Groups[1].ToString(); var num = int.Parse(m.Groups[2].ToString()); switch (unit) { case "year": return(new DateTime(prevMajor).AddYears(num).Ticks); case "month": return(new DateTime(prevMajor).AddMonths(num).Ticks); default: return(prevMajor + (long)gridSize); } }
public void GetFirstGridDivision(ref EGridSize gridSize, ref double min, ref double max, ref DateTime firstDateTime) { if ((max - min) / (double)this.session <= 10.0) { gridSize = Axis.CalculateSize(max - min); max = min + this.CalculateRealQuantityOfTicks_Right(min, max); } else { max = min + this.CalculateRealQuantityOfTicks_Right(min, max); gridSize = Axis.CalculateSize(max - min); } this.gWjCgJN3TA = this.af0CimWcds((long)min, (long)gridSize); if ((long)min / 864000000000L - (long)((long)min + this.gWjCgJN3TA + gridSize) / 864000000000L < 0L && gridSize < (EGridSize)576000000000) { min += (double)this.BOvCDY6BLq((long)min, (long)gridSize); this.gWjCgJN3TA = this.af0CimWcds((long)min, (long)gridSize); } if (gridSize < (EGridSize)576000000000) firstDateTime = new DateTime((long)min + this.gWjCgJN3TA); else this.gWjCgJN3TA = -this.firstSessionTick; }
public void GetFirstGridDivision(ref EGridSize gridSize, ref double min, ref double max, ref DateTime firstDateTime) { if ((max - min) / Session <= 10.0) { gridSize = Axis.CalculateSize(max - min); max = min + CalculateRealQuantityOfTicks_Right(min, max); } else { max = min + this.CalculateRealQuantityOfTicks_Right(min, max); gridSize = Axis.CalculateSize(max - min); } this.fGap = this.CalculateGap((long)min, (long)gridSize); if ((long)min / 864000000000L - (long)((long)min + this.fGap + gridSize) / 864000000000L < 0L && gridSize < (EGridSize)576000000000) { min += this.CalculateJumpGap((long)min, (long)gridSize); this.fGap = this.CalculateGap((long)min, (long)gridSize); } if (gridSize < (EGridSize)576000000000) firstDateTime = new DateTime((long)min + this.fGap); else this.fGap = -this.firstSessionTick; }
public void PaintWithDates(DateTime minDate, DateTime maxDate) { SolidBrush solidBrush1 = new SolidBrush(this.titleColor); SolidBrush solidBrush2 = new SolidBrush(this.labelColor); Pen pen1 = new Pen(this.titleColor); Pen pen2 = new Pen(this.gridColor); Pen pen3 = new Pen(this.minorGridColor); Pen pen4 = new Pen(this.minorTicksColor); Pen pen5 = new Pen(this.majorTicksColor); pen2.Width = this.gridWidth; pen2.DashStyle = this.gridDashStyle; pen3.Width = this.minorGridWidth; pen3.DashStyle = this.minorGridDashStyle; long ticks1 = minDate.Ticks; long ticks2 = maxDate.Ticks; DateTime dateTime1 = new DateTime(Math.Max(0, ticks1)); EGridSize gridSize = AxisBottom.CalculateSize(ticks2 - ticks1); long num1 = 0L; long num2 = this.c9T0e1qB80(dateTime1, gridSize); int num3 = 0; long num4 = num2; long num5 = 0L; int num6 = 0; long num7 = ticks2; int num8 = -1; while (num4 < num7) { if (num6 != 0) { num4 = AxisBottom.GetNextMajor(num5, gridSize); } long num9 = num4; int index = this.chart.MainSeries.GetIndex(new DateTime(num4 - 1L), EIndexOption.Next); if (num8 == index) { num5 = num4; } else { num8 = index; if (index != -1) { DateTime dateTime2 = this.chart.MainSeries.GetDateTime(index); TimeSpan timeOfDay = dateTime2.TimeOfDay; long ticks3 = dateTime2.Ticks; if (ticks3 < num7) { if (this.gridEnabled) { this.chart.IXrxgFKyT(pen2, ticks3); } if (this.majorTicksEnabled) { this.chart.NXKu7WiuX(pen1, ticks3, -5); } if (this.labelEnabled) { string format; if (ticks3 % 864000000000L == this.chart.SessionStart.Ticks || ticks3 % 864000000000 == this.chart.SessionEnd.Ticks) { format = num5 != 0 ? (new DateTime(num5).Year == new DateTime(ticks3).Year ? "years" : "month") : "days"; } else if (num5 == 0L) { format = "days"; } else { DateTime dateTime3 = new DateTime(num5); DateTime dateTime4 = new DateTime(ticks3); format = dateTime3.Year == dateTime4.Year ? (dateTime3.Month == dateTime4.Month ? (dateTime3.Day == dateTime4.Day ? (dateTime3.Minute != dateTime4.Minute || dateTime3.Hour != dateTime4.Hour ? "hour" : "minute") : "second") : "aaaa") : "bbbb"; } string str = new DateTime(ticks3).ToString(format); SizeF sizeF = this.chart.Graphics.MeasureString(str, this.labelFont); int num10 = (int)sizeF.Width; int num11 = (int)sizeF.Height; if (this.labelAlignment == EAxisLabelAlignment.Right) { this.chart.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)this.chart.ClientX(new DateTime(ticks3)), (float)(int)(this.y + (double)this.labelOffset)); } if (this.labelAlignment == EAxisLabelAlignment.Left) { this.chart.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)(this.chart.ClientX(new DateTime(ticks3)) - num10), (float)(int)(this.y + (double)this.labelOffset)); } if (this.labelAlignment == EAxisLabelAlignment.Centre) { int num12 = this.chart.ClientX(new DateTime(ticks3)) - num10 / 2; int num13 = (int)(this.y + (double)this.labelOffset); if (num6 == 0 || num12 - num3 >= 1) { this.chart.Graphics.DrawString(str, this.labelFont, solidBrush2, (float)num12, (float)num13); num3 = num12 + num10; } } } } num1 = ticks3; num4 = num9; num5 = num4; ++num6; } } } if (this.chart.SessionGridEnabled && (EGridSize)(this.chart.SessionEnd - this.chart.SessionStart).Ticks >= gridSize) { int num9 = 0; long num10; for (long index = ticks1 / 864000000000L * 864000000000L + this.chart.SessionStart.Ticks; (num10 = index + (long)num9 * 864000000000L) < ticks2; ++num9) { this.chart.pw9AQjMR6(new Pen(this.chart.SessionGridColor), num10); } } if (!this.titleEnabled) { return; } int num14 = (int)this.chart.Graphics.MeasureString("", this.labelFont).Height; int num15 = (int)this.chart.Graphics.MeasureString(ticks2.ToString("D"), this.labelFont).Width; double num16 = (double)this.chart.Graphics.MeasureString(this.title, this.titleFont).Height; int num17 = (int)this.chart.Graphics.MeasureString(this.title, this.titleFont).Width; if (this.titlePosition == EAxisTitlePosition.Left) { this.chart.Graphics.DrawString(this.title, this.titleFont, solidBrush1, (float)(int)this.x1, (float)(int)(this.y + (double)this.labelOffset + (double)num14 + (double)this.titleOffset)); } if (this.titlePosition == EAxisTitlePosition.Right) { this.chart.Graphics.DrawString(this.title, this.titleFont, solidBrush1, (float)((int)this.x2 - num17), (float)(int)(this.y + (double)this.labelOffset + (double)num14 + (double)this.titleOffset)); } if (this.titlePosition != EAxisTitlePosition.Centre) { return; } this.chart.Graphics.DrawString(this.title, this.titleFont, solidBrush1, (float)(int)(this.x1 + (this.x2 - this.x1 - (double)num17) / 2.0), (float)(int)(this.y + (double)this.labelOffset + (double)num14 + (double)this.titleOffset)); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return majorCount != 0 ? (gridSize >= (EGridSize)576000000000 ? (double)Axis.GetNextMajor((long)prevMajor, gridSize) : this.x4KCNJAMeJ(prevMajor, (long)gridSize)) : (double)this.B63C22nX2q((long)firstTick - this.gWjCgJN3TA); }
public static long GetNextMajor(long prevMajor, EGridSize gridSize) { string name = typeof(EGridSize).GetEnumName(gridSize); var m = new Regex(@"^([a-z]+)(\d*)$").Match(name); var unit = m.Groups[1].ToString(); var num = int.Parse(m.Groups[2].ToString()); switch (unit) { case "year": return new DateTime(prevMajor).AddYears(num).Ticks; case "month": return new DateTime(prevMajor).AddMonths(num).Ticks; default: return prevMajor + (long)gridSize; } }
//TODO: rewrite it! private long GetGridDivision(DateTime dateTime, EGridSize gridSize) { long num; switch (gridSize) { case EGridSize.year5: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + 4 - dateTime.Year % 5).Ticks; break; case EGridSize.year10: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + (9 - dateTime.Year % 10)).Ticks; break; case EGridSize.year20: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + (19 - dateTime.Year % 20)).Ticks; break; case EGridSize.year3: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + (2 - dateTime.Year % 3)).Ticks; break; case EGridSize.year4: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + (3 - dateTime.Year % 4)).Ticks; break; case EGridSize.month6: DateTime dateTime1 = new DateTime(dateTime.Year, dateTime.Month, 1); dateTime1 = dateTime1.AddMonths(1 + (12 - dateTime.Month) % 6); num = dateTime1.Ticks; break; case EGridSize.year1: num = new DateTime(dateTime.Year, 1, 1).AddYears(1).Ticks; break; case EGridSize.year2: num = new DateTime(dateTime.Year, 1, 1).AddYears(1 + (1 - dateTime.Year % 2)).Ticks; break; case EGridSize.month3: DateTime dateTime2 = new DateTime(dateTime.Year, dateTime.Month, 1); dateTime2 = dateTime2.AddMonths(1 + (12 - dateTime.Month) % 3); num = dateTime2.Ticks; break; case EGridSize.month4: DateTime dateTime3 = new DateTime(dateTime.Year, dateTime.Month, 1); dateTime3 = dateTime3.AddMonths(1 + (12 - dateTime.Month) % 4); num = dateTime3.Ticks; break; case EGridSize.week2: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays(8.0 - (double)dateTime.DayOfWeek + (double)(7 * (1 - (int)Math.Floor(new TimeSpan(dateTime.AddDays(8.0 - (double)dateTime.DayOfWeek).Ticks).TotalDays) / 7 % 2))).Ticks; break; case EGridSize.month1: DateTime dateTime4 = new DateTime(dateTime.Year, dateTime.Month, 1); dateTime4 = dateTime4.AddMonths(1); num = dateTime4.Ticks; break; case EGridSize.month2: DateTime dateTime5 = new DateTime(dateTime.Year, dateTime.Month, 1); dateTime5 = dateTime5.AddMonths(1 + dateTime.Month % 2); num = dateTime5.Ticks; break; case EGridSize.day5: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays((double)(1 + (4 - (int)new TimeSpan(dateTime.Ticks).TotalDays % 5))).Ticks; break; case EGridSize.week1: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays(8.0 - (double)dateTime.DayOfWeek).Ticks; break; case EGridSize.day2: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays((double)(1 + (int)new TimeSpan(dateTime.Ticks).TotalDays % 2)).Ticks; break; case EGridSize.day3: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays((double)(1 + (2 - (int)new TimeSpan(dateTime.Ticks).TotalDays % 3))).Ticks; break; case EGridSize.hour12: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours((double)(1 + (11 - (int)new TimeSpan(dateTime.Ticks).TotalHours % 12))).Ticks; break; case EGridSize.day1: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day).AddDays(1).Ticks; break; case EGridSize.hour3: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours((double)(1 + (2 - (int)new TimeSpan(dateTime.Ticks).TotalHours % 3))).Ticks; break; case EGridSize.hour4: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours((double)(1 + (3 - (int)new TimeSpan(dateTime.Ticks).TotalHours % 4))).Ticks; break; case EGridSize.hour6: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours((double)(1 + (5 - (int)new TimeSpan(dateTime.Ticks).TotalHours % 6))).Ticks; break; case EGridSize.hour1: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours(1.0).Ticks; break; case EGridSize.hour2: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0).AddHours((double)(1 + (1 - (int)new TimeSpan(dateTime.Ticks).TotalHours % 2))).Ticks; break; case EGridSize.min20: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (19 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 20))).Ticks; break; case EGridSize.min30: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (29 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 30))).Ticks; break; case EGridSize.min10: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (9 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 10))).Ticks; break; case EGridSize.min15: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (14 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 15))).Ticks; break; case EGridSize.min1: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes(1.0).Ticks; break; case EGridSize.min2: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (1 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 2))).Ticks; break; case EGridSize.min5: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0).AddMinutes((double)(1 + (4 - (int)new TimeSpan(dateTime.Ticks).TotalMinutes % 5))).Ticks; break; case EGridSize.sec20: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds((double)(1 + (19 - (int)new TimeSpan(dateTime.Ticks).TotalSeconds % 20))).Ticks; break; case EGridSize.sec30: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds((double)(1 + (29 - (int)new TimeSpan(dateTime.Ticks).TotalSeconds % 30))).Ticks; break; case EGridSize.sec5: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds((double)(1 + (4 - (int)new TimeSpan(dateTime.Ticks).TotalSeconds % 5))).Ticks; break; case EGridSize.sec10: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds((double)(1 + (9 - (int)new TimeSpan(dateTime.Ticks).TotalSeconds % 10))).Ticks; break; case EGridSize.sec1: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds(1).Ticks; break; case EGridSize.sec2: num = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second).AddSeconds((double)(1 + (1 - (int)new TimeSpan(dateTime.Ticks).TotalSeconds % 2))).Ticks; break; default: num = (long)(dateTime.Ticks + gridSize); break; } return num; }
public double GetNextGridDivision(double FirstTick, double PrevMajor, int MajorCount, EGridSize GridSize) { return this.fTransformation.GetNextGridDivision(FirstTick, PrevMajor, MajorCount, GridSize); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return(majorCount != 0 ? (gridSize >= (EGridSize)576000000000 ? (double)Axis.GetNextMajor((long)prevMajor, gridSize) : this.x4KCNJAMeJ(prevMajor, (long)gridSize)) : (double)this.B63C22nX2q((long)firstTick - this.gWjCgJN3TA)); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return majorCount != 0 ? (gridSize >= (EGridSize)576000000000 ? (double)Axis.GetNextMajor((long)prevMajor, gridSize) : this.GetNextMajor(prevMajor, (long)gridSize)) : (double)this.GetFirstMajor((long)firstTick - this.fGap); }
public static long GetNextMajor(long prevMajor, EGridSize gridSize) { long num; switch (gridSize) { case EGridSize.year5: num = new DateTime(prevMajor).AddYears(5).Ticks; break; case EGridSize.year10: num = new DateTime(prevMajor).AddYears(10).Ticks; break; case EGridSize.year20: num = new DateTime(prevMajor).AddYears(20).Ticks; break; case EGridSize.year2: num = new DateTime(prevMajor).AddYears(2).Ticks; break; case EGridSize.year3: num = new DateTime(prevMajor).AddYears(3).Ticks; break; case EGridSize.year4: num = new DateTime(prevMajor).AddYears(4).Ticks; break; case EGridSize.month4: num = new DateTime(prevMajor).AddMonths(4).Ticks; break; case EGridSize.month6: num = new DateTime(prevMajor).AddMonths(6).Ticks; break; case EGridSize.year1: num = new DateTime(prevMajor).AddYears(1).Ticks; break; case EGridSize.month1: num = new DateTime(prevMajor).AddMonths(1).Ticks; break; case EGridSize.month2: num = new DateTime(prevMajor).AddMonths(2).Ticks; break; case EGridSize.month3: num = new DateTime(prevMajor).AddMonths(3).Ticks; break; default: num = (long)(prevMajor + gridSize); break; } return num; }
public void GetFirstGridDivision(ref EGridSize GridSize, ref double Min, ref double Max, ref DateTime FirstDateTime) { this.fTransformation.GetFirstGridDivision(ref GridSize, ref Min, ref Max, ref FirstDateTime); }
private long c9T0e1qB80(DateTime obj0, EGridSize gridSize) { long num; switch (gridSize) { case EGridSize.year5: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (4 - obj0.Year % 5)).Ticks; break; case EGridSize.year10: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (9 - obj0.Year % 10)).Ticks; break; case EGridSize.year20: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (19 - obj0.Year % 20)).Ticks; break; case EGridSize.year3: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (2 - obj0.Year % 3)).Ticks; break; case EGridSize.year4: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (3 - obj0.Year % 4)).Ticks; break; case EGridSize.month6: DateTime dateTime1 = new DateTime(obj0.Year, obj0.Month, 1); dateTime1 = dateTime1.AddMonths(1 + (12 - obj0.Month) % 6); num = dateTime1.Ticks; break; case EGridSize.year1: num = new DateTime(obj0.Year, 1, 1).AddYears(1).Ticks; break; case EGridSize.year2: num = new DateTime(obj0.Year, 1, 1).AddYears(1 + (1 - obj0.Year % 2)).Ticks; break; case EGridSize.month3: DateTime dateTime2 = new DateTime(obj0.Year, obj0.Month, 1); dateTime2 = dateTime2.AddMonths(1 + (12 - obj0.Month) % 3); num = dateTime2.Ticks; break; case EGridSize.month4: DateTime dateTime3 = new DateTime(obj0.Year, obj0.Month, 1); dateTime3 = dateTime3.AddMonths(1 + (12 - obj0.Month) % 4); num = dateTime3.Ticks; break; case EGridSize.week2: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays(8.0 - (double)obj0.DayOfWeek + (double)(7 * (1 - (int)Math.Floor(new TimeSpan(obj0.AddDays(8.0 - (double)obj0.DayOfWeek).Ticks).TotalDays) / 7 % 2))).Ticks; break; case EGridSize.month1: DateTime dateTime4 = new DateTime(obj0.Year, obj0.Month, 1); dateTime4 = dateTime4.AddMonths(1); num = dateTime4.Ticks; break; case EGridSize.month2: DateTime dateTime5 = new DateTime(obj0.Year, obj0.Month, 1); dateTime5 = dateTime5.AddMonths(1 + obj0.Month % 2); num = dateTime5.Ticks; break; case EGridSize.day5: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays((double)(1 + (4 - (int)new TimeSpan(obj0.Ticks).TotalDays % 5))).Ticks; break; case EGridSize.week1: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays(8.0 - (double)obj0.DayOfWeek).Ticks; break; case EGridSize.day2: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays((double)(1 + (int)new TimeSpan(obj0.Ticks).TotalDays % 2)).Ticks; break; case EGridSize.day3: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays((double)(1 + (2 - (int)new TimeSpan(obj0.Ticks).TotalDays % 3))).Ticks; break; case EGridSize.hour12: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours((double)(1 + (11 - (int)new TimeSpan(obj0.Ticks).TotalHours % 12))).Ticks; break; case EGridSize.day1: num = new DateTime(obj0.Year, obj0.Month, obj0.Day).AddDays(1.0).Ticks; break; case EGridSize.hour3: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours((double)(1 + (2 - (int)new TimeSpan(obj0.Ticks).TotalHours % 3))).Ticks; break; case EGridSize.hour4: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours((double)(1 + (3 - (int)new TimeSpan(obj0.Ticks).TotalHours % 4))).Ticks; break; case EGridSize.hour6: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours((double)(1 + (5 - (int)new TimeSpan(obj0.Ticks).TotalHours % 6))).Ticks; break; case EGridSize.hour1: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours(1.0).Ticks; break; case EGridSize.hour2: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, 0, 0).AddHours((double)(1 + (1 - (int)new TimeSpan(obj0.Ticks).TotalHours % 2))).Ticks; break; case EGridSize.min20: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (19 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 20))).Ticks; break; case EGridSize.min30: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (29 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 30))).Ticks; break; case EGridSize.min10: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (9 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 10))).Ticks; break; case EGridSize.min15: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (14 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 15))).Ticks; break; case EGridSize.min1: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes(1.0).Ticks; break; case EGridSize.min2: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (1 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 2))).Ticks; break; case EGridSize.min5: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, 0).AddMinutes((double)(1 + (4 - (int)new TimeSpan(obj0.Ticks).TotalMinutes % 5))).Ticks; break; case EGridSize.sec20: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds((double)(1 + (19 - (int)new TimeSpan(obj0.Ticks).TotalSeconds % 20))).Ticks; break; case EGridSize.sec30: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds((double)(1 + (29 - (int)new TimeSpan(obj0.Ticks).TotalSeconds % 30))).Ticks; break; case EGridSize.sec5: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds((double)(1 + (4 - (int)new TimeSpan(obj0.Ticks).TotalSeconds % 5))).Ticks; break; case EGridSize.sec10: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds((double)(1 + (9 - (int)new TimeSpan(obj0.Ticks).TotalSeconds % 10))).Ticks; break; case EGridSize.sec1: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds(1.0).Ticks; break; case EGridSize.sec2: num = new DateTime(obj0.Year, obj0.Month, obj0.Day, obj0.Hour, obj0.Minute, obj0.Second).AddSeconds((double)(1 + (1 - (int)new TimeSpan(obj0.Ticks).TotalSeconds % 2))).Ticks; break; default: num = (long)(obj0.Ticks + gridSize); break; } return(num); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return majorCount != 0 ? Axis.GetNextMajor((long)prevMajor, gridSize) : firstTick; }
public void GetFirstGridDivision(ref EGridSize gridSize, ref double min, ref double max, ref DateTime firstDateTime) { gridSize = Axis.CalculateSize(max - min); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return(majorCount != 0 ? (double)Axis.GetNextMajor((long)prevMajor, gridSize) : firstTick); }
public double GetNextGridDivision(double firstTick, double prevMajor, int majorCount, EGridSize gridSize) { return(majorCount != 0 ? (gridSize >= (EGridSize)576000000000 ? (double)Axis.GetNextMajor((long)prevMajor, gridSize) : this.GetNextMajor(prevMajor, (long)gridSize)) : (double)this.GetFirstMajor((long)firstTick - this.fGap)); }
//TODO: rewrite it! public void PaintWithDates(DateTime minDate, DateTime maxDate) { var solidBrush1 = new SolidBrush(TitleColor); var solidBrush2 = new SolidBrush(LabelColor); var Pen1 = new Pen(this.titleColor); var Pen2 = new Pen(this.gridColor); var pen1 = new Pen(this.minorGridColor); var pen2 = new Pen(this.minorTicksColor); var pen3 = new Pen(this.majorTicksColor); Pen2.Width = this.gridWidth; Pen2.DashStyle = this.gridDashStyle; pen1.Width = this.minorGridWidth; pen1.DashStyle = this.minorGridDashStyle; long ticks1 = minDate.Ticks; long ticks2 = maxDate.Ticks; DateTime dateTime1 = new DateTime(Math.Max(0L, ticks1)); EGridSize egridSize = AxisBottom.CalculateSize((double)(ticks2 - ticks1)); long num1 = 0L; long gridDivision = this.GetGridDivision(dateTime1, egridSize); int num2 = 0; long num3 = gridDivision; long num4 = 0L; int num5 = 0; long num6 = ticks2; int num7 = -1; while (num3 < num6) { if (num5 != 0) { num3 = AxisBottom.GetNextMajor(num4, egridSize); } long num8 = num3; int index = this.chart.MainSeries.GetIndex(new DateTime(num3 - 1L), IndexOption.Next); if (num7 == index) { num4 = num3; } else { num7 = index; if (index != -1) { DateTime dateTime2 = this.chart.MainSeries.GetDateTime(index); TimeSpan timeOfDay = dateTime2.TimeOfDay; long ticks3 = dateTime2.Ticks; if (ticks3 < num6) { if (this.gridEnabled) { this.chart.DrawVerticalGrid(Pen2, ticks3); } if (this.majorTicksEnabled) { this.chart.DrawVerticalTick(Pen1, ticks3, -5); } if (this.labelEnabled) { string format; if (ticks3 % 864000000000L == this.chart.SessionStart.Ticks || ticks3 % 864000000000L == this.chart.SessionEnd.Ticks) { format = num4 != 0L ? (new DateTime(num4).Year == new DateTime(ticks3).Year ? "MMM dd" : "yyyy MMM dd") : "yyy MMM dd"; } else if (num4 == 0L) { format = "yyy MMM dd HH:mm"; } else { DateTime dateTime3 = new DateTime(num4); DateTime dateTime4 = new DateTime(ticks3); format = dateTime3.Year == dateTime4.Year ? (dateTime3.Month == dateTime4.Month ? (dateTime3.Day == dateTime4.Day ? (dateTime3.Minute != dateTime4.Minute || dateTime3.Hour != dateTime4.Hour ? "HH:mm" : "HH:mm:ss") : "MMM dd HH:mm") : "MMM dd HH:mm") : "yyy MMM dd HH:mm"; } string str = new DateTime(ticks3).ToString(format); SizeF sizeF = this.chart.Graphics.MeasureString(str, this.labelFont); int num9 = (int)sizeF.Width; int num10 = (int)sizeF.Height; if (this.labelAlignment == EAxisLabelAlignment.Right) { this.chart.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)this.chart.ClientX(new DateTime(ticks3)), (float)(int)(this.y + (double)this.labelOffset)); } if (this.labelAlignment == EAxisLabelAlignment.Left) { this.chart.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)(this.chart.ClientX(new DateTime(ticks3)) - num9), (float)(int)(this.y + (double)this.labelOffset)); } if (this.labelAlignment == EAxisLabelAlignment.Centre) { int num11 = this.chart.ClientX(new DateTime(ticks3)) - num9 / 2; int num12 = (int)(this.y + (double)this.labelOffset); if (num5 == 0 || num11 - num2 >= 1) { this.chart.Graphics.DrawString(str, this.labelFont, (Brush)solidBrush2, (float)num11, (float)num12); num2 = num11 + num9; } } } } num1 = ticks3; num3 = num8; num4 = num3; ++num5; } } } if (this.chart.SessionGridEnabled && (EGridSize)(this.chart.SessionEnd - this.chart.SessionStart).Ticks >= egridSize) { int num8 = 0; long X; for (long index = ticks1 / 864000000000L * 864000000000L + this.chart.SessionStart.Ticks; (X = index + (long)num8 * 864000000000L) < ticks2; ++num8) { this.chart.DrawSessionGrid(new Pen(this.chart.SessionGridColor), X); } } if (!this.titleEnabled) { return; } int num13 = (int)this.chart.Graphics.MeasureString("Example", this.labelFont).Height; int num14 = (int)this.chart.Graphics.MeasureString(ticks2.ToString("F1"), this.labelFont).Width; double num15 = (double)this.chart.Graphics.MeasureString(this.title, this.titleFont).Height; int num16 = (int)this.chart.Graphics.MeasureString(this.title, this.titleFont).Width; if (this.titlePosition == EAxisTitlePosition.Left) { this.chart.Graphics.DrawString(this.title, this.titleFont, (Brush)solidBrush1, (float)(int)this.x1, (float)(int)(this.y + (double)this.labelOffset + (double)num13 + (double)this.titleOffset)); } if (this.titlePosition == EAxisTitlePosition.Right) { this.chart.Graphics.DrawString(this.title, this.titleFont, (Brush)solidBrush1, (float)((int)this.x2 - num16), (float)(int)(this.y + (double)this.labelOffset + (double)num13 + (double)this.titleOffset)); } if (this.titlePosition != EAxisTitlePosition.Centre) { return; } this.chart.Graphics.DrawString(this.title, this.titleFont, (Brush)solidBrush1, (float)(int)(this.x1 + (this.x2 - this.x1 - (double)num16) / 2.0), (float)(int)(this.y + (double)this.labelOffset + (double)num13 + (double)this.titleOffset)); }