void CustomizePieTotalLabel(string componentName, MultiDimensionalData data, CustomizePieTotalLabelEventArgs e)
        {
            PieTotalSettings settings   = PieTotalSettings.FromJson(dashboardControl.Dashboard.Items[componentName].CustomProperties[customPropertyName]);
            string           resultText = string.Empty;

            if (!string.IsNullOrEmpty(settings.Prefix))
            {
                resultText += settings.Prefix + Environment.NewLine;
            }



            MeasureDescriptor measure = data.GetMeasures().First();

            if (!string.IsNullOrEmpty(settings.MeasureId) ||
                data.GetMeasures().Where(m => m.ID == settings.MeasureId).Any())
            {
                measure = data.GetMeasures().FirstOrDefault(m => m.ID == settings.MeasureId);
            }
            if (measure != null)
            {
                AxisPoint axisPoint = e.Series.Tag as AxisPoint;
                resultText += data.GetSlice(axisPoint).GetValue(measure).DisplayText;
            }
            if (!string.IsNullOrEmpty(settings.Postfix))
            {
                resultText += Environment.NewLine + settings.Postfix;
            }
            e.Text = resultText;
        }
コード例 #2
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());
        }
        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);
                                }
                            });
                        }
                    }
                }
            }
        }