示例#1
0
        internal override int Render(Rdl.Render.Container box, Rdl.Runtime.Context context, Rdl.Runtime.Context rowContext, int column)
        {
            if (_staticColumns.Count > FindMatrix(this).Columns.Count)
            {
                throw new Exception("There are more static column elements defined in matrix " + FindMatrix(this).Name + " than there are data columns.");
            }

            if (RenderNext != null)
            {
                if (RenderNext is ColumnGrouping)
                {
                    column = ((ColumnGrouping)RenderNext).Render(box, context, rowContext, column);
                }
                else
                {
                    RenderNext.Render(box, context.Intersect(rowContext));
                    column++;
                }
            }

            return(column);
        }
示例#2
0
        internal void DrawVertical(Chart chart,
                                   Rdl.Runtime.Context context,
                                   Graphics g,
                                   ref int l, int t, ref int w, int h)
        {
            int majorIntervals = (int)((_maxValue - _minValue) / _majorIntervalValue);
            int minorIntervals = (int)((_maxValue - _minValue) / _minorIntervalValue);

            // Find the tick mark and axis position for the axis.
            int majorTickStart, majorTickWidth, minorTickStart, minorTickWidth, axisPos, axisWidth;

            AdjustAxisPosition(GetAxisThickness(context), out majorTickStart, out majorTickWidth,
                               out minorTickStart, out minorTickWidth,
                               out axisPos, out axisWidth);

            // If we are showing the grid lines then adjust the tick width to include the whole chart area.
            if (MajorGridLines.ShowGridLines)
            {
                majorTickWidth = w - _labelWidth - axisPos - majorTickStart;
            }
            if (MinorGridLines.ShowGridLines)
            {
                minorTickWidth = w - _labelWidth - axisPos - minorTickStart;
            }

            // Draw the axis line
            Color color        = Style.W32Color(Style.Color(context));
            Brush brush        = new SolidBrush(color);
            Pen   majorGridPen = new Pen(brush, 1);

            if (MajorGridLines != null)
            {
                majorGridPen = new Pen(new SolidBrush(Style.W32Color(MajorGridLines.Style.Color(context))),
                                       (int)MajorGridLines.Style.BorderWidth.Left(context).points);
            }
            Pen minorGridPen = new Pen(brush, 1);

            if (MinorGridLines != null)
            {
                minorGridPen = new Pen(new SolidBrush(Style.W32Color(MinorGridLines.Style.Color(context))),
                                       (int)MinorGridLines.Style.BorderWidth.Left(context).points);
            }

            g.DrawLine(new Pen(brush, GetAxisThickness(context)),
                       new Point(l + _labelWidth + axisPos + (GetAxisThickness(context) >> 1), t),
                       new Point(l + _labelWidth + axisPos + (GetAxisThickness(context) >> 1), t + h));

            Font labelFont = chart.ValueAxis.Style.GetWindowsFont(context);

            float majorEntryHeight = (float)h / majorIntervals;
            float minorEntryHeight = (float)h / minorIntervals;

            for (int i = 0; i <= majorIntervals; i++)
            {
                int top = t + h - (int)(i * majorEntryHeight);
                if (Visible)
                {
                    // Determine the amount of space required for the axis labels.
                    SizeF stringSize;

                    // Draw the axis labels.
                    decimal dValue = _minValue + (i * _majorIntervalValue);
                    stringSize = g.MeasureString(dValue.ToString().ToString(), labelFont);
                    g.DrawString(dValue.ToString(), labelFont, new SolidBrush(color),
                                 l + _labelWidth - (int)stringSize.Width - 1,
                                 top - ((int)stringSize.Height / 2));
                }

                if (i > 0)
                {
                    // Draw the major tick marks
                    if (majorTickWidth > 0)
                    {
                        g.DrawLine(majorGridPen,
                                   new Point(l + _labelWidth + axisPos + majorTickStart, top),
                                   new Point(l + _labelWidth + axisPos + majorTickStart + majorTickWidth, top));
                    }

                    // Draw the minor tick marks
                    if (minorTickWidth > 0)
                    {
                        for (int j = 1; j < minorIntervals / majorIntervals; j++)
                        {
                            g.DrawLine(minorGridPen,
                                       new Point(l + _labelWidth + axisPos + minorTickStart, top - (int)(j * minorEntryHeight)),
                                       new Point(l + _labelWidth + axisPos + minorTickStart + majorTickWidth, top - (int)(j * minorEntryHeight)));
                        }
                    }
                }
            }
            l += _labelWidth + axisWidth;
            w -= _labelWidth + axisWidth;
        }
示例#3
0
 public Category(Rdl.Runtime.Context context, CategoryGrouping grouping, Category parentCategory, string value, int index)
     :
     this(context, grouping, parentCategory, value)
 {
     _categoryIndex = index;
 }
示例#4
0
 internal override void Render(Rdl.Render.Container box, Rdl.Runtime.Context context)
 {
 }
示例#5
0
        internal override void Render(Rdl.Render.Container box, Rdl.Runtime.Context context)
        {
            Rdl.Render.FlowContainer headerBox  = null;
            Rdl.Render.FlowContainer detailsBox = null;
            Rdl.Render.FlowContainer footerBox  = null;
            Rdl.Render.FlowContainer groupRow   = null;

            context = new Rdl.Runtime.Context(
                context,
                null,
                null,
                _grouping,
                _sortBy);

            TextBox tb = Report.FindToggleItem(_visibility);

            if (box != null && !_visibility.IsHidden(context))
            {
                _box       = box.AddFlowContainer(this, Style, context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                _box.Width = box.Width;
                _box.Name  = "TableGroup";

                if (tb != null)
                {
                    tb.LinkedToggles.Add(new Toggle(_box, tb));
                }
            }

            // Render the header
            decimal groupTop = 0;

            while (context.GroupIndex < context.GroupCount)
            {
                if (_box != null)
                {
                    groupRow                 = _box.AddFlowContainer(this, Style, context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                    groupRow.Width           = _box.Width;
                    groupRow.Top             = groupTop;
                    groupRow.Name            = "GroupRrow";
                    groupRow.ContextBase     = true;
                    groupRow.PageBreakBefore = _grouping.PageBreakAtStart;
                    // Don't break page on last group item.
                    groupRow.PageBreakAfter = (context.GroupIndex + 1 < context.GroupCount) ? _grouping.PageBreakAtEnd : false;
                }

                if (_header != null)
                {
                    if (_box != null)
                    {
                        headerBox       = groupRow.AddFlowContainer(this, _header.Style, context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                        headerBox.Top   = 0;
                        headerBox.Width = groupRow.Width;
                        headerBox.Name  = "GroupHeader";
                    }

                    _header.Render(headerBox, context);
                }

                // Create a box to hold the details and tie that
                // box to any repeat lists referencing these details.
                if (_details != null && groupRow != null)
                {
                    detailsBox       = groupRow.AddFlowContainer(this, _details.Style, context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                    detailsBox.Top   = (headerBox == null) ? 0 : headerBox.Height;
                    detailsBox.Width = groupRow.Width;
                    detailsBox.Name  = "GroupDetails";

                    // If the header or footer are repeated, then add them to the repeat list of the details.
                    if (_header != null && _header.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(headerBox);
                    }
                    if (_footer != null && _footer.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(footerBox);
                    }
                }

                // Render the details.
                if (_details != null)
                {
                    _details.Render(detailsBox, context);
                }

                // Render the footer.
                if (_footer != null)
                {
                    if (groupRow != null)
                    {
                        footerBox      = groupRow.AddFlowContainer(this, _footer.Style, context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                        footerBox.Name = "GroupFooter";
                        footerBox.Top  = ((headerBox == null) ? 0 : headerBox.Height) +
                                         ((detailsBox == null) ? 0 : detailsBox.Height);
                        footerBox.Width = _box.Width;
                    }
                    context.RowIndex = 0;
                    _footer.Render(footerBox, context);
                }

                if (groupRow != null)
                {
                    groupTop += groupRow.Height;
                }

                context.LinkToggles();
                context.NextGroup();
            }
        }
示例#6
0
        private void DrawLegend(Rdl.Runtime.Context context, System.Drawing.Graphics g, Bitmap bm,
                                ref int l, ref int t, ref int w, ref int h, bool includeGroups, decimal xMult, decimal yMult)
        {
            if (_legend == null)
            {
                return;
            }

            if (!_legend.Visible)
            {
                return;
            }

            // The legend is only required if there is a series.
            if (_seriesGrouping == null)
            {
                return;
            }

            // Build the color values to use for each group
            int index = 0;

            foreach (Series ser in _leafSeriesList)
            {
                if (!_seriesColors.ContainsKey(ser.CombinedValue))
                {
                    _seriesColors.Add(ser.CombinedValue, Rdl.Engine.Chart.Palette.GetColor(_palette, index));
                    index++;
                }
            }

            // Get the font to use to draw the text.
            System.Drawing.Font font = _legend.Style.GetWindowsFont(context);

            // Measure the space required for the text.
            int height     = 0;
            int width      = 0;
            int lineHeight = 0;

            foreach (string s in _seriesColors.Keys)
            {
                SizeF size = g.MeasureString(s, font);
                lineHeight = (int)size.Height + 1;
                height    += lineHeight;
                width      = Math.Max(width, (int)size.Width + 1);
            }

            // Add some room for the color boxes and space between columns.
            width += lineHeight * 2;

            int columns = 1;

            int top = t, left = l;

            if (_legend.Position == Legend.PositionEnum.LeftBottom ||
                _legend.Position == Legend.PositionEnum.LeftCenter ||
                _legend.Position == Legend.PositionEnum.LeftTop ||
                _legend.Position == Legend.PositionEnum.RightTop ||
                _legend.Position == Legend.PositionEnum.RightCenter ||
                _legend.Position == Legend.PositionEnum.RightBottom)
            {
                // If the legend is going on the left or right of the chart then don't use more than
                // 1/3 of the available area for the legend.
                width  = Math.Min(width, w / 3);
                w     -= width + _legendPadding;
                height = Math.Min(height, h - (_legendPadding << 1));
                if (_legend.Position == Legend.PositionEnum.LeftBottom ||
                    _legend.Position == Legend.PositionEnum.LeftCenter ||
                    _legend.Position == Legend.PositionEnum.LeftTop)
                {
                    l += width + _legendPadding;
                }
                else
                {
                    left = w + _legendPadding;
                }

                if (_legend.Position == Legend.PositionEnum.LeftBottom ||
                    _legend.Position == Legend.PositionEnum.RightBottom)
                {
                    top = t + h - height;
                }
                if (_legend.Position == Legend.PositionEnum.LeftCenter ||
                    _legend.Position == Legend.PositionEnum.RightCenter)
                {
                    top = t + (h / 2) - (height / 2);
                }
            }
            else
            {
                columns = (int)(w / width);
                height  = lineHeight * (int)Math.Ceiling((double)_seriesColors.Count / columns);

                // If the legend is going above or below the chart then don't use more than
                // %60 the available space.
                height = Math.Min(height, (int)((h - _legendPadding - _legendPadding) * .6));
                h     -= height + _legendPadding + _legendPadding;
                if (_legend.Position == Legend.PositionEnum.TopCenter ||
                    _legend.Position == Legend.PositionEnum.TopLeft ||
                    _legend.Position == Legend.PositionEnum.TopRight)
                {
                    top = t + _legendPadding;
                    t  += height + _legendPadding + _legendPadding;
                }
                else
                {
                    top = t + h + _legendPadding;
                }

                if (_legend.Position == Legend.PositionEnum.BottomRight ||
                    _legend.Position == Legend.PositionEnum.TopRight)
                {
                    left = l + w - (width * columns);
                }
                if (_legend.Position == Legend.PositionEnum.BottomCenter ||
                    _legend.Position == Legend.PositionEnum.TopCenter)
                {
                    left = l + (w / 2) - ((width * columns) / 2);
                }
            }

            if (lineHeight * _seriesColors.Count > height)
            {
                lineHeight = height / _seriesColors.Count;
            }

            if (_legend.Style.BorderWidth != null)
            {
                Rdl.Render.Drawing.DrawBorder(g, new System.Drawing.Rectangle(left, top, (width * columns), height),
                                              new Rdl.Render.BorderWidth(_legend.Style.BorderWidth, context),
                                              new Rdl.Render.BorderStyle(_legend.Style.BorderStyle, context),
                                              new Rdl.Render.BorderColor(_legend.Style.BorderColor, context),
                                              xMult, yMult);
            }


            // Draw the text onto the chart legend area.
            System.Drawing.Brush brush = new SolidBrush(Style.W32Color(Style.Color(context)));
            float x, y;

            x = left;
            y = top;
            int c = 1;

            foreach (string s in _seriesColors.Keys)
            {
                if (y + lineHeight <= top + height)
                {
                    // Draw the collored box
                    g.FillRectangle(new SolidBrush(_seriesColors[s]),
                                    new RectangleF(x, y + (lineHeight / 10), (lineHeight * .8f), (lineHeight * .8f)));
                    g.DrawString(s, font, brush, new RectangleF(x + lineHeight, y, width, height - (y - top)), new StringFormat(StringFormatFlags.NoWrap));
                    if (c == columns)
                    {
                        c  = 1;
                        y += lineHeight;
                        x  = left;
                    }
                    else
                    {
                        x += width;
                        c++;
                    }
                }
            }
        }
示例#7
0
 public object Value(Rdl.Runtime.Context context)
 {
     return(_value.Exec(context));
 }
示例#8
0
 public Size Bottom(Rdl.Runtime.Context context)
 {
     return((_bottom == null) ? Default(context) : new Size(_bottom.ExecAsString(context)));
 }
示例#9
0
        protected override void Render2(Rdl.Runtime.Context context)
        {
            base.Render2(context);
            if (_box != null)
            {
                Rdl.Render.Container headerBox  = null;
                Rdl.Render.Container detailsBox = null;
                Rdl.Render.Container footerBox  = null;

                if (_header != null)
                {
                    headerBox      = ((Rdl.Render.Container)_box).AddFlowContainer(this, _header.Style, _context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                    headerBox.Name = "TableHeader";
                }
                if (_details != null)
                {
                    detailsBox      = ((Rdl.Render.Container)_box).AddFlowContainer(this, _details.Style, _context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                    detailsBox.Name = "TableDetails";
                }
                if (_footer != null)
                {
                    footerBox      = ((Rdl.Render.Container)_box).AddFlowContainer(this, _footer.Style, _context, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                    footerBox.Name = "TableFooter";
                }

                if (_header != null)
                {
                    _header.Render(headerBox, _context);
                }
                if (_details != null)
                {
                    if (detailsBox != null && headerBox != null)
                    {
                        detailsBox.Top = headerBox.Height;
                    }
                    _details.Render(detailsBox, _context);
                }
                if (_footer != null)
                {
                    if (footerBox != null)
                    {
                        if (detailsBox != null)
                        {
                            footerBox.Top = detailsBox.Top + detailsBox.Height;
                        }
                        else if (headerBox != null)
                        {
                            footerBox.Top = headerBox.Height;
                        }
                    }
                    _footer.Render(footerBox, _context);
                }

                // If the header or footer are reoeated, then add them to the repeat list of the details.
                if (_header != null && _header.RepeatOnNewPage && _box != null)
                {
                    detailsBox.RepeatList.Add(headerBox);
                }
                if (_footer != null && _footer.RepeatOnNewPage && _box != null)
                {
                    detailsBox.RepeatList.Add(footerBox);
                }
            }
        }
示例#10
0
 public Size Right(Rdl.Runtime.Context context)
 {
     return((_right == null) ? Default(context) : new Size(_right.ExecAsString(context)));
 }
示例#11
0
 public Size Top(Rdl.Runtime.Context context)
 {
     return((_top == null) ? Default(context) : new Size(_top.ExecAsString(context)));
 }
示例#12
0
 public Size Default(Rdl.Runtime.Context context)
 {
     return((_default == null) ? Size.OnePt : new Size(_default.ExecAsString(context)));
 }
示例#13
0
 public Series(Rdl.Runtime.Context context, SeriesGrouping grouping, Series parentSeries, string value, int index)
     : this(context, grouping, parentSeries, value)
 {
     _seriesIndex = index;
 }
示例#14
0
 public virtual SeriesList GetSeriesList(Rdl.Runtime.Context context, Series parentSeries)
 {
     return(null);
 }
示例#15
0
        internal bool Evaluate(Rdl.Runtime.Context context)
        {
            object        value1  = _filterExpression.Exec(context);
            List <object> values2 = new List <object>();

            foreach (Expression exp in _filterValues)
            {
                values2.Add(exp.Exec(context));
            }
            switch (_operator)
            {
            case FilterOperator.Equal:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) == 0);

            case FilterOperator.Like:
                return(IsSqlLikeMatch((string)value1, (string)values2[0]));

            case FilterOperator.NotEqual:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) != 0);

            case FilterOperator.GreaterThan:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) > 0);

            case FilterOperator.GreaterThanOrEqual:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) >= 0);

            case FilterOperator.LessThan:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) < 0);

            case FilterOperator.LessThanOrEqual:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) <= 0);

            case FilterOperator.TopN:
                _groupValue = values2[0];
                break;

            case FilterOperator.BottomN:
                _groupValue = values2[0];
                break;

            case FilterOperator.TopPercent:
                _groupValue = values2[0];
                break;

            case FilterOperator.BottomPercent:
                _groupValue = values2[0];
                break;

            case FilterOperator.In:
                foreach (object o in values2)
                {
                    if (Rdl.Runtime.Compare.CompareTo(value1, o) == 0)
                    {
                        return(true);
                    }
                }
                return(false);

            case FilterOperator.Between:
                return(Rdl.Runtime.Compare.CompareTo(value1, values2[0]) >= 0 &&
                       Rdl.Runtime.Compare.CompareTo(value1, values2[0]) <= 0);
            }
            return(false);
        }
示例#16
0
 public bool InitialState(Rdl.Runtime.Context context)
 {
     return(_initialState.ExecAsBoolean(context));
 }
示例#17
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);
        }
示例#18
0
        internal override int Render(Rdl.Render.Container box, Rdl.Runtime.Context context, Rdl.Runtime.Context rowContext, int column)
        {
            Rdl.Runtime.Context context1 = context.GetChildContext(null, null, _grouping, _sorting);

            bool hidden = false;

            if (_visibility != null && _visibility.ToggleItem == null)
            {
                hidden = _visibility.IsHidden(context1);
            }

            if (!hidden)
            {
                TextBox tb = Report.FindToggleItem(_visibility);

                if ((_subtotal != null && _subtotal.Position == Subtotal.PositionEnum.Before) ||
                    (tb != null && _subtotal == null))
                {
                    column = RenderSubtotal(box, context.Intersect(rowContext), hidden, (_subtotal == null) ? tb : null, column);
                }

                Rdl.Render.FlowContainer groupBox = null;
                if (box != null)
                {
                    groupBox      = box.AddFlowContainer(this, Style, context1, Rdl.Render.FlowContainer.FlowDirectionEnum.LeftToRight);
                    groupBox.Name = "DynamicColumnGroup";
                    groupBox.MatchParentHeight = true;
                }

                while (context1.GroupIndex < context1.GroupCount)
                {
                    Rdl.Render.FixedContainer groupEntryBox = null;
                    if (groupBox != null)
                    {
                        groupEntryBox = groupBox.AddFixedContainer(this, Style, context1);
                        groupEntryBox.MatchParentHeight = true;
                        if (tb != null)
                        {
                            tb.LinkedToggles.Add(new Toggle(groupEntryBox, tb));
                        }
                    }

                    // Put the column header text boxes into the column context and
                    // set the text element for any textboxes in the header of the column so that
                    // cells toggled on the header columns link to the correct boxes.
                    if (_headerTextElements.ContainsKey(column))
                    {
                        foreach (Rdl.Render.TextElement te in _headerTextElements[column])
                        {
                            context1.TextBoxes[((TextBox)te.ReportElement).Name] = (TextBox)te.ReportElement;
                            ((TextBox)te.ReportElement).Box = te;
                        }
                    }

                    // Render the details.
                    if (RenderNext != null)
                    {
                        if (RenderNext is ColumnGrouping)
                        {
                            column = ((ColumnGrouping)RenderNext).Render(groupEntryBox, context1, rowContext, column);
                        }
                        else
                        {
                            groupBox.Height = FindMatrix(this).Rows.Height;
                            RenderNext.Render(groupEntryBox, context1.Intersect(rowContext));
                            column++;
                        }
                    }

                    // Link the toggles at this context level with the linked elements contained.
                    context1.LinkToggles();
                    context1.NextGroup();
                }

                if (_subtotal != null && _subtotal.Position == Subtotal.PositionEnum.After)
                {
                    column = RenderSubtotal(box, context.Intersect(rowContext), hidden, null, column);
                }
            }

            return(column);
        }
示例#19
0
 public decimal GetDataValue(Rdl.Runtime.Context context, int seriesIndex, int catagoryIndex)
 {
     return(_chartData[seriesIndex].DataPoints[catagoryIndex].DataValues[0].ExecAsDecimal(context));
 }
示例#20
0
        internal override int RenderHeader(Rdl.Render.Container box, Rdl.Runtime.Context context, int column)
        {
            Rdl.Runtime.Context context1 = context.GetChildContext(
                null,
                null,
                _grouping,
                _sorting);

            bool hidden = false;

            if (_visibility != null && _visibility.ToggleItem == null)
            {
                hidden = _visibility.IsHidden(context1);
            }

            TextBox tb = Report.FindToggleItem(_visibility);

            if ((_subtotal != null && _subtotal.Position == Subtotal.PositionEnum.Before) ||
                (tb != null && _subtotal == null))
            {
                column = RenderSubTotalHeader(box, context, hidden, (_subtotal == null) ? tb : null, column);
            }

            while (context1.GroupIndex < context1.GroupCount && !hidden)
            {
                Rdl.Render.FlowContainer cell = box.AddFlowContainer(this, Style, context1, Rdl.Render.FlowContainer.FlowDirectionEnum.TopDown);
                cell.Name = "DynamicColumnHeader";
                cell.MatchParentHeight = true;

                Rdl.Render.FixedContainer contentBox = cell.AddFixedContainer(this, Style, context1);
                contentBox.Name              = "DynamicColumnContent";
                contentBox.Width             = FindMatrix(this).ColumnWidth;
                contentBox.Height            = _height.points;
                contentBox.MatchParentHeight = true;
                _reportItems.Render(contentBox, context1);

                if (tb != null)
                {
                    tb.LinkedToggles.Add(new Toggle(cell, tb));
                }

                // Save the text elements so we can link toggles in Render
                foreach (TextBox tb2 in context1.TextBoxes.Values)
                {
                    if (!_headerTextElements.ContainsKey(column))
                    {
                        _headerTextElements[column] = new List <Rdl.Render.TextElement>();
                    }
                    _headerTextElements[column].Add(tb2.TextElement);
                }

                if (RenderNext != null && RenderNext is ColumnGrouping)
                {
                    Rdl.Render.FlowContainer columnHeader = cell.AddFlowContainer(this, Style, context1, Rdl.Render.FlowContainer.FlowDirectionEnum.LeftToRight);
                    columnHeader.Name        = "ColumnGrouping";
                    columnHeader.ContextBase = true;

                    column = ((ColumnGrouping)RenderNext).RenderHeader(columnHeader, context1, column);
                }
                else
                {
                    contentBox.MatchParentHeight = true;
                    column++;
                }

                context1.LinkToggles();
                context1.NextGroup();
            }

            if (_subtotal != null && _subtotal.Position == Subtotal.PositionEnum.After)
            {
                column = RenderSubTotalHeader(box, context, hidden, tb, column);
            }

            return(column);
        }
示例#21
0
        public void Exec(System.Data.DataSet dsRet, string name, Rdl.Runtime.Context context)
        {
            DataSource ds = Report.DataSource(_dataSourceName);

            if (ds == null)
            {
                throw new Exception("Invalid DataSourceName " + _dataSourceName + " in DataSet " + ((DataSet)Parent).Name);
            }

            ds.Connect(context);

            if (ds.ConnectionProperties.DataProvider == "SQL")
            {
                System.Data.SqlClient.SqlCommand cmm =
                    ds.sqlConn.CreateCommand();

                switch (_commandType)
                {
                case CommandTypeEnum.Text:
                    cmm.CommandType = System.Data.CommandType.Text;
                    break;

                case CommandTypeEnum.StoredProcedure:
                    cmm.CommandType = System.Data.CommandType.StoredProcedure;
                    break;

                case CommandTypeEnum.TableDirect:
                    cmm.CommandType = System.Data.CommandType.TableDirect;
                    break;
                }

                cmm.CommandTimeout = _timeout;
                string commandText = _commandText.ExecAsString(context);

                foreach (QueryParameter parm in _queryParameters)
                {
                    object parmValue = parm.Value(context);
                    if (parmValue is Array)
                    {
                        int    i            = 0;
                        string parmNameList = string.Empty;

                        // For arrays build a list of parameters to pass to the database.
                        foreach (string s in (string[])parmValue)
                        {
                            System.Data.SqlClient.SqlParameter sqlParm =
                                new System.Data.SqlClient.SqlParameter(parm.Name + "_" + i.ToString(), s);
                            cmm.Parameters.Add(sqlParm);
                            parmNameList += ((parmNameList.Length == 0) ? string.Empty : ",") + parm.Name + "_" + (i++).ToString();
                        }

                        commandText = commandText.Replace(parm.Name, parmNameList);
                    }
                    else
                    {
                        if (parmValue == null)
                        {
                            parmValue = DBNull.Value;
                        }
                        System.Data.SqlClient.SqlParameter sqlParm =
                            new System.Data.SqlClient.SqlParameter(parm.Name, parmValue);
                        cmm.Parameters.Add(sqlParm);
                    }
                }


                cmm.CommandText = commandText;

                System.Data.SqlClient.SqlDataAdapter da =
                    new System.Data.SqlClient.SqlDataAdapter(cmm);

                if (dsRet.Tables[name] != null)
                {
                    dsRet.Tables[name].Clear();
                }
                da.Fill(dsRet, name);
            }

            ds.Close();
        }
示例#22
0
 public BorderStyleEnum Default(Rdl.Runtime.Context context)
 {
     return((_default == null) ? BorderStyleEnum.None : (BorderStyleEnum)Enum.Parse(typeof(BorderStyleEnum), _default.ExecAsString(context), true));
 }
示例#23
0
 public bool IsHidden(Rdl.Runtime.Context context)
 {
     return(_hidden.ExecAsBoolean(context));
 }
示例#24
0
 public BorderStyleEnum Top(Rdl.Runtime.Context context)
 {
     return((_top == null) ? Default(context) : (BorderStyleEnum)Enum.Parse(typeof(BorderStyleEnum), _top.ExecAsString(context), true));
 }
示例#25
0
        internal void DrawHorizontal(Chart chart,
                                     Rdl.Runtime.Context context,
                                     Graphics g,
                                     bool centered,
                                     int l, int t, int w, ref int h)
        {
            int majorIntervals = (int)((_maxValue - _minValue) / _majorIntervalValue);
            int minorIntervals = (int)((_maxValue - _minValue) / _minorIntervalValue);

            // Find the tick mark and axis position for the axis.
            int majorTickStart, majorTickHeight, minorTickStart, minorTickHeight, axisPos, axisWidth;

            AdjustAxisPosition(GetAxisThickness(context), out majorTickStart, out majorTickHeight,
                               out minorTickStart, out minorTickHeight,
                               out axisPos, out axisWidth);

            Color color        = Style.W32Color(Style.Color(context));
            Brush brush        = new SolidBrush(color);
            Pen   majorGridPen = new Pen(brush, 1);

            if (MajorGridLines != null)
            {
                majorGridPen = new Pen(new SolidBrush(Style.W32Color(MajorGridLines.Style.Color(context))),
                                       (int)MajorGridLines.Style.BorderWidth.Left(context).points);
            }
            Pen minorGridPen = new Pen(brush, 1);

            if (MinorGridLines != null)
            {
                minorGridPen = new Pen(new SolidBrush(Style.W32Color(MinorGridLines.Style.Color(context))),
                                       (int)MinorGridLines.Style.BorderWidth.Left(context).points);
            }

            Font  font            = Style.GetWindowsFont(context);
            bool  vertical        = false;
            float yMult           = (float)g.DpiY / 72;
            int   labelHeight     = 0;
            float majorEntryWidth = (float)w / majorIntervals;
            float minorEntryWidth = (float)w / minorIntervals;

            // Determine how much vertical space is required for the axis labels.
            if (Visible)
            {
                // Determine if the labels need to be vertical and find the height required for the labels.
                labelHeight = (int)(font.Height * yMult);

                // Determine the amount of space required for the axis labels.
                GetValueLableWidth(context, g, majorIntervals);

                if (_labelWidth > (int)majorEntryWidth)
                {
                    labelHeight = _labelWidth;
                    vertical    = true;
                }
            }

            // If we are showing the grid lines then adjust the tick width to include the whole chart area.
            if (MajorGridLines.ShowGridLines)
            {
                majorTickHeight = h - labelHeight - axisPos - majorTickStart;
            }
            if (MinorGridLines.ShowGridLines)
            {
                minorTickHeight = h - labelHeight - axisPos - minorTickStart;
            }

            // Fill in the background of the plot area.
            g.FillRectangle(new SolidBrush(Style.W32Color(chart.PlotAreaStyle.BackgroundColor(context))),
                            l, t, w, h - (labelHeight + axisWidth));

            // Draw the axis line
            g.DrawLine(new Pen(new SolidBrush(color), GetAxisThickness(context)),
                       new Point(l, t + h - labelHeight - axisPos - (GetAxisThickness(context) >> 1)),
                       new Point(l + w, t + h - labelHeight - axisPos - (GetAxisThickness(context) >> 1)));

            // Loop through the major interval values
            int left = l;

            for (int i = 0; i <= majorIntervals; i++)
            {
                left = l + (int)(i * majorEntryWidth);

                if (Visible)
                {
                    decimal dValue = _minValue + (i * _majorIntervalValue);

                    int center = left;
                    if (centered)
                    {
                        center += (int)(majorEntryWidth / 2);
                    }
                    SizeF size = g.MeasureString(dValue.ToString(), font);
                    if (vertical)
                    {
                        System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                        path.AddString(dValue.ToString(), font.FontFamily, (int)font.Style, font.Size * yMult,
                                       new Point(center - ((int)size.Width / 2), t + h - labelHeight),
                                       StringFormat.GenericDefault);
                        if (vertical)
                        {
                            System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
                            matrix.Translate(0 - (size.Width / 2), 0);
                            matrix.RotateAt(-30, new PointF(center, t + h - labelHeight), System.Drawing.Drawing2D.MatrixOrder.Append);
                            path.Transform(matrix);
                        }
                        g.DrawPath(new Pen(brush), path);
                    }
                    else
                    {
                        g.DrawString(dValue.ToString(), font, brush,
                                     center - (int)size.Width / 2, t + h - labelHeight, StringFormat.GenericDefault);
                    }
                }

                if (i > 0)
                {
                    // Draw the major tick mark
                    if (majorTickHeight > 0)
                    {
                        g.DrawLine(majorGridPen,
                                   new Point(left, t + h - labelHeight - (axisWidth >> 1) - majorTickStart),
                                   new Point(left, t + h - labelHeight - (axisWidth >> 1) - majorTickStart - majorTickHeight));
                    }

                    // Draw the minor tick marks
                    if (minorTickHeight > 0)
                    {
                        for (int j = 1; j < minorIntervals / majorIntervals; j++)
                        {
                            g.DrawLine(minorGridPen,
                                       new Point(left + (int)(j * minorEntryWidth), t + h - labelHeight - (axisWidth >> 1) + minorTickStart),
                                       new Point(left + (int)(j * minorEntryWidth), t + h - labelHeight - (axisWidth >> 1) + minorTickStart - minorTickHeight));
                        }
                    }
                }
            }

            h -= labelHeight + ((axisWidth + GetAxisThickness(context)) >> 1);
        }
示例#26
0
 public BorderStyleEnum Bottom(Rdl.Runtime.Context context)
 {
     return((_bottom == null) ? Default(context) : (BorderStyleEnum)Enum.Parse(typeof(BorderStyleEnum), _bottom.ExecAsString(context), true));
 }
示例#27
0
 public virtual Categories GetCategories(Rdl.Runtime.Context context, Category parentCategory)
 {
     return(null);
 }
示例#28
0
        public Cell AddCell(int row, int column, Rdl.Engine.ReportElement reportElement, Rdl.Engine.Style style, Rdl.Runtime.Context context)
        {
            Cell cell = new Cell(this, reportElement, new BoxStyle(style, context));

            Rows[row].Cells.Add(cell);
            _childElements.Add(cell);
            Columns[column].Cells.Add(cell);
            cell.Row                = row;
            cell.Column             = column;
            cell.Width              = Columns[column].Width;
            cell.Height             = Rows[row].Height;
            cell.Name               = "Cell";
            cell.CanGrowHorizonally = false;

            return(cell);
        }
示例#29
0
 protected override void Render2(Rdl.Runtime.Context context)
 {
 }
示例#30
0
 internal abstract int Render(Rdl.Render.Container box, Rdl.Runtime.Context context, Rdl.Runtime.Context rowContext, int column);