private static Size GetFullFrameSize(Size frameSize, shadowDirection shadowDir) { if (shadowDir == shadowDirection.none) { return(frameSize); } else { return(new Size(frameSize.Width + shadowWidth, frameSize.Height + shadowHeight)); } }
public void Legend( bool enableLegend = true, string fontName = null, float fontSize = 12, bool bold = false, Color?fontColor = null, Color?backColor = null, Color?frameColor = null, legendLocation location = legendLocation.lowerRight, shadowDirection shadowDirection = shadowDirection.lowerRight, bool?fixedLineWidth = null ) { if (fontName == null) { fontName = Config.Fonts.GetDefaultFontName(); } if (fontColor != null) { settings.legend.colorText = (Color)fontColor; } if (backColor != null) { settings.legend.colorBackground = (Color)backColor; } if (frameColor != null) { settings.legend.colorFrame = (Color)frameColor; } fontName = Config.Fonts.GetValidFontName(fontName); FontStyle fontStyle = (bold) ? FontStyle.Bold : FontStyle.Regular; settings.legend.font = new Font(fontName, fontSize, fontStyle); if (fixedLineWidth != null) { settings.legend.fixedLineWidth = (bool)fixedLineWidth; } if (enableLegend) { settings.legend.location = location; settings.legend.shadow = shadowDirection; } else { settings.legend.location = legendLocation.none; settings.legend.shadow = shadowDirection.none; } }
public void Legend( bool enableLegend = true, string fontName = "Segoe UI", float fontSize = 12, bool bold = false, Color?fontColor = null, Color?backColor = null, Color?frameColor = null, legendLocation location = legendLocation.lowerRight, shadowDirection shadowDirection = shadowDirection.lowerRight, LineStyle lineStyle = LineStyle.Solid ) { if (fontColor != null) { settings.legendFontColor = (Color)fontColor; } if (backColor != null) { settings.legendBackColor = (Color)backColor; } if (frameColor != null) { settings.legendFrameColor = (Color)frameColor; } fontName = ScottPlot.Tools.VerifyFont(fontName); FontStyle fontStyle = (bold) ? FontStyle.Bold : FontStyle.Regular; settings.legendFont = new Font(fontName, fontSize, fontStyle); if (enableLegend) { settings.legendLocation = location; settings.legendShadowDirection = shadowDirection; } else { settings.legendLocation = legendLocation.none; settings.legendShadowDirection = shadowDirection.none; } }
// Shadow offset in final FullFrame private static Point GetShadowOffset(shadowDirection shadowDir) { switch (shadowDir) { case shadowDirection.lowerLeft: return(new Point(0, shadowHeight)); case shadowDirection.lowerRight: return(new Point(shadowWidth, shadowHeight)); case shadowDirection.upperLeft: return(new Point(0, 0)); case shadowDirection.upperRight: return(new Point(shadowWidth, 0)); case shadowDirection.none: return(new Point(0, 0)); default: return(new Point(0, 0)); } }
public void Legend( bool enableLegend = true, string fontName = null, float?fontSize = null, bool?bold = null, Color?fontColor = null, Color?backColor = null, Color?frameColor = null, legendLocation location = legendLocation.lowerRight, shadowDirection shadowDirection = shadowDirection.lowerRight, bool?fixedLineWidth = null, bool?reverseOrder = null ) { settings.Legend.Visible = enableLegend; if (fontName != null) { settings.Legend.FontName = fontName; } if (fontSize != null) { settings.Legend.FontSize = fontSize.Value; } if (fontColor != null) { settings.Legend.FontColor = fontColor.Value; } if (backColor != null) { settings.Legend.FillColor = backColor.Value; } if (frameColor != null) { settings.Legend.OutlineColor = frameColor.Value; } if (reverseOrder != null) { settings.Legend.ReverseOrder = reverseOrder.Value; } if (bold != null) { settings.Legend.FontBold = bold.Value; } if (fixedLineWidth != null) { settings.Legend.FixedLineWidth = fixedLineWidth.Value; } if (location == legendLocation.upperLeft) { settings.Legend.Location = Direction.NW; } else if (location == legendLocation.upperCenter) { settings.Legend.Location = Direction.N; } else if (location == legendLocation.upperRight) { settings.Legend.Location = Direction.NE; } else if (location == legendLocation.middleRight) { settings.Legend.Location = Direction.E; } else if (location == legendLocation.lowerRight) { settings.Legend.Location = Direction.SE; } else if (location == legendLocation.lowerCenter) { settings.Legend.Location = Direction.S; } else if (location == legendLocation.lowerLeft) { settings.Legend.Location = Direction.SW; } else if (location == legendLocation.middleLeft) { settings.Legend.Location = Direction.W; } }