예제 #1
0
        /// <summary>
        /// Renders this chart on the specified target and the context
        /// associated with the target.
        /// </summary>
        /// <param name="context">GDI+ rendering context.</param>
        /// <param name="target">Rendering target.</param>
        private void Render(Graphics context, RenderTarget target)
        {
            //context.SetClip(Viewport);

            PointF center = GetCenter(target);

            fModel.Renderer.SetTarget(context, true);
            fModel.Renderer.SaveTransform();
            fModel.Renderer.TranslateTransform(center.X, center.Y);

            if (target == RenderTarget.rtScreen)
            {
                fModel.Renderer.ScaleTransform(fZoom, fZoom);
            }
            else
            {
                fModel.Renderer.ScaleTransform(1, 1);
            }

            switch (fChartType)
            {
            case CircleChartType.Ancestors:
                fModel.DrawAncestors();
                break;

            case CircleChartType.Descendants:
                fModel.DrawDescendants();
                break;
            }

            fModel.Renderer.RestoreTransform(null);

            //context.ResetClip();
        }
예제 #2
0
        /// <summary>
        /// Renders this chart on the specified target and the context
        /// associated with the target.
        /// </summary>
        /// <param name="target">Rendering target.</param>
        /// <param name="forciblyCentered"></param>
        public override void RenderImage(RenderTarget target, bool forciblyCentered = false)
        {
            PointF center = GetCenter(target);

            var backColor = fModel.Options.BrushColor[9];

            if (target == RenderTarget.Screen)
            {
                fRenderer.DrawRectangle(null, backColor, 0, 0, Width, Height);
            }
            else if (target != RenderTarget.Printer)
            {
                fRenderer.DrawRectangle(null, backColor, 0, 0, fModel.ImageWidth, fModel.ImageHeight);
            }

            fRenderer.SaveTransform();
            fRenderer.TranslateTransform(center.X, center.Y);

            if (target == RenderTarget.Screen)
            {
                fRenderer.ScaleTransform(fZoom, fZoom);
            }
            else
            {
                fRenderer.ScaleTransform(1, 1);
            }

            switch (fChartType)
            {
            case CircleChartType.Ancestors:
                fModel.DrawAncestors();
                break;

            case CircleChartType.Descendants:
                fModel.DrawDescendants();
                break;
            }

            fRenderer.RestoreTransform();
        }