Text in a scatterplot (x, y) graph.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
chipshot
Newbie
Newbie
Posts: 18
Joined: Fri Feb 13, 2004 5:00 am

Text in a scatterplot (x, y) graph.

Post by chipshot » Thu Dec 09, 2004 7:01 pm

Is it possible to put text with each point plotted on a scatterplot graph? If so, any suggestions?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Dec 10, 2004 11:50 am

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.
Marjan Slatinek,
http://www.steema.com

chipshot
Newbie
Newbie
Posts: 18
Joined: Fri Feb 13, 2004 5:00 am

Post by chipshot » Mon Dec 13, 2004 8:16 pm

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

chipshot
Newbie
Newbie
Posts: 18
Joined: Fri Feb 13, 2004 5:00 am

Post by chipshot » Mon Dec 13, 2004 9:36 pm

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.

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 14, 2004 7:34 am

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()

chipshot
Newbie
Newbie
Posts: 18
Joined: Fri Feb 13, 2004 5:00 am

Post by chipshot » Tue Dec 14, 2004 3:58 pm

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.

chipshot
Newbie
Newbie
Posts: 18
Joined: Fri Feb 13, 2004 5:00 am

Post by chipshot » Tue Dec 14, 2004 8:56 pm

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

Post Reply