private (string, SKPath) LabelPath(float scale, SKSize dimension)
        {
            var txt = SIPrefix.ToString(Value);

            (var pt1, var pt2) = LabelLine(scale, dimension, txt);
            var pts = new SKPoint[] { pt1, pt2 };
            var pth = new SKPath();

            pth.AddPoly(pts, false);
            return(txt, pth);
        }
示例#2
0
        void DrawTickLabel(ref SKCanvas c, double Value, float Position, float length, SKPaint TickPaint)
        {
            var txt = SIPrefix.ToString(Value);
            var hei = MinorPaint.TextSize / 2;
            var wid = MinorPaint.MeasureText(txt) + SpaceWidth;

            var pth     = new SKPath();
            var tot_wid = wid + SpaceWidth * 2;

            if (tot_wid > LabelPadding)
            {
                LabelPadding = tot_wid;
            }

            SKPoint pt1, pt2;

            length /= 2;
            switch (Orientation)
            {
            case AxisOrientation.Vertical:
                if (TotalPadding > ParentPadding.L)
                {
                    ParentPadding.L = TotalPadding;
                }

                pt1 = new SKPoint(GetAxisLabelPosition() - tot_wid, Position);
                pt2 = new SKPoint(GetAxisLabelPosition() - SpaceWidth, Position);
                break;

            case AxisOrientation.Horizontal:
                if (TotalPadding > ParentPadding.B)
                {
                    ParentPadding.B = TotalPadding;
                }

                pt1 = new SKPoint(Position, GetAxisLabelPosition() + tot_wid);
                pt2 = new SKPoint(Position, GetAxisLabelPosition() + SpaceWidth);
                break;

            default:
                return;
            }
            var pts = new SKPoint[] { pt1, pt2 };

            pth.AddPoly(pts, false);
            c.DrawTextOnPath(txt, pth, 0, hei / 2, MinorPaint);
        }