Esempio n. 1
0
 public void FindMinMaxValues(Rdl.Runtime.Context context, ref decimal min, ref decimal max, bool ignoreSeries)
 {
     min = 0;
     max = 0;
     // Loop through the categories and series looking for min and max data values.
     if (_leafCategories != null)
     {
         foreach (Category cat in _leafCategories)
         {
             if (SeriesGrouping != null && !ignoreSeries)
             {
                 foreach (Series ser in SeriesGrouping.GetSeriesList(cat.Context, null).LeafSeriesList)
                 {
                     GetMinMax(ser.Context, ser.SeriesIndex, cat.CategoryIndex, ref min, ref max);
                 }
             }
             else
             {
                 GetMinMax(cat.Context, 0, cat.CategoryIndex, ref min, ref max);
             }
         }
     }
     else
     {
         if (SeriesGrouping != null && !ignoreSeries)
         {
             foreach (Series ser in SeriesGrouping.GetSeriesList(context, null).LeafSeriesList)
             {
                 GetMinMax(ser.Context, ser.SeriesIndex, 0, ref min, ref max);
             }
         }
         else
         {
             GetMinMax(context, 0, 0, ref min, ref max);
         }
     }
 }
Esempio n. 2
0
        public System.Drawing.Image RenderChart(Rdl.Runtime.Context context, int width, int height, decimal xMult, decimal yMult)
        {
            if (width <= 0 || height <= 0)
            {
                return(null);
            }
            Bitmap bm = new Bitmap(width, height);

            Graphics g = Graphics.FromImage(bm);

            g.PageUnit = GraphicsUnit.Pixel;

            int t = 0;
            int l = 0;
            int w = width;
            int h = height;

            if (context.Rows.Count == 0)
            {
                g.FillRectangle(new SolidBrush(Style.W32Color(Style.BackgroundColor(context))),
                                new System.Drawing.Rectangle(0, 0, w, h));
                g.DrawString("No Data", Style.GetWindowsFont(context), new SolidBrush(Style.W32Color(Style.Color(context))), new Point(0, 0));
                return(bm);
            }

            System.Drawing.Rectangle clipRect = new System.Drawing.Rectangle(l, t, w, h);
            if (Style.BackgroundColor(context) != null)
            {
                g.FillRectangle(new SolidBrush(Style.W32Color(Style.BackgroundColor(context))),
                                clipRect);
            }

            if (Style.BorderWidth != null)
            {
                Rdl.Render.Drawing.DrawBorder(g, new System.Drawing.Rectangle(l, t, w, h),
                                              new Rdl.Render.BorderWidth(Style.BorderWidth, context),
                                              new Rdl.Render.BorderStyle(Style.BorderStyle, context),
                                              new Rdl.Render.BorderColor(Style.BorderColor, context),
                                              xMult, yMult);
            }

            if (Style != null)
            {
                l += (int)(Style.PaddingLeft(context).points *xMult);
                t += (int)(Style.PaddingTop(context).points *yMult);
                w -= (int)((Style.PaddingLeft(context).points + Style.PaddingRight(context).points) * xMult);
                h -= (int)((Style.PaddingTop(context).points + Style.PaddingBottom(context).points) * yMult);
            }


            // Draw in the title.
            if (_title != null)
            {
                _title.DrawAtTop(g, context, ref l, ref t, ref w, ref h);
            }

            // Get the categories.
            if (_categoryGrouping != null)
            {
                _categories     = _categoryGrouping.GetCategories(context, null);
                _leafCategories = _categories.LeafCategories;
            }

            // Get the series
            if (_seriesGrouping != null)
            {
                _seriesList     = _seriesGrouping.GetSeriesList(context, null);
                _leafSeriesList = _seriesList.LeafSeriesList;
            }

            // Draw in the Legend
            DrawLegend(context, g, bm, ref l, ref t, ref w, ref h, (_type == TypeEnum.Pie), xMult, yMult);

            // Draw the chart.
            switch (_type)
            {
            case TypeEnum.Area:
                break;

            case TypeEnum.Bar:
                Type.Bar barChart = new Type.Bar(this, context, g, l, t, w, h);
                break;

            case TypeEnum.Bubble:
                break;

            case TypeEnum.Column:
                Type.Column columnChart = new Type.Column(this, context, g, l, t, w, h);
                break;

            case TypeEnum.Doughnut:
                break;

            case TypeEnum.Line:
                Type.Line lineChart = new Type.Line(this, context, g, l, t, w, h);
                break;

            case TypeEnum.Pie:
                break;

            case TypeEnum.Scatter:
                break;

            case TypeEnum.Stock:
                break;
            }
            return(bm);
        }