Пример #1
0
        /**
         * public double XValue(GraphPoint point)
         * {
         * if (this.XAxisDataType == AxisDataTypes.axNumeric)
         *              return (double)point.X;
         * else
         *              return DoubleConvert.Date2Double((DateTime)(point.X));
         * }
         **/


        private void DrawNodes(IGUIContext ctx, RectangleF bounds)
        {
            int OldNumberOfPoints = CurrentNumberOfPoints;

            CurrentNumberOfPoints = 0;

            if (Graph == null)
            {
                if (OldNumberOfPoints != 0)
                {
                    if (PointCountChangedEvent != null)
                    {
                        PointCountChangedEvent();
                    }
                }

                return;
            }

            PointF p;
            bool   bInterpolated = false;
            // int ListID;
            Color C;

            float offsetX = bounds.X;
            float offsetY = bounds.Y;

            if (Graph.Visible)
            {
                if (Graph.Points.Count > 1)
                {
                    DrawGraphLine(ctx, Graph, bounds);
                }

                foreach (GraphPoint gp in Graph.Points)
                {
                    p = Point2Client((double)gp.X, (double)gp.Y, bounds).Add(offsetX, offsetY);
                    if (!Bounds.IntersectsWith(new RectangleF(p.X, p.Y, 1, 1)))
                    {
                        continue;
                    }

                    bInterpolated = Graph.GraphType == GraphTypes.gtInterpolation;
                    C             = Graph.GraphColor;

                    Pen        pen        = new Pen(Color.White);
                    SolidBrush brush      = new SolidBrush(C);
                    SolidBrush whitebrush = new SolidBrush(Color.White);

                    try
                    {
                        if (bInterpolated)
                        {
                            float PointWidth = PointRadius * 2f;
                            ctx.DrawRectangle(pen, p.X - PointRadius, p.Y - PointRadius, PointWidth, PointWidth);
                            if (gp == PointCatched)
                            {
                                ctx.DrawRectangle(pen, p.X - PointRadius - 1, p.Y - PointRadius - 1, PointWidth + 2, PointWidth + 2);
                            }
                        }
                        else
                        {
                            float Radius = PointRadius / 2f;;

                            float width;
                            if (gp == PointCatched)
                            {
                                width = 4f.Scale(ScaleFactor);
                            }
                            else
                            {
                                width = 3f.Scale(ScaleFactor);
                            }

                            ctx.FillEllipse(brush, p.X, p.Y, Radius + width, Radius + width);

                            width = 1.5f.Scale(ScaleFactor);
                            ctx.FillEllipse(whitebrush, p.X, p.Y, Radius + width, Radius + width);
                            ctx.FillEllipse(brush, p.X, p.Y, Radius, Radius);
                        }
                    }
                    catch { }

                    pen.Dispose();
                    brush.Dispose();

                    CurrentNumberOfPoints++;
                }
            }

            if (CurrentNumberOfPoints != OldNumberOfPoints)
            {
                if (PointCountChangedEvent != null)
                {
                    PointCountChangedEvent();
                }
            }
        }
Пример #2
0
 public static void FillCircle(this IGUIContext ctx, Brush brush, float cx, float cy, float radius, float scale = 1)
 {
     ctx.FillEllipse(brush, cx, cy, radius, radius, scale);
 }