Пример #1
0
        private static string GetOid(DashboardItemMouseActionEventArgs e)
        {
            MultiDimensionalData data         = e.Data.GetSlice(e.GetAxisPoint());
            MeasureDescriptor    descriptor   = data.GetMeasures().SingleOrDefault(item => item.DataMember == "Oid");
            MeasureValue         measureValue = data.GetValue(descriptor);

            return(measureValue.Value.ToString());
        }
        private void DashboardViewer1_CustomizeDashboardItemCaption(object sender, CustomizeDashboardItemCaptionEventArgs e)
        {
            DashboardViewer viewer = (DashboardViewer)sender;

            if (e.DashboardItemName == "pieDashboardItem1")
            {
                DashboardToolbarItem infoButton = new DashboardToolbarItem();
                MultiDimensionalData mData      = viewer.GetItemData(e.DashboardItemName);
                var orderCount = mData.GetValue(mData.GetMeasures().Where(m => m.DataMember == "OrderID").First()).Value ?? 0;
                e.FilterText += string.Format("{0:N0} distinct orders are displayed", orderCount);
            }
        }
        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);
                                }
                            });
                        }
                    }
                }
            }
        }