Пример #1
0
        override internal void Draw(Report rpt)
        {
            CreateSizedBitmap();
            using (Graphics g1 = Graphics.FromImage(_bm))
            {
                _aStream = new System.IO.MemoryStream();
                IntPtr HDC = g1.GetHdc();
                //_mf = new System.DrawingCore.Imaging.Metafile(_aStream, HDC);
                _mf = new System.DrawingCore.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.DrawingCore.Imaging.MetafileFrameUnit.Pixel);
                g1.ReleaseHdc(HDC);
            }

            using (Graphics g = Graphics.FromImage(_mf))
            {
                // 06122007AJM Used to Force Higher Quality
                g.InterpolationMode  = System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode      = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode    = System.DrawingCore.Drawing2D.PixelOffsetMode.None;
                g.CompositingQuality = System.DrawingCore.Drawing2D.CompositingQuality.HighQuality;

                // Adjust the top margin to depend on the title height
                Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title);
                Layout.TopMargin = titleSize.Height;

                double max = 0, min = 0;                // Get the max and min values
                //		GetValueMaxMin(rpt, ref max, ref min,0, 1);

                DrawChartStyle(rpt, g);

                // Draw title; routine determines if necessary
                DrawTitle(rpt, g, ChartDefn.Title, new System.DrawingCore.Rectangle(0, 0, _bm.Width, Layout.TopMargin));

                Layout.LeftMargin  = 0;
                Layout.RightMargin = 0;

                // Draw legend
                System.DrawingCore.Rectangle lRect = DrawLegend(rpt, g, false, true);

                Layout.BottomMargin = 0;

                AdjustMargins(lRect, rpt, g);                           // Adjust margins based on legend.

                // Draw Plot area
                DrawPlotAreaStyle(rpt, g, lRect);

                string subtype = _ChartDefn.Subtype.EvaluateString(rpt, _row);

                DrawMap(rpt, g, subtype, max, min);

                DrawLegend(rpt, g, false, false);
            }
        }
Пример #2
0
        override internal void Draw(Report rpt)
        {
            CreateSizedBitmap();

            using (Graphics g1 = Graphics.FromImage(_bm))
            {
                _aStream = new System.IO.MemoryStream();
                IntPtr HDC = g1.GetHdc();
                _mf = new System.DrawingCore.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.DrawingCore.Imaging.MetafileFrameUnit.Pixel);
                g1.ReleaseHdc(HDC);
            }

            using (Graphics g = Graphics.FromImage(_mf))
            {
                // 06122007AJM Used to Force Higher Quality
                g.InterpolationMode  = System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode      = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode    = System.DrawingCore.Drawing2D.PixelOffsetMode.None;
                g.CompositingQuality = System.DrawingCore.Drawing2D.CompositingQuality.HighQuality;

                // Adjust the top margin to depend on the title height
                Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title);
                Layout.TopMargin = titleSize.Height;

                DrawChartStyle(rpt, g);

                // Draw title; routine determines if necessary
                DrawTitle(rpt, g, ChartDefn.Title, new System.DrawingCore.Rectangle(0, 0, _bm.Width, Layout.TopMargin));

                // Draw legend
                System.DrawingCore.Rectangle lRect = DrawLegend(rpt, g, false, true);

                // Adjust the bottom margin to depend on the Category Axis
                Size caSize = CategoryAxisSize(rpt, g);
                Layout.BottomMargin = caSize.Height;

                // 20022008 AJM GJL - Added required info
                AdjustMargins(lRect, rpt, g);                           // Adjust margins based on legend.

                // Draw Plot area
                DrawPlotAreaStyle(rpt, g, lRect);

                // Draw Category Axis
                if (caSize.Height > 0)
                {
                    DrawCategoryAxis(rpt, g,
                                     new System.DrawingCore.Rectangle(Layout.LeftMargin, _bm.Height - Layout.BottomMargin, _bm.Width - Layout.LeftMargin - Layout.RightMargin, caSize.Height));
                }

                if (ChartDefn.Type == ChartTypeEnum.Doughnut)
                {
                    DrawPlotAreaDoughnut(rpt, g);
                }
                else
                {
                    DrawPlotAreaPie(rpt, g);
                }

                DrawLegend(rpt, g, false, false);
            }
        }
Пример #3
0
        override internal void Draw(Report rpt)
        {
            CreateSizedBitmap();

            using (Graphics g1 = Graphics.FromImage(_bm))
            {
                _aStream = new System.IO.MemoryStream();
                IntPtr HDC = g1.GetHdc();
                _mf = new System.DrawingCore.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.DrawingCore.Imaging.MetafileFrameUnit.Pixel);
                g1.ReleaseHdc(HDC);
            }

            using (Graphics g = Graphics.FromImage(_mf))
            {
                // 06122007AJM Used to Force Higher Quality
                g.InterpolationMode  = System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode      = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode    = System.DrawingCore.Drawing2D.PixelOffsetMode.None;
                g.CompositingQuality = System.DrawingCore.Drawing2D.CompositingQuality.HighQuality;

                // Adjust the top margin to depend on the title height
                Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title);
                Layout.TopMargin = titleSize.Height;

                // 20022008 AJM GJL - Added new required info
                double max = 0, min = 0;                // Get the max and min values
                GetValueMaxMin(rpt, ref max, ref min, 0, 1);

                DrawChartStyle(rpt, g);

                // Draw title; routine determines if necessary
                DrawTitle(rpt, g, ChartDefn.Title, new System.DrawingCore.Rectangle(0, 0, Layout.Width, Layout.TopMargin));

                // Adjust the left margin to depend on the Value Axis
                Size vaSize = ValueAxisSize(rpt, g, min, max);
                Layout.LeftMargin = vaSize.Width;

                // Draw legend
                System.DrawingCore.Rectangle lRect = DrawLegend(rpt, g, ChartDefn.Type == ChartTypeEnum.Area? false: true, true);

                // Adjust the bottom margin to depend on the Category Axis
                Size caSize = CategoryAxisSize(rpt, g);
                Layout.BottomMargin = caSize.Height;

                AdjustMargins(lRect, rpt, g);                           // Adjust margins based on legend.

                // Draw Plot area
                DrawPlotAreaStyle(rpt, g, lRect);
                int    intervalCount = 0;
                double incr          = 0;
                // Draw Value Axis
                if (vaSize.Width > 0)                   // If we made room for the axis - we need to draw it
                {
                    DrawValueAxis(rpt, g, min, max,
                                  new System.DrawingCore.Rectangle(Layout.LeftMargin - vaSize.Width, Layout.TopMargin, vaSize.Width, Layout.PlotArea.Height), Layout.LeftMargin, _bm.Width - Layout.RightMargin, out incr, out intervalCount);
                }

                // Draw Category Axis
                if (caSize.Height > 0)
                {
                    //09052008ajm passing chart bounds int
                    DrawCategoryAxis(rpt, g,
                                     new System.DrawingCore.Rectangle(Layout.LeftMargin, _bm.Height - Layout.BottomMargin, Layout.PlotArea.Width, caSize.Height), Layout.TopMargin,
                                     caSize.Width);
                }

                // Draw Plot area data
                if (ChartDefn.Type == ChartTypeEnum.Area)
                {
                    if ((ChartSubTypeEnum)Enum.Parse(typeof(ChartSubTypeEnum), _ChartDefn.Subtype.EvaluateString(rpt, _row)) == ChartSubTypeEnum.Stacked)
                    {
                        DrawPlotAreaAreaStacked(rpt, g, min, max);
                    }
                    else if ((ChartSubTypeEnum)Enum.Parse(typeof(ChartSubTypeEnum), _ChartDefn.Subtype.EvaluateString(rpt, _row)) == ChartSubTypeEnum.PercentStacked)
                    {
                        DrawPlotAreaAreaPercentStacked(rpt, g);
                    }
                    else
                    {
                        DrawPlotAreaArea(rpt, g, min, max);
                    }
                }
                else
                {
                    DrawPlotAreaLine(rpt, g, min, max);
                }
                DrawLegend(rpt, g, ChartDefn.Type == ChartTypeEnum.Area? false: true, false);
            }
        }
Пример #4
0
        override internal void Draw(Report rpt)
        {
            CreateSizedBitmap();


            using (Graphics g1 = Graphics.FromImage(_bm))
            {
                _aStream = new System.IO.MemoryStream();
                IntPtr HDC = g1.GetHdc();
                _mf = new System.DrawingCore.Imaging.Metafile(_aStream, HDC, new RectangleF(0, 0, _bm.Width, _bm.Height), System.DrawingCore.Imaging.MetafileFrameUnit.Pixel);
                g1.ReleaseHdc(HDC);
            }

            using (Graphics g = Graphics.FromImage(_mf))
            {
                // 06122007AJM Used to Force Higher Quality
                g.InterpolationMode  = System.DrawingCore.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode      = System.DrawingCore.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode    = System.DrawingCore.Drawing2D.PixelOffsetMode.None;
                g.CompositingQuality = System.DrawingCore.Drawing2D.CompositingQuality.HighQuality;
                g.PageUnit           = GraphicsUnit.Pixel;

                // Adjust the top margin to depend on the title height
                Size titleSize = DrawTitleMeasure(rpt, g, ChartDefn.Title);
                Layout.TopMargin = titleSize.Height;

                // 20022008 AJM GJL - Added new required info
                double ymax = 0, ymin = 0;              // Get the max and min values for the y axis
                GetValueMaxMin(rpt, ref ymax, ref ymin, 1, 1);

                double xmax = 0, xmin = 0;  // Get the max and min values for the x axis
                GetValueMaxMin(rpt, ref xmax, ref xmin, 0, 1);

                double bmax = 0, bmin = 0;                  // Get the max and min values for the bubble size
                if (ChartDefn.Type == ChartTypeEnum.Bubble) // only applies to bubble (not scatter)
                {
                    GetValueMaxMin(rpt, ref bmax, ref bmin, 2, 1);
                }

                DrawChartStyle(rpt, g);

                // Draw title; routine determines if necessary
                DrawTitle(rpt, g, ChartDefn.Title, new System.DrawingCore.Rectangle(0, 0, Layout.Width, Layout.TopMargin));

                // Adjust the left margin to depend on the Value Axis
                Size vaSize = ValueAxisSize(rpt, g, ymin, ymax);
                Layout.LeftMargin = vaSize.Width;

                // Draw legend
                System.DrawingCore.Rectangle lRect = DrawLegend(rpt, g, false, true);

                // Adjust the bottom margin to depend on the Category Axis
                Size caSize = CategoryAxisSize(rpt, g, xmin, xmax);
                Layout.BottomMargin = caSize.Height;

                AdjustMargins(lRect, rpt, g);                           // Adjust margins based on legend.

                // Draw Plot area
                DrawPlotAreaStyle(rpt, g, lRect);

                // Draw Value Axis
                if (vaSize.Width > 0)                   // If we made room for the axis - we need to draw it
                {
                    DrawValueAxis(rpt, g, ymin, ymax,
                                  new System.DrawingCore.Rectangle(Layout.LeftMargin - vaSize.Width, Layout.TopMargin, vaSize.Width, Layout.PlotArea.Height), Layout.LeftMargin, _bm.Width - Layout.RightMargin);
                }

                // Draw Category Axis
                if (caSize.Height > 0)
                {
                    DrawCategoryAxis(rpt, g, xmin, xmax,
                                     new System.DrawingCore.Rectangle(Layout.LeftMargin, _bm.Height - Layout.BottomMargin, _bm.Width - Layout.LeftMargin - Layout.RightMargin, vaSize.Height),
                                     Layout.TopMargin, _bm.Height - Layout.BottomMargin);
                }

                // Draw Plot area data
                DrawPlot(rpt, g, xmin, xmax, ymin, ymax, bmin, bmax);
                DrawLegend(rpt, g, false, false);
            }
        }