예제 #1
0
        public PlottableText PlotText(
            string text,
            double x,
            double y,
            Color?color             = null,
            string fontName         = null,
            double fontSize         = 12,
            bool bold               = false,
            string label            = null,
            TextAlignment alignment = TextAlignment.middleLeft,
            double rotation         = 0,
            bool frame              = false,
            Color?frameColor        = null
            )
        {
            PlottableText plottableText = new PlottableText()
            {
                text       = text,
                x          = x,
                y          = y,
                FontColor  = color ?? settings.GetNextColor(),
                FontName   = fontName ?? Config.Fonts.GetDefaultFontName(),
                FontSize   = (float)fontSize,
                FontBold   = bold,
                alignment  = alignment,
                rotation   = rotation,
                frame      = frame,
                frameColor = frameColor ?? Color.White
            };

            Add(plottableText);
            return(plottableText);
        }
예제 #2
0
        public PlottableText PlotText(
            string text,
            double x,
            double y,
            Color?color             = null,
            string fontName         = "Segoe UI",
            double fontSize         = 12,
            bool bold               = false,
            string label            = null,
            TextAlignment alignment = TextAlignment.upperLeft
            )
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }

            fontName = ScottPlot.Tools.VerifyFont(fontName);

            PlottableText plottableText = new PlottableText(
                text: text,
                x: x,
                y: y,
                color: (Color)color,
                fontName: fontName,
                fontSize: fontSize,
                bold: bold,
                label: label,
                alignment: alignment
                );

            settings.plottables.Add(plottableText);
            return(plottableText);
        }
예제 #3
0
        /// <summary>
        /// Plot text at a specific location
        /// </summary>
        public void PlotText(string text, double x, double y, Color?color = null, string fontName = "Arial", double fontSize = 12, bool bold = false, string label = null)
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }
            PlottableText txt = new PlottableText(text, x, y, color: (Color)color, fontName: fontName, fontSize: fontSize, bold: bold, label: label);

            settings.plottables.Add(txt);
        }
예제 #4
0
        public PlottableText PlotText(
            string text,
            double x,
            double y,
            Color?color             = null,
            string fontName         = null,
            double fontSize         = 12,
            bool bold               = false,
            string label            = null,
            TextAlignment alignment = TextAlignment.middleLeft,
            double rotation         = 0,
            bool frame              = false,
            Color?frameColor        = null
            )
        {
            if (color == null)
            {
                color = settings.GetNextColor();
            }

            if (fontName == null)
            {
                fontName = Config.Fonts.GetDefaultFontName();
            }

            if (frameColor == null)
            {
                frameColor = Color.White;
            }

            fontName = Config.Fonts.GetValidFontName(fontName);

            PlottableText plottableText = new PlottableText(
                text: text,
                x: x,
                y: y,
                color: (Color)color,
                fontName: fontName,
                fontSize: fontSize,
                bold: bold,
                label: label,
                alignment: alignment,
                rotation: rotation,
                frame: frame,
                frameColor: (Color)frameColor
                );

            settings.plottables.Add(plottableText);
            return(plottableText);
        }
예제 #5
0
        public PlottableText PlotText(
            string text,
            double x,
            double y,
            Color?color             = null,
            string fontName         = null,
            double fontSize         = 12,
            bool bold               = false,
            string label            = null,
            TextAlignment alignment = TextAlignment.middleLeft,
            double rotation         = 0,
            bool frame              = false,
            Color?frameColor        = null
            )
        {
            if (!string.IsNullOrWhiteSpace(label))
            {
                Debug.WriteLine("WARNING: the PlotText() label argument is ignored");
            }

            PlottableText plottableText = new PlottableText()
            {
                text       = text,
                x          = x,
                y          = y,
                FontColor  = color ?? settings.GetNextColor(),
                FontName   = fontName ?? Config.Fonts.GetDefaultFontName(),
                FontSize   = (float)fontSize,
                FontBold   = bold,
                alignment  = alignment,
                rotation   = rotation,
                frame      = frame,
                frameColor = frameColor ?? Color.White
            };

            Add(plottableText);
            return(plottableText);
        }