Hello,
Is it possible to add labels to points in a ScatterLineSeries? I've been able to add labels to CategoricalDataPoints but not ScatterDataPoints. I noticed that on https://docs.telerik.com/devtools/winforms/controls/chartview/series-types/series-types there are labels for Line, Spline, Area, and SplineArea series, but not for Bar or Scatter.
I added a custom LabelFormatting event that gets called when I use a LineSeries with CategoricalDataPoints, but it doesn't run when I use a ScatterLineSeries with ScatterDataPoints. Here's some sample code I tested (in OpenEdge) and a screenshot of my results:
LabelFormatting method:
METHOD PRIVATE VOID myLabelFormatting(INPUT sender AS System.Object, INPUT e AS ChartViewLabelFormattingEventArgs):
e:LabelElement:BackColor = System.Drawing.Color:White.
e:LabelElement:ForeColor = System.Drawing.Color:Black.
e:LabelElement:BorderColor = System.Drawing.Color:Black.
e:LabelElement:Font = NEW Font("Segoe Script", 12, FontStyle:Regular).
DEFINE VARIABLE element AS CartesianLinePointElement NO-UNDO.
MESSAGE "Casting element..." VIEW-AS ALERT-BOX.
element = CAST(e:LabelElement:Parent, CartesianLinePointElement).
DEFINE VARIABLE dataPoint AS ScatterDataPoint NO-UNDO.
MESSAGE "Casting point..." VIEW-AS ALERT-BOX.
dataPoint = CAST(element:DataPoint, ScatterDataPoint).
e:LabelElement:Text = STRING(dataPoint:XValue) + ", " + STRING(dataPoint:YValue).
END METHOD.
Sample code:
THIS-OBJECT:radChartView1:LabelFormatting:Subscribe(myLabelFormatting).
DEFINE VARIABLE lineSeries AS ScatterLineSeries NO-UNDO.
lineSeries = NEW ScatterLineSeries().
lineSeries:DataPoints:Add(NEW ScatterDataPoint(1, 10)).
lineSeries:DataPoints:Add(NEW ScatterDataPoint(15, 15)).
lineSeries:DataPoints:Add(NEW ScatterDataPoint(5, 20)).
lineSeries:PointSize = NEW SizeF(8, 8).
lineSeries:ShowLabels = TRUE.
radChartView1:Series:Add(lineSeries).
radChartView1:BackColor = System.Drawing.Color:LightGray.
radChartView1:ShowLegend = TRUE.
Thanks,
Adam