public void AddTagesmitteltemperaturen(object chartData, List<Zeitraum> zeitraums ) { var periods = zeitraums.OrderByDescending(p => p.Start).GetFormatted(true); this.CreateHeading("3. Tagesmitteltemperaturen³ des gewählten Abrechnungszeitraumes und des Vorjahres"); ICanvas legendCanvas = default(ICanvas); IText text = default(IText); // Add grid IGrid grid = this.currentBand.AddGrid(); GridCellPattern cellPattern = new GridCellPattern(); cellPattern.Alignment = new ContentAlignment(Alignment.Left, Alignment.Middle); // Grid pattern for borders around block GridPattern gridPattern = new GridPattern(); gridPattern.Borders = new Borders(new Pen(new Color(0, 0, 0))); gridPattern.Paddings.All = 10; gridPattern.Apply(grid); IGridColumn column = grid.AddColumn(); IGridRow gridRow = grid.AddRow(); IGridCell gridCell = gridRow.AddCell(); //Add Legend gridCell.Alignment = new ContentAlignment(Alignment.Center, Alignment.Middle); IGrid legendGrid = gridCell.AddGrid(); IGridCell legendCell; legendGrid.Width = new FixedWidth(450); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); gridRow = legendGrid.AddRow(); //1 Period legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Paddings.All = 0; legendCanvas.Margins.All = 0; legendCanvas.Height = new FixedHeight(5); legendCanvas.Pen = new Pen(new Color(65, 69, 120), 2); legendCanvas.DrawLine(0, 2.5f, 5, 2.5f); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(periods[0]); //2 Period legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Height = new FixedHeight(5); legendCanvas.Pen = new Pen(new Color(204, 76, 24), 2); legendCanvas.DrawLine(0, 2.5f, 5, 2.5f); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(periods[1]); //Ausgangbasis legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Height = new FixedHeight(5); legendCanvas.Pen = new Pen(Colors.Green, 2); legendCanvas.DrawLine(0, 2.5f, 5, 2.5f); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent("Heizgrenztemperatur"); //text.AddContent("Heizgrenztemperatur⁴"); //Add Chart //chartData.Columns("Heizgrenztemperatur").ColumnName = "Heizgrenztemperatur³" gridRow = grid.AddRow(); gridCell = gridRow.AddCell(); ICanvas canvas = gridCell.AddCanvas(); //Me.currentBand.AddCanvas() canvas.Width = new FixedWidth(530); canvas.Height = new FixedHeight(300); using (System.Drawing.Graphics g = canvas.CreateGraphics()) { using (UltraChart myChart = new UltraChart()) { TemperaturChart.GetChart(myChart, chartData, 530, 300); myChart.Legend.Visible = false; myChart.RenderPdfFriendlyGraphics(g); } } //this.currentBand.AddStretcher(); }
public void AddJahresbetrachtung( MeteoGtzYear meteoGtzYear) { this.CreateHeading("1. Jahresbetrachtung der heizwirksamen Temperatur des aktuellen Jahres im Vergleich zu den Vorjahren und Langzeitmittel²"); // Add grid IGrid grid = this.currentBand.AddGrid(); IText text; Style textStyle = new Style(this.pdfFonts[PdfFont.DefaultNormalReg], Brushes.Black); Style headerStyle = new Style(this.pdfFonts[PdfFont.DefaultNormalBold], Brushes.Black); // Grid pattern for borders around block var gridPattern = new GridPattern { Borders = new Borders(new Pen(Colors.Black)), Paddings = { All = 10 } }; gridPattern.Apply(grid); var column = grid.AddColumn(); var gridRow = grid.AddRow(); var gridCell = gridRow.AddCell(); GridCellPattern cellPattern = new GridCellPattern { Alignment = new ContentAlignment(Alignment.Center, Alignment.Middle), Paddings = { Left = 10, Bottom = 0 } }; //cellPattern.Apply(gridCell); //text = gridCell.AddText(); //text.Style.Font = pdfFonts[PdfFont.DefaultNormalReg]; //text.AddContent("Alle Angaben sind immer konkret bezogen auf die getroffene Auswahl hinsichtlich Abrech-nungszeitraum (Stichtag) " + "und die ausgewählte Region. Basis sind dabei immer die Tages-mitteltemperaturen. Betrachtet werden immer " + "ganzjährige Abrechnungszeiträume."); //text.AddLineBreak(); //text.AddLineBreak(); //Add Chart gridRow = grid.AddRow(); gridCell = gridRow.AddCell(); ICanvas canvas = gridCell.AddCanvas(); canvas.Width = new FixedWidth(440); canvas.Height = new FixedHeight(190); using (System.Drawing.Graphics g = canvas.CreateGraphics()) { UltraChart myChart = JahresbetrachtungChart.GetChart(meteoGtzYear, 440, 190, true); //myChart.ColumnChart.ChartText(0).Visible = True myChart.Legend.Visible = false; myChart.RenderPdfFriendlyGraphics(g); } gridRow = grid.AddRow(); gridCell = gridRow.AddCell(); cellPattern.Apply(gridCell); text = gridCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; //text.Paddings.Top = 5; var relativeData = meteoGtzYear.ToRelativeData(); double vorjahrBedarf = relativeData.Period2; double lgtzBedarf = relativeData.Lgtz; var vorjahrBedarfText = string.Format( @"In der gewählten Region war es im gleichen Zeitraum des Vorjahres {0}% {1} als im betrachteten Zeiraum des aktuellen Jahres. Entsprechend ist im aktuellen Jahr im Vergleich zum Vorjahreszeitraum mit einem Heiz{2}bedarf zu rechnen.", Math.Abs(Math.Round(vorjahrBedarf, 2)), (vorjahrBedarf > 0 ? "wärmer" : "kälter"), (vorjahrBedarf > 0 ? "mehr" : "minder")); var lgtzBedarfText = string.Format("In der gewählten Region ist das Langzeitmittel {0}% {1} als das aktuelle Jahr.", Math.Abs(Math.Round(lgtzBedarf, 2)), (lgtzBedarf > 0 ? "wärmer" : "kälter")); //text.AddLineBreak(); text.AddContent(vorjahrBedarfText); text.AddLineBreak(); text.AddLineBreak(); text.AddContent(lgtzBedarfText); }
public void AddMonatsbetrachtung(DataTable chartData, List<Zeitraum> zeitraums) { if ((chartData == null)) { return; } //Dummy Column für Legende Langzeitmittel var columnDummy = new DataColumn { DataType = typeof(double) }; chartData.Columns.Add(columnDummy); var periods = zeitraums.OrderByDescending(p => p.Start).GetFormatted(true); this.CreateHeading("2. Monatsbetrachtung der Temperatur des aktuellen Jahres im Vergleich zum Vorjahr und Langzeitmittel²"); //Dim flow As Infragistics.Documents.Report.Flow.IFlow = currentBand.AddFlow() //flow.Borders.All = New Border(New Pen(Colors.Black)) IText text ; ICanvas legendCanvas; // Add grid IGrid grid = this.currentBand.AddGrid(); // Grid pattern for borders around block GridPattern gridPattern = new GridPattern { Borders = new Borders(new Pen(Colors.Black)), Paddings = { All = 10 } }; gridPattern.Apply(grid); IGridColumn column = grid.AddColumn(); IGridRow gridRow = grid.AddRow(); IGridCell gridCell = gridRow.AddCell(); GridCellPattern cellPattern = new GridCellPattern { Alignment = new ContentAlignment(Alignment.Left, Alignment.Middle) }; //cellPattern.Borders = New Borders(New Pen(New Color(0, 0, 0))) //cellPattern.Paddings.All = 0 //Add Legend gridCell.Alignment = new ContentAlignment(Alignment.Center, Alignment.Middle); IGrid legendGrid = gridCell.AddGrid(); IGridCell legendCell; legendGrid.Width = new FixedWidth(450); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); column = legendGrid.AddColumn(); column.Width = new FixedWidth(7); column = legendGrid.AddColumn(); gridRow = legendGrid.AddRow(); //Vorjahr legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Paddings.All = 0; legendCanvas.Margins.All = 0; legendCanvas.Height = new FixedHeight(5); legendCanvas.Brush = new SolidColorBrush(new Color(0, 76, 148)); legendCanvas.DrawRectangle(0, 0, 5, 5, PaintMode.FillStroke); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(periods[0]); //Langzeitmittel legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Height = new FixedHeight(5); legendCanvas.Brush = new SolidColorBrush(new Color(236, 98, 42)); legendCanvas.DrawRectangle(0, 0, 5, 5, PaintMode.FillStroke); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(periods[1]); //Ausgangbasis legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); legendCanvas = legendCell.AddCanvas(); legendCanvas.Width = new FixedWidth(5); legendCanvas.Height = new FixedHeight(5); legendCanvas.Pen = new Pen(Colors.Green, 2); legendCanvas.DrawLine(0, 2.5f, 5, 2.5f); legendCell = gridRow.AddCell(); cellPattern.Apply(legendCell); text = legendCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent("Langzeitmittel (Nulllinie)"); //Add Chart gridRow = grid.AddRow(); gridCell = gridRow.AddCell(); ICanvas canvas = gridCell.AddCanvas(); //Me.currentBand.AddCanvas() canvas.Width = new FixedWidth(500); canvas.Height = new FixedHeight(250); using (System.Drawing.Graphics g = canvas.CreateGraphics()) { UltraChart myChart = MonatsRelativeVerteilungJahrChart.GetChart(chartData, 500, 250, periods.ToArray()); //myChart.ColumnChart.ChartText(0).Visible = True myChart.Legend.Visible = false; myChart.RenderPdfFriendlyGraphics(g); } //gridCell.AddStretcher() //Add Info GridCellPattern cellPattern2 = new GridCellPattern { Paddings = { Left = 10, Bottom = 0 } }; gridRow = grid.AddRow(); gridCell = gridRow.AddCell(); cellPattern2.Apply(gridCell); DataRow row = chartData.Rows[chartData.Rows.Count - 1]; try { string monat = Utils.GetMonthName(row["Monat"].ConvertTo<int>(), "MMMM"); double VorjahrBedarf = row.Field<double>("Vorjahr"); double aktuellJqahr = row.Field<double>("Aktuelljahr"); text = gridCell.AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; //text.Paddings.Top = 10 text.AddLineBreak(); text.AddContent("Das Langzeitmittel stellt die Nulllinie dar."); text.AddLineBreak(); text.AddLineBreak(); text.AddContent("Negativer Prozentwert (Balken zeigt nach unten): in dem jeweiligen Monat des Vorjahres / aktuellen Jahres war es kälter als im gleichen Monat des Langzeitmittels."); text.AddLineBreak(); text.AddLineBreak(); text.AddContent("Positiver Prozentwert (Balken zeigt nach oben): in dem jeweiligen Monat des Vorjahres / aktuellen Jahres war es wärmer als im gleichen Monat des Langzeitmittels."); text.AddLineBreak(); text.AddLineBreak(); text.AddContent(string.Format("Für die gewählte Region war es - bezogen auf das Langzeitmittel im Monat {0}", monat)); IQuickList list = gridCell.AddQuickList(); list.Margins.Bottom = 0; list.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; list.Interval = 1; list.AddItem(string.Format("des Vorjahres ca. {0}% {1}", Math.Abs(Math.Round(VorjahrBedarf, 2)), (VorjahrBedarf > 0 ? "wärmer" : "kälter"))); list.AddItem(string.Format("des aktuellen Jahres ca. {0}% {1}", Math.Abs(Math.Round(aktuellJqahr, 2)), (aktuellJqahr > 0 ? "wärmer" : "kälter"))); //gridCell.AddStretcher(); } catch (Exception ex) { } this.currentBand.AddStretcher(); }
public void AddHeader(DateTime startDate, string requestText, string logoPath) { // Add a repeating band header to the main band IBandHeader bandHeader = this.currentBand.Header; // Header settings bandHeader.Repeat = true; bandHeader.Height = new FixedHeight(80); bandHeader.Alignment = new ContentAlignment(Alignment.Left, Alignment.Middle); var logo = new Image(logoPath); logo.Preferences.Compressor = ImageCompressors.Flate; //' Add a grid to header IGrid grid = bandHeader.AddGrid(); // Arrays for columns and cells IGridColumn[] headerColumn = new IGridColumn[5]; IGridCell[] headerGridCell = new IGridCell[4]; // Add two columns to the grid headerColumn[0] = grid.AddColumn(); //headerColumn[0].Width = new FixedWidth(270); headerColumn[1] = grid.AddColumn(); headerColumn[1].Width = new FixedWidth(20); headerColumn[2] = grid.AddColumn(); headerColumn[2].Width = new FixedWidth(270); // Add one row to the grid IGridRow gridRow = grid.AddRow(); headerGridCell[1] = gridRow.AddCell(); IGrid dataGrid = headerGridCell[1].AddGrid(); var dataGridheaderColumn = dataGrid.AddColumn(); dataGridheaderColumn.Width = new FixedWidth(150); dataGrid.AddColumn(); GridCellPattern dataCellPattern = new GridCellPattern(); dataCellPattern.Alignment = new ContentAlignment(Alignment.Center, Alignment.Middle); dataCellPattern.Paddings.Left = 5; dataCellPattern.Paddings.Bottom = 10; var dataGridRow = dataGrid.AddRow(); IText text ; headerGridCell[0] = dataGridRow.AddCell(); dataCellPattern.Apply(headerGridCell[0]); text = headerGridCell[0].AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent("Ende Abrechnungszeitraum (Stichtag)"); headerGridCell[1] = dataGridRow.AddCell(); dataCellPattern.Apply(headerGridCell[1]); text = headerGridCell[1].AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(startDate.ToShortDateString()); dataGridRow = dataGrid.AddRow(); headerGridCell[0] = dataGridRow.AddCell(); dataCellPattern.Apply(headerGridCell[0]); text = headerGridCell[0].AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent("Region"); headerGridCell[1] = dataGridRow.AddCell(); dataCellPattern.Apply(headerGridCell[1]); text = headerGridCell[1].AddText(); text.Style.Font = this.pdfFonts[PdfFont.DefaultNormalReg]; text.AddContent(requestText); // Add grid cell for logo gridRow.AddCell(); headerGridCell[0] = gridRow.AddCell(); //cellPattern.Apply(headerGridCell(0)) headerGridCell[0].Alignment = ContentAlignment.Right; headerGridCell[0].AddImage(logo); //gridRow.AddCell(); //'cellPattern.Apply(headerGridCell(1)) //'headerGridCell(1).ColSpan = 1 //Dim headingText As IText = headerGridCell(1).AddText() //headingText.Style.Font = pdfFonts(PdfFont.DefaultSmallReg) //headingText.AddContent(requestText) }