コード例 #1
0
        public SCChart SetPieSeriesTotalLabel(string seriesName, TotalLabelOptions options = null)
        {
            DevExpress.XtraCharts.Series series;
            if (string.IsNullOrWhiteSpace(seriesName))
            {
                series = CurrentSeries;
            }
            else
            {
                series = Chart.Series[seriesName];
            }
            if (series == null)
            {
                throw new Exception($"Cannot find series '{seriesName}'.");
            }

            if (series.View is not PieSeriesView pieSeriesView)
            {
                throw new Exception($"Series '{seriesName} is not Pie series.");
            }

            options ??= new TotalLabelOptions();
            options.SetupXtraChartTotalLabel(this, pieSeriesView.TotalLabel);

            return(this);
        }
コード例 #2
0
        public SCChart SetStackedBarTotalLabel(string paneName, TotalLabelOptions options = null)
        {
            if (Chart.Diagram is not XYDiagram diagramXY)
            {
                throw new Exception("Total label can be set only for 2D XY diagrams.");
            }

            XYDiagramPaneBase pane;

            if (!string.IsNullOrWhiteSpace(paneName))
            {
                pane = diagramXY.Panes[paneName];
            }
            else
            {
                pane = diagramXY.DefaultPane;
            }

            options ??= new TotalLabelOptions();
            options.SetupXtraChartTotalLabel(this, pane.StackedBarTotalLabel);

            return(this);
        }