private void DrawSeriesBars( Chart chart, Rdl.Runtime.Context context, Graphics g, int l, int t, int w, int h, decimal minValue, decimal maxValue, int categoryIndex) { int i = 0; int bot = h; decimal seriesTotal = 0; if (chart.SubType == Chart.SubtypeEnum.PercentStacked) { foreach (Series ser in chart.LeafSeriesList) { seriesTotal += chart.GetDataValue(context.Intersect(ser.Context), ser.SeriesIndex, categoryIndex); } } foreach (Series ser in chart.LeafSeriesList) { decimal value = chart.GetDataValue(context.Intersect(ser.Context), ser.SeriesIndex, categoryIndex); int height; Brush brush = new SolidBrush(chart.SeriesColor(ser.CombinedValue)); if (chart.SubType == Chart.SubtypeEnum.Plain) { height = (int)(h * (value - minValue) / (maxValue - minValue)); DrawBar(g, l, t + bot - height, w / chart.LeafSeriesList.Count, height, brush, 1); l += w / chart.LeafSeriesList.Count; } if (chart.SubType == Chart.SubtypeEnum.Stacked) { height = (int)(h * (value - minValue) / (maxValue - minValue)); DrawBar(g, l, t + bot - height, w, height, brush, 1); bot -= height; } if (chart.SubType == Chart.SubtypeEnum.PercentStacked) { height = (int)(h * value / seriesTotal); DrawBar(g, l, t + bot - height, w, height, brush, 1); bot -= height; } i++; } }
private void DrawLine( Chart chart, Rdl.Runtime.Context context, Graphics g, Brush brush, int seriesIndex, int l, int t, int w, int h, decimal minValue, decimal maxValue) { int lastX = 0; int lastY = 0; bool firstValue = true; if (chart.Categories != null) { foreach (Category cat in chart.LeafCategories) { Rdl.Runtime.Context ctxt = context.Intersect(cat.Context); if (ctxt.Rows.Count == 0) { firstValue = true; } else { decimal value = chart.GetDataValue(ctxt, seriesIndex, cat.CategoryIndex); int height = (int)(h * (value - minValue) / (maxValue - minValue)); g.FillEllipse(brush, new System.Drawing.Rectangle(l - 3, t + h - height - 3, 6, 6)); if (!firstValue) { g.DrawLine(new Pen(brush, 1), new Point(lastX, lastY), new Point(l, t + h - height)); } lastY = t + h - height; lastX = l; firstValue = false; } l += (w / (chart.CategoryAxis.TotalCategories - 1)); } } }
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); }
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); }