Example #1
0
        public static CurvePreferences NewCurvePreferences(Brush colorBrush, double strokeThickness)
        {
            CurvePreferences cp = new CurvePreferences()
            {
                Brush           = colorBrush,
                StrokeThickness = strokeThickness
            };

            cp.DashArray = new DoubleCollection()
            {
                1
            };
            cp.DashCap    = PenLineCap.Flat;
            cp.DashOffset = 0;
            return(cp);
        }
Example #2
0
        public static TickMarks NewGridLines(CurvePreferences cp, double startX, double endX, double startY, double endY, double numXLines, double numYLines)
        {
            TickMarks tm = new TickMarks
            {
                TickMarkSet = new List <Line>()
            };

            double xInterval = (endX - startX) / numXLines;

            for (double lineloc = startX; lineloc <= endX; lineloc += xInterval)
            {
                tm.TickMarkSet.Add(new Line()
                {
                    X1              = lineloc,
                    X2              = lineloc,
                    Y1              = startY,
                    Y2              = endY,
                    Stroke          = cp.Brush,
                    StrokeThickness = cp.StrokeThickness
                });
            }
            double yInterval = (endY - startY) / numYLines;

            for (double lineloc = startY; lineloc <= endY; lineloc += yInterval)
            {
                tm.TickMarkSet.Add(new Line()
                {
                    X1              = startX,
                    X2              = endX,
                    Y1              = lineloc,
                    Y2              = lineloc,
                    Stroke          = cp.Brush,
                    StrokeThickness = cp.StrokeThickness
                });
            }

            return(tm);
        }