Exemple #1
0
        public SCChart AddPaneAnnotation(string name, string text, string pane, string valueX, string valueY,
                                         string axisX = null, string axisY = null,
                                         AnnotationOptions options = null)
        {
            options ??= new AnnotationOptions();
            options.AnchorDockPane = pane;
            var annotation = new TextAnnotation();

            options.SetupXtraChartAnnotation(this, name, text, annotation);

            if (Chart.Diagram is not XYDiagram diagramXY)
            {
                throw new Exception("Panes are available only in 2D XY charts.");
            }

            var anchor = new PaneAnchorPoint();

            if (!string.IsNullOrWhiteSpace(pane))
            {
                var chartPane = diagramXY.Panes[pane];
                anchor.Pane = chartPane ?? throw new Exception($"Cannot find pane '{pane}'.");
            }

            var axX = !string.IsNullOrWhiteSpace(axisX) ? diagramXY.FindAxisXByName(axisX) : diagramXY.AxisX;
            var axY = !string.IsNullOrWhiteSpace(axisY) ? diagramXY.FindAxisYByName(axisY) : diagramXY.AxisY;

            anchor.AxisXCoordinate.Axis      = axX;
            anchor.AxisXCoordinate.AxisValue = valueX;

            anchor.AxisYCoordinate.Axis      = axY;
            anchor.AxisYCoordinate.AxisValue = valueY;

            return(this);
        }
Exemple #2
0
        public SCChart AddAnnotation(string name, string text, int x, int y,
                                     AnnotationOptions options = null)
        {
            options ??= new AnnotationOptions();
            var annotation = new TextAnnotation();

            options.SetupXtraChartAnnotation(this, name, text, annotation);
            annotation.AnchorPoint = new ChartAnchorPoint(x, y);

            return(this);
        }
Exemple #3
0
        public SCChart AddSeriesAnnotation(string name, string text, string seriesName, string argument,
                                           AnnotationOptions options = null)
        {
            options ??= new AnnotationOptions();
            options.SeriesName = seriesName;
            options.Argument   = argument;
            var annotation = new TextAnnotation();

            options.SetupXtraChartAnnotation(this, name, text, annotation);

            return(this);
        }