Dear experts,
I've followed the following example from this forum (because i'm learning to use the UltraChart):
this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterChart;
XYSeries series1 = new XYSeries();
series1.Points.Add(new XYDataPoint(1, 0.1, "", false));
series1.Points.Add(new XYDataPoint(2, 0.2, "", false));
XYSeries series2 = new XYSeries();
series2.Points.Add(new XYDataPoint(3, 0.2, "", false));
series2.Points.Add(new XYDataPoint(4, 0.3, "", false));
this.ultraChart1.Series.Add(series1);
this.ultraChart1.Series.Add(series2);
Works fine. In the wizard you can check that you want to "Show data value on chart". This will show ALL data values per point in the chart. But for a real world problem of mine I would like to show the 'data value' of a single point of 1 serie on the chart.
So for example in the above code, if I would like to show the data value of the 2nd point in series 1. How would I do that?
Thank you very much in advance for answering.
I hear ya. The ChartText collection for the specific chart type is really what this does in the end. In the past I've wanted more control over what I can add/do in those positions so I prefer to do it this way but you should be able to use the ScatterChart.ChartText collection to do this if you wanted.
Matthew,
Your suggestion works. Thank you.
But if I maye give some constructive feedback. As a user of the ultrachart control I expected it to be a matter of setting a property to true.
Hi,
I would probably just add a text primitive to the chart and position it over that point. Something like this:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { SceneGraph scene = e.SceneGraph; PointSet ps = null; for (int i = scene.Count - 1; i >= 0; i--) { ps = scene[i] as PointSet; if (ps != null && ps.Series.Key == "series2") { DataPoint dp = ps.points[1]; Point p = dp.point; p.Offset(-4, 0); Infragistics.UltraChart.Core.Primitives.Text tprim = new Text(p, ((object[]) dp.Value)[0].ToString()); e.SceneGraph.Add(tprim); } } }