Example #1
0
        /// <summary>
        /// Draws the graph.
        /// </summary>
        /// <param name="pieGraph">The pie graph.</param>
        /// <returns></returns>
        public Image DrawGraph(PieGraph pieGraph)
        {
            try
            {
                if (pieGraph == null)
                    return null;

                this.pieGraph = pieGraph;

                Bitmap bMap = new Bitmap(pieGraph.Size.Width, pieGraph.Size.Height, PixelFormat.Format64bppPArgb);
                Graphics g = Graphics.FromImage(bMap);

                g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.Clear(Color.White);
                DrawVerticalBottomGraph(ref g);
                switch (pieGraph.Alignment)
                {
                    case Alignment.HorizontalLeft:
                        bMap.RotateFlip(RotateFlipType.Rotate270FlipXY);
                        break;

                    case Alignment.HorizontalRight:
                        bMap.RotateFlip(RotateFlipType.Rotate90FlipX);
                        break;

                    case Alignment.VerticalTop:
                        bMap.RotateFlip(RotateFlipType.Rotate180FlipX);
                        break;

                    default:
                        break;
                }
                return bMap;
            }
            catch
            {
                return null;
            }
        }
Example #2
0
        /// <summary>
        /// Draws the graph.
        /// </summary>
        /// <param name="pieGraph">The pie graph.</param>
        /// <returns></returns>
        public static Image DrawGraph(PieGraph pieGraph)
        {
            PieGraphRenderer pgr = new PieGraphRenderer();

            return(pgr.DrawGraph(pieGraph));
        }