Ejemplo n.º 1
0
		public void PaintAxisGridAndTicks(Graphics g, Axis a, bool Marks, TVec3 o, TVec3 o_, TVec3 L)
		{
			a.MinorGridEnabled = false;
			a.MinorTicksEnabled = false;
			int nTicks = (int)(L.NormInf / 10.0);
			if (nTicks < 3)
				nTicks = 3;
			if (nTicks > 10)
				nTicks = 10;
			TAxisCalc taxisCalc = new TAxisCalc(o, o + L, a.Min, a.Max, nTicks);
			TVec3 tvec3_1 = o_ - o;
			TVec3 tvec3_2 = TVec3.O;
			TVec3 tvec3_3 = -0.04 * tvec3_1;
			if (o_.y > o.y)
			{
				tvec3_2 = tvec3_1;
				tvec3_3 = -tvec3_3;
			}
			TVec3 tvec3_4 = tvec3_2 + 1.04 * tvec3_3;
			if (a.GridEnabled)
			{
				Pen pen = new Pen(a.GridColor, a.GridWidth);
				for (int i = 0; i < taxisCalc.nTicks; ++i)
					g.DrawLine(pen, (Point)taxisCalc.TickPos(i), (Point)(taxisCalc.TickPos(i) + tvec3_1));
			}
			if (a.Position == EAxisPosition.Right && tvec3_3.x <= 0.0)
				Marks = false;
			if (!Marks)
				return;
			int num1 = a.Position == EAxisPosition.Bottom ? 0 : 1;
			int num2 = a.Position == EAxisPosition.Bottom ? taxisCalc.nTicks - 1 : taxisCalc.nTicks;
			float num3 = 0.0f;
			if (a.MajorTicksEnabled)
			{
				Pen pen = new Pen(a.GridColor, a.GridWidth);
				for (int i = num1; i < num2; ++i)
					g.DrawLine(pen, (Point)(taxisCalc.TickPos(i) + tvec3_2), (Point)(taxisCalc.TickPos(i) + tvec3_2 + tvec3_3));
			}
			if (a.LabelEnabled)
			{
				Font labelFont = a.LabelFont;
				float height = labelFont.GetHeight(g);
				SolidBrush solidBrush = new SolidBrush(a.LabelColor);
				StringFormat format = new StringFormat();
				float num4;
				if (a.Position == EAxisPosition.Bottom)
				{
					format.FormatFlags = StringFormatFlags.DirectionVertical;
					num4 = (float)Math.Abs(taxisCalc.TickPos(1).x - taxisCalc.TickPos(0).x);
				}
				else
				{
					tvec3_4.y -= 0.5 * (double)a.LabelFont.GetHeight();
					num4 = (float)Math.Abs(taxisCalc.TickPos(1).y - taxisCalc.TickPos(0).y);
				}
				if (tvec3_3.x < 0.0)
					tvec3_4.x -= (double)a.LabelFont.GetHeight();
				if ((double)num4 > 0.0)
				{
					int num5 = (int)((double)height / (double)num4 + 1.0);
					if (num1 + num5 < num2)
					{
						int i = num1;
						while (i < num2)
						{
							if (i + num5 >= num2)
								i = num2 - 1;
							TVec3 tvec3_5 = taxisCalc.TickPos(i) + tvec3_4;
							string str = taxisCalc.TickVal(i).ToString();
							g.DrawString(str, labelFont, (Brush)solidBrush, (PointF)tvec3_5, format);
							SizeF sizeF = g.MeasureString(str, labelFont);
							if ((double)sizeF.Width > (double)num3)
								num3 = sizeF.Width;
							i += num5;
						}
					}
					else if (num2 > 0)
					{
						int i = num2 - 1;
						TVec3 tvec3_5 = taxisCalc.TickPos(i) + tvec3_4;
						string str = taxisCalc.TickVal(i).ToString();
						g.DrawString(str, labelFont, (Brush)solidBrush, (PointF)tvec3_5, format);
						num3 = g.MeasureString(str, labelFont).Width;
					}
				}
			}
			if (!a.TitleEnabled)
				return;
			SizeF sizeF1 = g.MeasureString(a.Title, a.TitleFont);
			PointF point1;
			PointF point2;
			float angle;
			if (a.Position == EAxisPosition.Bottom)
			{
				if (tvec3_3.x < 0.0)
				{
					point1 = taxisCalc.TickPos(0).x > taxisCalc.TickPos(1).x ? (PointF)(taxisCalc.TickPos(taxisCalc.nTicks - 1) + tvec3_4) : (PointF)(taxisCalc.TickPos(0) + tvec3_4);
					point1.Y += num3;
					point2 = point1;
					angle = (float)(Math.Atan2(Math.Abs(L.y), Math.Abs(L.x)) * 180.0 / Math.PI);
				}
				else
				{
					point1 = taxisCalc.TickPos(0).x > taxisCalc.TickPos(1).x ? (PointF)(taxisCalc.TickPos(0) + tvec3_4) : (PointF)(taxisCalc.TickPos(taxisCalc.nTicks - 1) + tvec3_4);
					point1.X += a.LabelFont.GetHeight(g);
					point1.Y += num3;
					point2 = point1;
					point2.X -= sizeF1.Width;
					angle = (float)(-Math.Atan2(Math.Abs(L.y), Math.Abs(L.x)) * 180.0 / Math.PI);
				}
			}
			else
			{
				point1 = taxisCalc.TickPos(0).z > taxisCalc.TickPos(1).z ? (PointF)(taxisCalc.TickPos(0) + tvec3_4) : (PointF)(taxisCalc.TickPos(taxisCalc.nTicks - 1) + tvec3_4);
				point1.X += num3;
				point2 = point1;
				point2.X -= sizeF1.Width;
				angle = -90f;
			}
			Matrix matrix = new Matrix();
			matrix.RotateAt(angle, point1, MatrixOrder.Append);
			g.Transform = matrix;
			g.DrawString(a.Title, a.LabelFont, (Brush)new SolidBrush(a.LabelColor), point2);
			matrix.Reset();
			g.Transform = matrix;
		}
Ejemplo n.º 2
0
Archivo: Pad.cs Proyecto: heber/FreeOQ
				private void ResetAxis(Axis axis)
				{
					axis.LabelEnabled = false;
					axis.MajorTicksEnabled = false;
					axis.MinorTicksEnabled = false;
					axis.GridEnabled = false;
					axis.MinorGridEnabled = false;
					axis.SetRange(0.0, 1.0);
					axis.Enabled = false;
				}
Ejemplo n.º 3
0
Archivo: Pad.cs Proyecto: heber/FreeOQ
				public joI5FOYuNJBoRabUZ0(Pad pad)
				{
					this.pad = pad;
					this.axisTop = new Axis(pad);
					this.axisBottom = new Axis(pad);
					this.axisLeft = new Axis(pad);
					this.axisRight = new Axis(pad);
				}
Ejemplo n.º 4
0
Archivo: Pad.cs Proyecto: heber/FreeOQ
				private void CopyAxis(Axis axis1, Axis axis2)
				{
					axis1.LabelEnabled = axis2.LabelEnabled;
					axis1.MajorTicksEnabled = axis2.MajorTicksEnabled;
					axis1.MinorTicksEnabled = axis2.MinorTicksEnabled;
					axis1.GridEnabled = axis2.GridEnabled;
					axis1.MinorGridEnabled = axis2.MinorGridEnabled;
					axis1.SetRange(axis2.Min, axis2.Max);
					axis1.Enabled = axis2.Enabled;
				}
Ejemplo n.º 5
0
Archivo: Pad.cs Proyecto: heber/FreeOQ
		public void Init()
		{
			this.fPrimitives = new ArrayList();
			Chart.Pad = this;
			this.VN5zSfcsG = new Pad.AxisManager(this);
			this.fBackColor = Color.LightGray;
			this.fForeColor = Color.White;
			this.fX1 = 0;
			this.fX2 = 1;
			this.fY1 = 0;
			this.fY2 = 1;
			this.fWidth = this.fChart.ClientSize.Width;
			this.fHeight = this.fChart.ClientSize.Height;
			this.fClientX = 10;
			this.fClientY = 10;
			this.fClientWidth = 0;
			this.fClientHeight = 0;
			this.fMarginLeft = 10;
			this.fMarginRight = 20;
			this.fMarginTop = 10;
			this.fMarginBottom = 10;
			this.fTitle = new TTitle(this, "");
			this.fTitleEnabled = true;
			this.fTitleOffsetX = 5;
			this.fTitleOffsetY = 5;
			this.fTransformation = (IChartTransformation)new TIntradayTransformation();
			this.fTransformationType = ETransformationType.Empty;
			this.fSessionGridColor = Color.Blue;
			this.fAxisLeft = new Axis(this, EAxisPosition.Left);
			this.fAxisRight = new Axis(this, EAxisPosition.Right);
			this.fAxisTop = new Axis(this, EAxisPosition.Top);
			this.fAxisBottom = new Axis(this, EAxisPosition.Bottom);
			this.fAxisRight.LabelEnabled = false;
			this.fAxisRight.TitleEnabled = false;
			this.fAxisTop.LabelEnabled = false;
			this.fAxisTop.TitleEnabled = false;
			this.fLegend = new TLegend(this);
			this.fLegendEnabled = false;
			this.fLegendPosition = ELegendPosition.TopRight;
			this.fLegendOffsetX = 5;
			this.fLegendOffsetY = 5;
			this.fBorderEnabled = true;
			this.fBorderColor = Color.Black;
			this.fBorderWidth = 1;
			this.SetRange(0.0, 100.0, 0.0, 100.0);
			this.fGraphics = (Graphics)null;
			this.fOnAxis = false;
			this.fOnPrimitive = false;
			this.fMouseDown = false;
			this.fMouseDownX = 0;
			this.fMouseDownY = 0;
			this.fOutlineEnabled = false;
			this.fWindowSize = 600;
			this.fLastTickTime = 0;
			this.fUpdateInterval = 1;
			this.fLastUpdateDateTime = DateTime.Now;
			this.Monitored = false;
			this.fUpdating = false;
			this.fMouseZoomEnabled = true;
			this.fMouseZoomXAxisEnabled = true;
			this.fMouseZoomYAxisEnabled = true;
			this.fMouseUnzoomEnabled = true;
			this.fMouseUnzoomXAxisEnabled = true;
			this.fMouseUnzoomYAxisEnabled = true;
			this.fMouseMoveContentEnabled = true;
			this.fMouseMovePrimitiveEnabled = true;
			this.fMouseDeletePrimitiveEnabled = true;
			this.fMousePadPropertiesEnabled = true;
			this.fMousePrimitivePropertiesEnabled = true;
			this.fMouseContextMenuEnabled = true;
			this.fMouseWheelEnabled = true;
			this.fMouseWheelSensitivity = 0.1;
			this.fMouseWheelMode = EMouseWheelMode.ZoomX;
		}