public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Line line = (PriceShape_Line)shape; float x1 = priceGraphic.CalcX(line.StartPoint.X); float y1 = priceGraphic.CalcY(line.StartPoint.Y); float x2 = priceGraphic.CalcX(line.EndPoint.X); float y2 = priceGraphic.CalcY(line.EndPoint.Y); g.DrawLine(new Pen(line.Color, line.Width), x1, y1, x2, y2); }
public void DrawFrame(Graphics g, Rectangle frameRect, PriceGraphicMapping priceMapping) { Rectangle rectangleScale = frameRect; g.DrawRectangle(this.colorConfig.Pen_FrameLine, rectangleScale); float[] prices = findScalePrices(priceMapping); double xLeft = rectangleScale.X; double xRight = rectangleScale.X + rectangleScale.Width; double lowY = priceMapping.CalcY(prices[0]); double highY = priceMapping.CalcY(prices[1]); drawScaleLine(g, xLeft, xRight, lowY, prices[0]); drawScaleLine(g, xLeft, xRight, highY, prices[1]); }
private PointF GetPointF(PriceGraphicMapping priceGraphic, PricePoint pricePoint) { float x1 = priceGraphic.CalcX(pricePoint.X); float y1 = priceGraphic.CalcY(pricePoint.Y); return(new PointF(x1, y1)); }
private void DrawMount(Graphics g, IKLineBar chart, int index, PriceGraphicMapping priceMapping, float blockWidth, float blockPadding) { Rectangle rectangle = priceMapping.DrawRect; bool isRed = chart.End > chart.Start; //Brush b = new SolidBrush(isRed ? Color.Red : Color.LightSeaGreen); Brush b = isRed ? this.colorConfig.Brush_CandleBlockUp : this.colorConfig.Brush_CandleBlockDown; Pen p = new Pen(b); double XMiddle = priceMapping.CalcX(index); double YTop = priceMapping.CalcY(chart.Mount); double YBottom = rectangle.Bottom; double halfBlockWidth = (blockWidth - blockPadding) / 2; float XLeft = (float)(XMiddle - halfBlockWidth); float XRight = (float)(XMiddle + halfBlockWidth); if (isRed) { g.DrawRectangle(p, (int)XLeft, (int)YTop, (int)halfBlockWidth * 2, (int)(YBottom - YTop)); } else { g.FillRectangle(b, (int)XLeft, (int)YTop, (int)halfBlockWidth * 2, (int)(YBottom - YTop)); } }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Rect point = (PriceShape_Rect)shape; float x1 = priceGraphic.CalcX(point.PriceLeft); float y1 = priceGraphic.CalcY(point.PriceTop); float x2 = priceGraphic.CalcX(point.PriceRight); float y2 = priceGraphic.CalcY(point.PriceBottom); if (!point.FillRect) { g.DrawRectangle(new Pen(point.Color), x1, y1, x2 - x1, y2 - y1); } else { g.FillRectangle(new SolidBrush(point.Color), x1, y1, x2 - x1, y2 - y1); } }
public Point GetCrossHairPoint(int selectIndex) { PriceGraphicMapping priceMapping = this.drawer.Drawer_Chart.PriceMapping; float x = priceMapping.CalcX(selectIndex); float y = priceMapping.CalcY(drawer.DataProvider.GetKLineData().Arr_End[selectIndex]); return(new Point((int)x, (int)y)); }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Point point = (PriceShape_Point)shape; float x1 = priceGraphic.CalcX(point.X); float y1 = priceGraphic.CalcY(point.Y); float w = point.Width; g.FillEllipse(new SolidBrush(point.Color), x1 - point.Width / 2, y1 - point.Width / 2, point.Width, point.Width); }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Label label = (PriceShape_Label)shape; float x1 = priceGraphic.CalcX(label.Point.X); float y1 = priceGraphic.CalcY(label.Point.Y); Font font = label.Font != null ? label.Font : new Font("宋体", 14.2f, FontStyle.Regular); StringFormat sf = label.StringFormat != null ? label.StringFormat : new StringFormat(StringFormatFlags.DirectionVertical); g.DrawString(label.Text, font, new SolidBrush(label.Color), new PointF(x1, y1), sf); }
private void DrawCandle(Graphics g, IKLineBar chart, int index, PriceGraphicMapping priceMapping, float blockWidth, float blockPadding) { bool isRed = chart.End > chart.Start; Brush b = isRed ? this.ColorConfig.Brush_CandleBlockUp : this.ColorConfig.Brush_CandleBlockDown; if (chart.End.Equals(chart.Start)) { b = this.ColorConfig.Brush_CandleFlat; } Pen p = new Pen(b); float XMiddle = priceMapping.CalcX(index); float YTop = priceMapping.CalcY(chart.High); float YBottom = priceMapping.CalcY(chart.Low); float YBlockTop = (float)priceMapping.CalcY(isRed ? chart.End : chart.Start); float YBlockBottom = (float)priceMapping.CalcY(isRed ? chart.Start : chart.End); //画上影线和下影线 g.DrawLine(p, new PointF(XMiddle, YTop), new PointF(XMiddle, YBlockTop)); g.DrawLine(p, new PointF(XMiddle, YBottom), new PointF(XMiddle, YBlockBottom)); float halfBlockWidth = (blockWidth - blockPadding) / 2; float XLeft = XMiddle - halfBlockWidth; float XRight = XMiddle + halfBlockWidth; //画block if (chart.End == chart.Start) { g.DrawLine(p, XLeft, YBlockBottom, XRight, YBlockBottom); } else if (isRed) { g.DrawRectangle(p, XLeft, YBlockTop, halfBlockWidth * 2, YBlockBottom - YBlockTop); } else { g.FillRectangle(b, XLeft, YBlockTop, halfBlockWidth * 2, YBlockBottom - YBlockTop); } }
public void DrawFrame(Graphics g, Rectangle rect, PriceGraphicMapping priceMapping) { Rectangle rectangleScale = rect; g.DrawRectangle(colorConfig.Pen_FrameLine, rectangleScale); float price = priceMapping.PriceRect.PriceTop / 2; int y = (int)priceMapping.CalcY(price); ColorConfig config = colorConfig; g.DrawLine(config.Pen_CandleFrameScaleLine, new Point((int)rectangleScale.X, y), new Point((int)rectangleScale.Right, (int)y)); String label = price.ToString(); g.DrawString(label, config.Font_CandleFrameScaleFont, config.Brush_CandleFrameScaleBrush, new Point((int)rectangleScale.X - label.Length * 8 - 5, (int)y - 5)); }
private void DrawMount(Graphics g, IKLineBar chart, int index) { Rectangle rectangle = DisplayRect; bool isRed = chart.End > chart.Start; Brush b = new SolidBrush(isRed ? Color.Red : Color.LightSeaGreen); Pen p = new Pen(b); double XMiddle = priceMapping.CalcX(index); double YTop = priceMapping.CalcY(chart.Mount); double YBottom = rectangle.Bottom; double halfBlockWidth = (BlockWidth - BlockPadding) / 2; float XLeft = (float)(XMiddle - halfBlockWidth); float XRight = (float)(XMiddle + halfBlockWidth); if (isRed) { g.DrawRectangle(p, (int)XLeft, (int)YTop, (int)halfBlockWidth * 2, (int)(YBottom - YTop)); } else { g.FillRectangle(b, (int)XLeft, (int)YTop, (int)halfBlockWidth * 2, (int)(YBottom - YTop)); } }