/// <summary>
    /// Override private render method
    /// <inheritdoc cref="PlotModel.RenderTitle"/>
    /// </summary>
    /// <param name="rc"></param>
    private void RenderTitle(IRenderContext rc)
    {
        OxySize?maxSize = null;

        if (ClipTitle)
        {
            maxSize = new OxySize(TitleArea.Width * TitleClippingLength, double.MaxValue);
        }

        var titleSize = rc.MeasureText(Title, ActualTitleFont, TitleFontSize, TitleFontWeight);

        var x = (TitleArea.Left + TitleArea.Right) * 0.5;
        var y = TitleArea.Top;

        if (!string.IsNullOrEmpty(Title))
        {
            rc.SetToolTip(TitleToolTip);

            rc.DrawMathText(
                new ScreenPoint(x, y),
                Title,
                TitleColor.GetActualColor(TextColor),
                ActualTitleFont,
                TitleFontSize,
                TitleFontWeight,
                0,
                HorizontalAlignment.Center,
                VerticalAlignment.Top,
                maxSize);
            y += titleSize.Height + SubTitleMargin;

            rc.SetToolTip(null);
        }

        if (!string.IsNullOrEmpty(Subtitle))
        {
            rc.DrawMathText(
                new ScreenPoint(x, y),
                Subtitle,
                SubtitleColor.GetActualColor(TextColor),
                ActualSubtitleFont,
                SubtitleFontSize,
                SubtitleFontWeight,
                0,
                HorizontalAlignment.Center,
                VerticalAlignment.Top,
                maxSize);
        }
    }
Пример #2
0
        /// <summary>
        /// Synchronize properties in the internal Plot model
        /// </summary>
        private void SynchronizeProperties()
        {
            var m = internalModel;

            m.PlotType = PlotType;

            m.PlotMargins  = PlotMargins.ToOxyThickness();
            m.Padding      = Padding.ToOxyThickness();
            m.TitlePadding = TitlePadding;

            m.Culture = Culture;

            m.DefaultColors   = DefaultColors.Select(c => c.ToOxyColor()).ToArray();
            m.DefaultFont     = DefaultFont;
            m.DefaultFontSize = DefaultFontSize;

            m.Title           = Title;
            m.TitleColor      = TitleColor.ToOxyColor();
            m.TitleFont       = TitleFont;
            m.TitleFontSize   = TitleFontSize;
            m.TitleFontWeight = (int)TitleFontWeight;
            m.TitleToolTip    = TitleToolTip;

            m.Subtitle           = Subtitle;
            m.SubtitleColor      = SubtitleColor.ToOxyColor();
            m.SubtitleFont       = SubtitleFont;
            m.SubtitleFontSize   = SubtitleFontSize;
            m.SubtitleFontWeight = (int)SubtitleFontWeight;

            m.TextColor      = TextColor.ToOxyColor();
            m.SelectionColor = SelectionColor.ToOxyColor();

            m.RenderingDecorator = RenderingDecorator;

            m.AxisTierDistance = AxisTierDistance;

            m.IsLegendVisible = IsLegendVisible;

            m.PlotAreaBackground      = PlotAreaBackground.ToOxyColor();
            m.PlotAreaBorderColor     = PlotAreaBorderColor.ToOxyColor();
            m.PlotAreaBorderThickness = PlotAreaBorderThickness.ToOxyThickness();
        }
Пример #3
0
        /// <summary>
        /// Synchronize properties in the internal Plot model
        /// </summary>
        private void SynchronizeProperties()
        {
            var m = internalModel;

            m.PlotType = PlotType;

            m.PlotMargins  = PlotMargins.ToOxyThickness();
            m.Padding      = Padding.ToOxyThickness();
            m.TitlePadding = TitlePadding;

            m.Culture = Culture;

            m.DefaultColors   = DefaultColors.Select(c => c.ToOxyColor()).ToArray();
            m.DefaultFont     = DefaultFont;
            m.DefaultFontSize = DefaultFontSize;

            m.Title           = Title;
            m.TitleColor      = TitleColor.ToOxyColor();
            m.TitleFont       = TitleFont;
            m.TitleFontSize   = TitleFontSize;
            m.TitleFontWeight = (int)TitleFontWeight;
            m.TitleToolTip    = TitleToolTip;

            m.Subtitle           = Subtitle;
            m.SubtitleColor      = SubtitleColor.ToOxyColor();
            m.SubtitleFont       = SubtitleFont;
            m.SubtitleFontSize   = SubtitleFontSize;
            m.SubtitleFontWeight = (int)SubtitleFontWeight;

            m.TextColor      = TextColor.ToOxyColor();
            m.SelectionColor = SelectionColor.ToOxyColor();

            m.RenderingDecorator = RenderingDecorator;

            m.AxisTierDistance = AxisTierDistance;

            m.IsLegendVisible       = IsLegendVisible;
            m.LegendTextColor       = LegendTextColor.ToOxyColor();
            m.LegendTitle           = LegendTitle;
            m.LegendTitleColor      = LegendTitleColor.ToOxyColor();
            m.LegendTitleFont       = LegendTitleFont;
            m.LegendTitleFontSize   = LegendTitleFontSize;
            m.LegendTitleFontWeight = (int)LegendTitleFontWeight;
            m.LegendFont            = LegendFont;
            m.LegendFontSize        = LegendFontSize;
            m.LegendFontWeight      = (int)LegendFontWeight;
            m.LegendSymbolLength    = LegendSymbolLength;
            m.LegendSymbolMargin    = LegendSymbolMargin;
            m.LegendPadding         = LegendPadding;
            m.LegendColumnSpacing   = LegendColumnSpacing;
            m.LegendItemSpacing     = LegendItemSpacing;
            m.LegendLineSpacing     = LegendLineSpacing;
            m.LegendMargin          = LegendMargin;
            m.LegendMaxHeight       = LegendMaxHeight;
            m.LegendMaxWidth        = LegendMaxWidth;

            m.LegendBackground      = LegendBackground.ToOxyColor();
            m.LegendBorder          = LegendBorder.ToOxyColor();
            m.LegendBorderThickness = LegendBorderThickness;

            m.LegendPlacement       = LegendPlacement;
            m.LegendPosition        = LegendPosition;
            m.LegendOrientation     = LegendOrientation;
            m.LegendItemOrder       = LegendItemOrder;
            m.LegendItemAlignment   = LegendItemAlignment.ToHorizontalAlignment();
            m.LegendSymbolPlacement = LegendSymbolPlacement;

            m.PlotAreaBackground      = PlotAreaBackground.ToOxyColor();
            m.PlotAreaBorderColor     = PlotAreaBorderColor.ToOxyColor();
            m.PlotAreaBorderThickness = PlotAreaBorderThickness.ToOxyThickness();
        }