Esempio n. 1
0
 private void AddStatistics(TemplateDynamicData property)
 {
     var chart1 = new DevExpress.XtraReports.UI.XRChart();
     this.xrChart1.BorderColor = System.Drawing.Color.Black;
     this.xrChart1.Borders = DevExpress.XtraPrinting.BorderSide.None;
     this.xrChart1.LocationFloat = new DevExpress.Utils.PointFloat(184.375F, 0F);
     this.xrChart1.Name = "xrChart1";
     this.Detail.Controls.Add(chart1);
 }
Esempio n. 2
0
        private XRControl AddTextfield(TemplateDynamicData property, float yPosition, float xPosition)
        {
            float fontSize = 0.1f;
            FontStyle fontStyle = FontStyle.Regular;
            var xrLabelTextField = new DevExpress.XtraReports.UI.XRLabel();
            xrLabelTextField.LocationFloat = new DevExpress.Utils.PointFloat(xPosition, yPosition);
            xrLabelTextField.Name = "xrLabel1" + Guid.NewGuid();

            xrLabelTextField.Padding = new DevExpress.XtraPrinting.PaddingInfo(10, 2, 0, 0, 96F);
            xrLabelTextField.SizeF = new System.Drawing.SizeF(633, 20F);
            xrLabelTextField.Text = string.Empty;

            if (property.Text != null)
                xrLabelTextField.Text = property.Text.Text;
            else
                property.Text = new TextField { Text = "", Size = TextFieldFontSize.Normal };

            xrLabelTextField.AutoWidth = true;
            xrLabelTextField.CanGrow = true;
            xrLabelTextField.CanShrink = true;
            xrLabelTextField.Multiline = true;

            if (property.Text != null)
            {
                if (property.Text.Text != null)
                {
                    xrLabelTextField.Text = property.Text.Text;

                    if (property.Text.Size == TextFieldFontSize.Small)
                        fontSize = 8F;
                    else if (property.Text.Size == TextFieldFontSize.Normal)
                        fontSize = 10F;
                    else if (property.Text.Size == TextFieldFontSize.Large)
                        fontSize = 14F;

                    if (property.Text.Style == TextFieldFontStyle.Bold)
                        fontStyle = FontStyle.Bold;
                    else if (property.Text.Style == TextFieldFontStyle.Italic)
                        fontStyle = FontStyle.Italic;
                    else if (property.Text.Style == TextFieldFontStyle.BoldItalic)
                        fontStyle = FontStyle.Bold | FontStyle.Italic;
                }
            }
            xrLabelTextField.Font = new System.Drawing.Font("Microsoft Sans Serif", fontSize, fontStyle);
            //xrLabelTextField.Font = new System.Drawing.Font("Tahoma", fontSize, fontStyle);
            //xrLabelTextField.Font = new System.Drawing.Font("Tahoma", 8F, FontStyle.Bold);
            xrLabelTextField.StylePriority.UseFont = false;
            return xrLabelTextField;
        }
Esempio n. 3
0
        private XRControl AddStatistics(TemplateProperty template, TemplateDynamicData property, float yPosition, float xPosition)
        {
            var chart1 = new XRChart();
            var pieSeriesView1 = new DevExpress.XtraCharts.PieSeriesView();
            pieSeriesView1.RuntimeExploding = false;
            chart1.BorderColor = Color.Black;
            chart1.Borders = DevExpress.XtraPrinting.BorderSide.None;
            chart1.LocationFloat = new DevExpress.Utils.PointFloat(xPosition, yPosition);
            chart1.Name = "xrChart1" + Guid.NewGuid();

            //chart1.Titles.Add(new DevExpress.XtraCharts.ChartTitle { Text= });
            var series1 = new DevExpress.XtraCharts.Series();
            chart1.Series.Add(series1);

            series1.View = pieSeriesView1;

            var pieSeriesLabel1 = series1.Label as DevExpress.XtraCharts.PieSeriesLabel;
            pieSeriesLabel1.LineVisible = true;
            pieSeriesLabel1.Position = DevExpress.XtraCharts.PieSeriesLabelPosition.TwoColumns;
            chart1.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.LeftOutside;
            chart1.Legend.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.Top;

            //this is the label with lines connected to the pie chart
            var piePointOptions1 = pieSeriesLabel1.PointOptions as DevExpress.XtraCharts.PiePointOptions;
            piePointOptions1.PointView = DevExpress.XtraCharts.PointView.Values;
            piePointOptions1.PercentOptions.ValueAsPercent = false;
            piePointOptions1.ValueNumericOptions.Format = DevExpress.XtraCharts.NumericFormat.Number;
            piePointOptions1.ValueNumericOptions.Precision = 0;

            // this is the label with the name and value
            var piePointOptions2 = series1.LegendPointOptions as DevExpress.XtraCharts.PiePointOptions;
            piePointOptions2.PointView = DevExpress.XtraCharts.PointView.ArgumentAndValues;
            piePointOptions2.ValueNumericOptions.Format = DevExpress.XtraCharts.NumericFormat.Percent;
            piePointOptions2.ValueNumericOptions.Precision = 0;
            piePointOptions2.PercentOptions.ValueAsPercent = true;
            piePointOptions2.Pattern = "{V} : {A} ";

            //sorting by argument or by value
            PercentageValueSortingOption sortby = property.Statistics.PercentageValueSortBy;
            if (sortby == null ||
                sortby == PercentageValueSortingOption.PercentageDescending)
            {
                series1.SeriesPointsSorting = DevExpress.XtraCharts.SortingMode.Descending;
                series1.SeriesPointsSortingKey = DevExpress.XtraCharts.SeriesPointKey.Value_1;
            }
            else if (sortby == PercentageValueSortingOption.PercentageAscending)
            {
                series1.SeriesPointsSorting = DevExpress.XtraCharts.SortingMode.Ascending;
                series1.SeriesPointsSortingKey = DevExpress.XtraCharts.SeriesPointKey.Value_1;
            }
            else if (sortby == PercentageValueSortingOption.ValueDescending)
            {
                series1.SeriesPointsSorting = DevExpress.XtraCharts.SortingMode.Descending;
                series1.SeriesPointsSortingKey = DevExpress.XtraCharts.SeriesPointKey.Argument;
            }
            else if (sortby == PercentageValueSortingOption.ValueAscending)
            {
                series1.SeriesPointsSorting = DevExpress.XtraCharts.SortingMode.Ascending;
                series1.SeriesPointsSortingKey = DevExpress.XtraCharts.SeriesPointKey.Argument;
            }

            //set the data base on the statistics.data
            property.Statistics.Data = GetetStatisticsData(template, property.Statistics);

            //add data to the charts
            int cnt = 0;

            var sorted = property.Statistics.Data.OrderBy(e => e.Value);
            foreach (var item in sorted)
            {

                var seriesPoint1 = new DevExpress.XtraCharts.SeriesPoint(item.Key, new object[] { ((object)(item.Value)) }, cnt);
                cnt++;
                series1.Points.Add(seriesPoint1);
            }

            if (!string.IsNullOrEmpty(property.Statistics.ChartTitle))
            {
                DevExpress.XtraCharts.ChartTitle newChartTitle = new DevExpress.XtraCharts.ChartTitle { Text = property.Statistics.ChartTitle };
                newChartTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold);
                newChartTitle.Alignment = StringAlignment.Near;
                newChartTitle.Dock = DevExpress.XtraCharts.ChartTitleDockStyle.Top;
                chart1.Titles.Add(newChartTitle);
            }

            //Add total items
            int totalCategory = property.Statistics.Data.Count;

            if (property.Statistics.IsTotalCountVisible)
            {
                int totalCount = GetTotalItems(property.Statistics.Data);
                DevExpress.XtraCharts.ChartTitle totalitems = new DevExpress.XtraCharts.ChartTitle { Text = "Total items: " + totalCount };
                totalitems.Font = new System.Drawing.Font("Tahoma", 8F, FontStyle.Bold);
                totalitems.Alignment = StringAlignment.Near;
                totalitems.Dock = DevExpress.XtraCharts.ChartTitleDockStyle.Bottom;
                chart1.Titles.Add(totalitems);
            }
            //chart1.SizeF = new System.Drawing.SizeF(505.2083F, 100 + (totalCategory * 60));
            if (property.Statistics.GraphSize == GraphSize.Small)
                chart1.SizeF = new System.Drawing.SizeF(505.2083F, 300);
            else if (property.Statistics.GraphSize == GraphSize.Normal)
                chart1.SizeF = new System.Drawing.SizeF(505.2083F, 500);
            else if (property.Statistics.GraphSize == GraphSize.Large)
                chart1.SizeF = new System.Drawing.SizeF(505.2083F, 700);
            return chart1;
        }
Esempio n. 4
0
 private XRControl AddPageBreak(TemplateDynamicData property, float yPosition)
 {
     var xrPageBreak1 = new DevExpress.XtraReports.UI.XRPageBreak();
     xrPageBreak1.LocationFloat = new DevExpress.Utils.PointFloat(0F, yPosition);
     xrPageBreak1.Name = "xrPageBreak1" + Guid.NewGuid();
     return xrPageBreak1;
 }
Esempio n. 5
0
        private void btnAddLayoutSetting_Click(object sender, EventArgs e)
        {
            TemplateDynamicData templateDynamic = null;
            if (templateData.DynamicProperty == null)
            {
                templateData.DynamicProperty = new List<TemplateDynamicData>();
            }

            switch (cboLayoutElement.EditValue.ToString())
            {
                case "Page Break":
                    templateDynamic = new TemplateDynamicData() { Type = TemplateDynamicType.PageBreak, IsVisible = true };
                    reportTemplatePropertyGrid1.AddPageBreak(templateDynamic);
                    break;
                case "Text Field":
                    templateDynamic = new TemplateDynamicData
                    {
                        Type = TemplateDynamicType.TextField,
                        IsVisible = true,
                        Text = new TextField { Size = TextFieldFontSize.Normal, Style = TextFieldFontStyle.None }
                    };
                    reportTemplatePropertyGrid1.AddTextField(templateDynamic);
                    break;
                case "Statistical Component":
                    templateDynamic = new TemplateDynamicData
                    {
                        Type = TemplateDynamicType.Statistics,
                        IsVisible = true,
                        Statistics = new StatisticsTemplate
                        {
                            IsNullCategoryVisible = true,
                            IsTotalCountVisible = true,
                            GraphSize = GraphSize.Normal,
                            PercentageValueSortBy = PercentageValueSortingOption.PercentageAscending
                        }
                    };
                    reportTemplatePropertyGrid1.AddStatistics(templateDynamic);
                    break;
            }
        }
Esempio n. 6
0
 private void AddTextfield(TemplateDynamicData property)
 {
 }
Esempio n. 7
0
 private void AddPageBreak(TemplateDynamicData property)
 {
 }