Thursday, January 17, 2013 7:37 PM
My application allows users to query a database and add events on a timeline at runtime. Based on combo box selections, a datarow called EventQuery is determined and adds events in a single series (called events). Like this:
For Each dr As DataRow In EventQuery
intCount += 1
It then adds labels to the new points in "Events"
cht1.Series("Events").Label = " " & cboColumn.SelectedItem & " " & txtConstraint.Text
Users are able to do this multiple times, adding new points after each button press. The problem is ALL labels in the series are updated with each button press, rather than just the newly added points, so it's impossible to distinguish a new group of points from previous ones.
Any ideas as to how I can add labels for only each group of points in a series, rather than the entire series? Thanks in advance.
Friday, January 18, 2013 7:42 AMModerator
Create a DataPoint object in the loop and use the DataPoint.Label property set the label.
For Each dr As DataRow In EventQuery Dim dp As New DataPoint() dp.SetValueXY(dr(strDate), (0)) dp.Label = " " & cboColumn.SelectedItem & " " & txtConstraint.Text ch1.Series("Events").Points.Add(dp) intCount += 1 Next
Tuesday, January 22, 2013 5:06 PMI've tried several variations of this (such as declaring dp before the loop, etc) and still get the 'too many y values' problem.
Tuesday, January 22, 2013 5:56 PM
And just a picture to give you a better idea of what it's saying:
- Edited by Noolybum Tuesday, January 22, 2013 5:57 PM
Tuesday, January 22, 2013 6:54 PMModeratorInstead of the AddXY method, use the Add method. I fixed the bug in my previous post.
Tuesday, January 22, 2013 7:18 PM
Thanks for adding that, Sipla. This works, but the problem is now that after I click the button a second time, the previous point disappears entirely, and only the new point(s) remain! :(