Page 1 of 1

Text in a scatterplot (x, y) graph.

Posted: Thu Dec 09, 2004 7:01 pm
by 8123840
Is it possible to put text with each point plotted on a scatterplot graph? If so, any suggestions?

Posted: Fri Dec 10, 2004 11:50 am
by Marjan
Hi.

Yes, the easiest solution is simply to use series marks with one of the pre-defines styles. You can also use series GetSeriesMark event to additionally fully customize individual series marks (text, appearance).

In some cases you can also use the chart annotation tool to add text at specific coordinates. Or even manually draw required text directly on Chart.Graphics3D by using one of it's methods.

All these approaches are demonstrated in TeeChart .NET demo.

Posted: Mon Dec 13, 2004 8:16 pm
by 8123840
hmm...I can't find any examples of displaying text at a series mark that is not the actual y value being plotted

I have tried:

.Axes.Bottom.Automatic = False
.Axes.Bottom.Minimum = 10
.Axes.Bottom.Maximum = 35
.Axes.Bottom.Increment = 5
.Axes.Bottom.Labels.Separation = 1
.Axes.Bottom.MinorTickCount = 0
.Axes.Bottom.MaximumOffset = 0
.Axes.Bottom.Labels.OnAxis = True
.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text
.Axes.Bottom.Labels.Angle = 0
.Series(0).Marks.DrawEvery = 1
.Series(0).Marks.Visible = True
.Series(0).Marks.Style = Steema.TeeChart.Styles.MarksStyles.Label
For i = 0 To x.Count - 1
.Series(0).Add(CType(x(i), Double), CType(y(i), Double), CType(name(i), String))
Next

but then I get the names from the names() along the x axis instead of the
axis values I set up earlier

Posted: Mon Dec 13, 2004 9:36 pm
by 8123840
I think I better understand my situation now. I was trying to use the points series and add and x, y and text values to it. I didn't realize that the 3rd parameter was going to act as the label for the x axis. What I need to do is to add an x, y and text reprenting the name of the person at that coordinate. It is a scatter plot, not a line.

Posted: Tue Dec 14, 2004 7:34 am
by Pep
Hi,

exactly, the Add method can be used in different ways. Please see more info about the Add method in the TeeChart for Net Help File ( Steema.TeeChart.Styles.Series.Add Method )

And also you cna specify the labels using the LabelMember :
Line1.LabelMember = employeeTable.Columns("Name").ToString()

Posted: Tue Dec 14, 2004 3:58 pm
by 8123840
I've tried the help but it just says things like:
Adds a new point with specified x,y values and text.
public Int32 Add(System.Double, System.Double, System.String)

but nowhere does it tell you what the parameters, like "System.String" actually do. Is there a newer version of help that has a more info.

Posted: Tue Dec 14, 2004 8:56 pm
by 8123840
Figured it out. If I load the graphs from arrays x and y values I can then alter the text of the marks using the valueslist array as follows:

For i = 0 To x.Count - 1
.Series(0).Add(CType(x(i), Double), CType(y(i), Double))
Next

Private Sub Line_1_GetSeriesMark(ByVal series As Steema.TeeChart.Styles.Series, ByVal e As Steema.TeeChart.Styles.GetSeriesMarkEventArgs) Handles Line_1.GetSeriesMark
e.MarkText = CType(name(e.ValueIndex), String)
End Sub