/// <summary> /// Sets the axis Inverse value identified by controllerName & axisType. /// </summary> /// <param name="controllerName"></param> /// <param name="axisType"></param> /// <param name="value"></param> public static void SetAxisInverse(string controllerName, EAxisType axisType, bool value) { if (!active) { return; } foreach (AxesBasedController controller in abControllers) { if (controller.MyName == controllerName) { if (axisType == EAxisType.Horizontal) { controller.axisX.inverse = value; return; } else if (axisType == EAxisType.Vertical) { controller.axisY.inverse = value; return; } Debug.LogError("Axis: " + axisType + " not found!"); return; } } Debug.LogError("Controller: " + controllerName + " not found!"); }
/// <summary> /// Returns the axis Enable value identified by controllerName & axisType. /// </summary> /// <param name="controllerName"></param> /// <param name="axisType"></param> /// <returns></returns> public static bool GetAxisEnable(string controllerName, EAxisType axisType) { if (!active) { return(false); } foreach (AxesBasedController controller in abControllers) { if (controller.MyName == controllerName) { if (axisType == EAxisType.Horizontal) { return(controller.axisX.enabled); } else if (axisType == EAxisType.Vertical) { return(controller.axisY.enabled); } Debug.LogError("Axis: " + axisType + " not found!"); return(false); } } Debug.LogError("Controller: " + controllerName + " not found!"); return(false); }
/// <summary> /// Returns the axis Inverse value identified by controllerName & axisType. /// </summary> /// <param name="controllerName"></param> /// <param name="axisType"></param> /// <returns></returns> public static bool GetAxisInverse(string controllerName, EAxisType axisType) { if (!m_Active) { return(false); } foreach (AxesBasedController controller in abControllers) { if (controller.identifier == controllerName) { return((axisType == EAxisType.Horizontal) ? controller.axisX.inverse : controller.axisY.inverse); } } Debug.LogError("Controller: " + controllerName + " not found!"); return(false); }
/// <summary> /// Returns the Axis value identified by controllerName & axisType. /// </summary> /// <param name="controllerName"></param> /// <param name="axisType"></param> /// <returns></returns> public static float GetAxis(string controllerName, EAxisType axisType) { if (!m_Active) { return(0f); } for (int i = 0; i < abControllers.Length; i++) { if (abControllers[i].identifier == controllerName) { return((axisType == EAxisType.Horizontal) ? abControllers[i].axisX.value : abControllers[i].axisY.value); } } Debug.LogError("Controller: " + controllerName + " not found!"); return(0f); }
private static void SetAxisType(PlotModel plotModel, EAxisType axisType) { var oldAxis = plotModel.Axes.FirstOrDefault(x => x.Position == AxisPosition.Left); if (oldAxis != null) { plotModel.Axes.Remove(oldAxis); } if (axisType == EAxisType.Linear) { plotModel.Axes.Add(new LinearAxis(AxisPosition.Left)); } else { plotModel.Axes.Add(new LogarithmicAxis(AxisPosition.Left)); } plotModel.RefreshPlot(true); }
//---------------------------------------------------------------------------- public static AxisType GetMSAxisType(EAxisType futValue) { return((AxisType)((int)futValue)); }
private void SetAxisType(EAxisType axisType) { SetAxisType(SpeedPlotModel, axisType); SetAxisType(MemoryPlotModel, axisType); }
private void Init() { this.MbS6EH3Dtx = true; this.fmn6HKQKNH = false; this.color = Color.Black; this.title = ""; this.lD76USPYGZ = true; this.ejS6gv5Ug7 = EAxisTitlePosition.Centre; this.font = new Font("Arial", 8); this.tAw6cjrLwr = Color.Black; this.MU36yJxSD6 = 2; this.fri6W8mFh9 = true; this.Lju6sLD21e = new Font("Arial", 8); this.h4w6pXqlP6 = Color.Black; this.labelFormat = (string)null; this.QvE6d9RSdV = 2; this.H786I1r5BA = EAxisLabelAlignment.Centre; this.TRd6qNDWBJ = true; this.dpi6tMHwuH = Color.Gray; this.j8m6uWqvkw = DashStyle.Solid; this.tVA6k6gEgN = 0.5f; this.nYl6mPBuBs = false; this.gPe60TWLJ7 = Color.Gray; this.Vel6TAhiZ3 = DashStyle.Solid; this.YOf6a5UipH = 0.5f; this.zU26hHtq00 = true; this.G1A6VJnjGW = Color.Black; this.ovt65ky7fn = 0.5f; this.kfw6LStExd = 4; this.raP6AFh3ta = true; this.oua6QvZpsu = Color.Black; this.zte6w2XVbU = 0.5f; this.BXj6SnOZlQ = 1; this.type = EAxisType.Numeric; this.QeC6bMjpbe = EVerticalGridStyle.ByDateTime; this.abOYnyZNZl = false; this.uWuYomI9kU = 0; this.fsWY3PuyRF = 0; this.J2nYCsqgZK = false; this.Se1Y6TOkWX = 0; this.UElYYuNU1W = 0; this.ndOYlqa0xS = -1; this.ljAYKLwBlc = -1; }
public virtual void Paint() { try { if (!this.MbS6EH3Dtx) return; if (this.QeC6bMjpbe == EVerticalGridStyle.ByDateTime && this.type == EAxisType.DateTime && this.gDw6zAT8dQ > 100000.0) { this.PaintWithDates(); } else { bool flag = false; string str1 = ""; if (this.gDw6zAT8dQ <= 1000000.0 && this.type == EAxisType.DateTime) { this.type = EAxisType.Numeric; flag = true; str1 = this.labelFormat; this.labelFormat = "labelFormat"; } SolidBrush solidBrush1 = new SolidBrush(this.tAw6cjrLwr); SolidBrush solidBrush2 = new SolidBrush(this.h4w6pXqlP6); Pen pen = new Pen(this.tAw6cjrLwr); Pen Pen1 = new Pen(this.dpi6tMHwuH); Pen Pen2 = new Pen(this.gPe60TWLJ7); Pen Pen3 = new Pen(this.oua6QvZpsu); Pen Pen4 = new Pen(this.G1A6VJnjGW); Pen1.DashStyle = this.j8m6uWqvkw; Pen2.DashStyle = this.Vel6TAhiZ3; this.pad.DrawLine(new Pen(this.color), this.jiR6jl13Bb, this.Eo969HTsnQ, this.WvY61ob0Xo, this.y2, false); int num1 = 10; int num2 = 5; double num3 = Axis.sVI6ietQib(Math.Abs(this.gDw6zAT8dQ - this.CJf67aSqFG) * 0.999999 / (double)num1); double num4 = Axis.sVI6ietQib(num3 / (double)num2); double num5 = Math.Ceiling((this.CJf67aSqFG - 0.001 * num3) / num3) * num3; double num6 = Math.Floor((this.gDw6zAT8dQ + 0.001 * num3) / num3) * num3; int num7 = 0; int num8 = 0; if (num3 != 0.0) num7 = Math.Min(10000, (int)Math.Floor((num6 - num5) / num3 + 0.5) + 1); if (num3 != 0.0) num8 = Math.Abs((int)Math.Floor(num3 / num4 + 0.5)) - 1; int num9 = 0; int num10 = 0; int num11 = 0; string str2 = ""; int num12 = 0; for (int index1 = 0; index1 < num7; ++index1) { double num13 = num5 + (double)index1 * num3; switch (this.type) { case EAxisType.Numeric: str2 = this.labelFormat != null ? num13.ToString(this.labelFormat) : num13.ToString("%"); break; case EAxisType.DateTime: str2 = this.labelFormat != null ? new DateTime((long)num13).ToString(this.labelFormat) : new DateTime((long)num13).ToString("dss"); break; } if (this.position == EAxisPosition.Bottom) { if (this.TRd6qNDWBJ) this.pad.DrawVerticalGrid(Pen1, num13); if (this.zU26hHtq00) this.pad.DrawVerticalTick(Pen4, num13, this.y2 - 1.0, -this.kfw6LStExd); if (this.fri6W8mFh9) { SizeF sizeF = this.pad.Graphics.MeasureString(str2, this.Lju6sLD21e); int num14 = (int)sizeF.Width; num12 = (int)sizeF.Height; if (this.H786I1r5BA == EAxisLabelAlignment.Right) this.pad.Graphics.DrawString(str2, this.Lju6sLD21e, (Brush)solidBrush2, (float)this.pad.ClientX(num13), (float)(int)(this.y2 + (double)this.QvE6d9RSdV)); if (this.H786I1r5BA == EAxisLabelAlignment.Left) this.pad.Graphics.DrawString(str2, this.Lju6sLD21e, (Brush)solidBrush2, (float)(this.pad.ClientX(num13) - num14), (float)(int)(this.y2 + (double)this.QvE6d9RSdV)); if (this.H786I1r5BA == EAxisLabelAlignment.Centre) { num9 = this.pad.ClientX(num13) - num14 / 2; int num15 = (int)(this.y2 + (double)this.QvE6d9RSdV); if (index1 == 0 || num9 - num10 >= 1) { this.pad.Graphics.DrawString(str2, this.Lju6sLD21e, (Brush)solidBrush2, (float)num9, (float)num15); num10 = num9 + num14; } } } } if (this.position == EAxisPosition.Left || this.position == EAxisPosition.Right) { if (this.position == EAxisPosition.Left && this.TRd6qNDWBJ) this.pad.DrawHorizontalGrid(Pen1, num13); if (this.position == EAxisPosition.Right && (!this.pad.AxisLeft.Enabled || !this.pad.AxisLeft.GridEnabled) && this.TRd6qNDWBJ) this.pad.DrawHorizontalGrid(Pen1, num13); if (this.zU26hHtq00) { switch (this.position) { case EAxisPosition.Left: this.pad.DrawHorizontalTick(Pen4, this.jiR6jl13Bb + 1.0, num13, this.kfw6LStExd); break; case EAxisPosition.Right: this.pad.DrawHorizontalTick(Pen4, this.jiR6jl13Bb - (double)this.kfw6LStExd - 1.0, num13, this.kfw6LStExd); break; } } if (this.fri6W8mFh9) { SizeF sizeF = this.pad.Graphics.MeasureString(str2, this.Lju6sLD21e); int num14 = (int)((double)sizeF.Width + (double)this.QvE6d9RSdV); int num15 = (int)sizeF.Height; if (this.H786I1r5BA == EAxisLabelAlignment.Centre) { switch (this.position) { case EAxisPosition.Left: num9 = (int)(this.jiR6jl13Bb - (double)num14); break; case EAxisPosition.Right: num9 = (int)(this.jiR6jl13Bb + 2.0); break; } int num16 = this.pad.ClientY(num13) - num15 / 2; if (index1 == 0 || num11 - (num16 + num15) >= 1) { if ((double)num16 > this.Eo969HTsnQ && (double)(num16 + num15) < this.y2) this.pad.Graphics.DrawString(str2, this.Lju6sLD21e, (Brush)solidBrush2, (float)num9, (float)num16); num11 = num16; } } } } for (int index2 = 1; index2 <= num8; ++index2) { double num14 = num5 + (double)index1 * num3 + (double)index2 * num4; if (num14 < this.gDw6zAT8dQ) { if (this.position == EAxisPosition.Bottom) { if (this.nYl6mPBuBs) this.pad.DrawVerticalGrid(Pen2, num14); if (this.raP6AFh3ta) this.pad.DrawVerticalTick(Pen3, num14, this.y2 - 1.0, -this.BXj6SnOZlQ); } if (this.position == EAxisPosition.Left || this.position == EAxisPosition.Right) { if (this.position == EAxisPosition.Left && this.nYl6mPBuBs) this.pad.DrawHorizontalGrid(Pen1, num14); if (this.position == EAxisPosition.Right && (!this.pad.AxisLeft.Enabled || !this.pad.AxisLeft.MinorGridEnabled) && this.nYl6mPBuBs) this.pad.DrawHorizontalGrid(Pen1, num14); if (this.raP6AFh3ta) { switch (this.position) { case EAxisPosition.Left: this.pad.DrawHorizontalTick(Pen3, this.jiR6jl13Bb + 1.0, num14, this.BXj6SnOZlQ); continue; case EAxisPosition.Right: this.pad.DrawHorizontalTick(Pen3, this.jiR6jl13Bb - (double)this.BXj6SnOZlQ - 1.0, num14, this.BXj6SnOZlQ); continue; default: continue; } } } } } } for (int index = 1; index <= num8; ++index) { double num13 = num5 - (double)index * num4; if (num13 > this.CJf67aSqFG) { if (this.position == EAxisPosition.Bottom) { if (this.nYl6mPBuBs) this.pad.DrawVerticalGrid(Pen2, num13); if (this.raP6AFh3ta) this.pad.DrawVerticalTick(Pen3, num13, this.y2 - 1.0, -this.BXj6SnOZlQ); } if (this.position == EAxisPosition.Left || this.position == EAxisPosition.Right) { if (this.position == EAxisPosition.Left && this.nYl6mPBuBs) this.pad.DrawHorizontalGrid(Pen1, num13); if (this.position == EAxisPosition.Right && (!this.pad.AxisLeft.Enabled || !this.pad.AxisLeft.MinorGridEnabled) && this.nYl6mPBuBs) this.pad.DrawHorizontalGrid(Pen1, num13); if (this.raP6AFh3ta) { switch (this.position) { case EAxisPosition.Left: this.pad.DrawHorizontalTick(Pen3, this.jiR6jl13Bb + 1.0, num13, this.BXj6SnOZlQ); continue; case EAxisPosition.Right: this.pad.DrawHorizontalTick(Pen3, this.jiR6jl13Bb - (double)this.BXj6SnOZlQ - 1.0, num13, this.BXj6SnOZlQ); continue; default: continue; } } } } } if (this.J2nYCsqgZK) { if (this.position == EAxisPosition.Bottom) { this.pad.DrawVerticalGrid(new Pen(Color.Green), this.pad.WorldX(this.Se1Y6TOkWX)); this.pad.DrawVerticalGrid(new Pen(Color.Green), this.pad.WorldX(this.UElYYuNU1W)); } if (this.position == EAxisPosition.Left) { this.pad.DrawHorizontalGrid(new Pen(Color.Green), this.pad.WorldY(this.Se1Y6TOkWX)); this.pad.DrawHorizontalGrid(new Pen(Color.Green), this.pad.WorldY(this.UElYYuNU1W)); } } if (this.lD76USPYGZ) { int num13 = (int)this.pad.Graphics.MeasureString("sss", this.Lju6sLD21e).Height; int num14 = (int)this.pad.Graphics.MeasureString(this.gDw6zAT8dQ.ToString("sffs"), this.Lju6sLD21e).Width; int num15 = (int)this.pad.Graphics.MeasureString(this.title, this.font).Height; int num16 = (int)this.pad.Graphics.MeasureString(this.title, this.font).Width; if (this.position == EAxisPosition.Bottom) { if (this.ejS6gv5Ug7 == EAxisTitlePosition.Left) this.pad.Graphics.DrawString(this.title, this.font, (Brush)solidBrush1, (float)(int)this.jiR6jl13Bb, (float)(int)(this.y2 + (double)this.QvE6d9RSdV + (double)num13 + (double)this.MU36yJxSD6)); if (this.ejS6gv5Ug7 == EAxisTitlePosition.Right) this.pad.Graphics.DrawString(this.title, this.font, (Brush)solidBrush1, (float)((int)this.WvY61ob0Xo - num16), (float)(int)(this.y2 + (double)this.QvE6d9RSdV + (double)num13 + (double)this.MU36yJxSD6)); if (this.ejS6gv5Ug7 == EAxisTitlePosition.Centre) this.pad.Graphics.DrawString(this.title, this.font, (Brush)solidBrush1, (float)(int)(this.jiR6jl13Bb + (this.WvY61ob0Xo - this.jiR6jl13Bb - (double)num16) / 2.0), (float)(int)(this.y2 + (double)this.QvE6d9RSdV + (double)num13 + (double)this.MU36yJxSD6)); } if (this.position == EAxisPosition.Left && this.ejS6gv5Ug7 == EAxisTitlePosition.Centre) { this.pad.Graphics.DrawString(this.title, this.font, (Brush)solidBrush1, (float)(int)(this.jiR6jl13Bb - (double)this.QvE6d9RSdV - (double)num14 - (double)this.MU36yJxSD6 - (double)num15), (float)(int)(this.Eo969HTsnQ + (this.y2 - this.Eo969HTsnQ - (double)num16) / 2.0), new StringFormat() { // FormatFlags = StringFormatFlags.DirectionRightToLeft | StringFormatFlags.DirectionVertical, // FormatFlags = StringFormatFlags.DirectionVertical }); this.pad.Graphics.ResetTransform(); } } if (!flag) return; this.type = EAxisType.DateTime; this.labelFormat = str1; } } catch { } }