Example #1
0
 protected virtual void DrawLine(CGContext context, List <CGPoint> points, PointRenderStyle renderStyle)
 {
     if (renderStyle.BezierCurve)
     {
         DrawCurveLine(context, points, renderStyle.LineStyle, renderStyle.CurvatureIntensity);
     }
     else
     {
         DrawLinearLine(context, points, renderStyle.LineStyle);
     }
 }
Example #2
0
        protected virtual void Draw(CGContext context, IEnumerable <IPointEntry> entries, IEnumerable <IPointEntry> highlightedEntries, IViewPort viewPort, IXAxis xAxis, IYAxis yAxis, PointRenderStyle renderStyle)
        {
            var points = entries
                         ?.Select(t => new
            {
                Point       = GetDrawPosition(t.X, t.Y, viewPort, xAxis, yAxis),
                IsHighlight = highlightedEntries?.Contains(t) ?? false,
                Entry       = t
            })
                         .ToList();

            if (points != null)
            {
                context.SaveState();

                context.ClipToRect(viewPort.ViewPortRect);

                if (renderStyle.LineStyle.ShouldDraw)
                {
                    DrawLine(context, points.Select(t => t.Point).ToList(), renderStyle);
                }

                if (renderStyle.MarkerStyle.ShouldDraw)
                {
                    DrawNotHighlightedMarkers(context, points.Where(t => !t.IsHighlight).Select(t => t.Point).ToList(), renderStyle.MarkerStyle);
                }

                if (renderStyle.HighlightMarkerStyle.ShouldDraw)
                {
                    DrawHighlightedMarkers(context, points.Where(t => t.IsHighlight).Select(t => t.Point).ToList(), renderStyle.HighlightMarkerStyle);
                }

                foreach (var point in points)
                {
                    if (ShouldDraw(point.IsHighlight, renderStyle.TextStyle, renderStyle.HighlightTextStyle))
                    {
                        DrawEntryValue(context, point.Entry, point.Point, point.IsHighlight ? renderStyle.HighlightTextStyle : renderStyle.TextStyle);
                    }
                }

                context.RestoreState();
            }
        }
Example #3
0
        public static void DrawPoint(Graphics g, int x, int y, int radius, int rotateAngle, Pen pen, Brush brush, PointRenderStyle style)
        {
            GraphicsState state = g.Save();

            g.ScaleTransform((float)radius / 10, (float)radius / 10);
            g.RotateTransform(rotateAngle, MatrixOrder.Append);
            g.TranslateTransform(x, y, MatrixOrder.Append);

            GraphicsPath path = prototypes[style];

            if (pen != null)
            {
                g.DrawPath(pen, path);
            }

            if (brush != null)
            {
                g.FillPath(brush, path);
            }


            g.Restore(state);
        }