Ejemplo n.º 1
0
 private void dashboard_CustomExport(object sender, CustomExportWebEventArgs e)
 {
     if (CustomExport != null)
     {
         Application.Update(this, () =>
         {
             CustomExport(sender, e);
         });
     }
 }
        public static void CustomExport(CustomExportWebEventArgs e)
        {
            Dictionary <string, XRControl> controls = e.GetPrintableControls();

            foreach (var control in controls)
            {
                string             componentName = control.Key;
                XRChart            chartControl  = control.Value as XRChart;
                ChartDashboardItem chartItem     = e.GetDashboardItem(componentName) as ChartDashboardItem;
                if (chartControl != null && chartItem != null)
                {
                    string constantLinesJSON = chartItem.CustomProperties["ConstantLineSettings"];
                    if (constantLinesJSON != null)
                    {
                        XYDiagram diagram = chartControl.Diagram as XYDiagram;
                        if (diagram != null)
                        {
                            List <CustomConstantLine> customConstantLines = JsonConvert.DeserializeObject <List <CustomConstantLine> >(constantLinesJSON);
                            customConstantLines.ForEach(customConstantLine =>
                            {
                                ConstantLine line        = new ConstantLine();
                                line.Visible             = true;
                                line.ShowInLegend        = false;
                                line.Color               = ColorTranslator.FromHtml(customConstantLine.color);
                                line.Title.Text          = customConstantLine.labelText;
                                line.LineStyle.DashStyle = DashStyle.Dash;
                                line.LineStyle.Thickness = 2;
                                if (customConstantLine.isBound)
                                {
                                    MultiDimensionalData data = e.GetItemData(componentName);
                                    MeasureDescriptor measure = data.GetMeasures().FirstOrDefault(m => m.ID == customConstantLine.measureId);
                                    if (measure != null)
                                    {
                                        line.AxisValue = data.GetValue(measure).Value;
                                    }
                                }
                                else
                                {
                                    line.AxisValue = customConstantLine.value;
                                }


                                if (diagram.SecondaryAxesY.Count > 0)
                                {
                                    diagram.SecondaryAxesY[0].ConstantLines.Add(line);
                                }
                            });
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void ASPxDashboard1_CustomExport(object sender, CustomExportWebEventArgs e)
        {
            XtraReport     report     = e.Report as XtraReport;
            PageHeaderBand headerBand = new PageHeaderBand();

            report.Bands.Add(headerBand);

            XRPictureBox icon = new XRPictureBox();

            icon.ImageUrl = Server.MapPath(@"~/App_Data/Images/dxlogo.png");
            icon.HeightF  = 50;
            icon.WidthF   = 300;
            headerBand.Controls.Add(icon);

            XRLabel customHeader = new XRLabel();

            customHeader.Text   = "Additioanl Header Text";
            customHeader.LeftF  = 300;
            customHeader.WidthF = 300;
            headerBand.Controls.Add(customHeader);

            XRPageInfo dateInfo = new XRPageInfo();

            dateInfo.PageInfo = PageInfo.DateTime;
            dateInfo.Format   = "Created at {0:h:mm tt dd MMMM yyyy}";
            dateInfo.TopF     = 100;
            dateInfo.WidthF   = 200;
            headerBand.Controls.Add(dateInfo);

            XRPageInfo userInfo = new XRPageInfo();

            userInfo.PageInfo = PageInfo.UserName;
            userInfo.Format   = "Current User: {0}";
            userInfo.TopF     = 100;
            userInfo.LeftF    = 250;
            userInfo.WidthF   = 200;
            headerBand.Controls.Add(userInfo);

            PageFooterBand footerBand = new PageFooterBand();

            report.Bands.Add(footerBand);
            XRPageInfo pageInfo = new XRPageInfo();

            pageInfo.Format = "Page {0} of {1}";
            footerBand.Controls.Add(pageInfo);
        }