Hi i have added a dragmarks tool
The problem is once i dragged i want to reset it to the original position, when i press reset.
How do i do it?
thanx
How to reset the dragged drag marks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
DragMarks throws error
narcis,
Thanx, but
the problem is I have a command button that resets the dragmarks.
I have 1 or many series depending on runtime return values
If I give
For i = 0 To TChart1.SeriesCount
TChart1.Series(i).Marks.ResetPositions
Next
It Throws an error.-2147418113
method 'Resetpositions' of object 'IMarks' failed
Thanx, but
the problem is I have a command button that resets the dragmarks.
I have 1 or many series depending on runtime return values
If I give
For i = 0 To TChart1.SeriesCount
TChart1.Series(i).Marks.ResetPositions
Next
It Throws an error.-2147418113
method 'Resetpositions' of object 'IMarks' failed
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Shawn,
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Code
Narcis,
thanx 4 the help
u cld use the following code. Please add a dragmarks tool to ur chart. ANd commandbutton named cmd_Reset and checkbox ckDragMark
Private Sub ckDragMarks_Click()
TChart1.Tools.Items(0).Active = True
End Sub
Private Sub cmdReset_Click()
Dim i As Integer
For i = 0 To TChart1.SeriesCount
TChart1.Series(i).Marks.ResetPositions
Next
TChart1.Tools.Items(0).Active = False
ckDragMarks.Value = 0
End Sub
Private Sub Form_Load()
LoadGraph
End Sub
Public Function LoadGraph()
TChart1.RemoveAllSeries
'i am actually getting this mina nd max date according to the least and biggest date in the dates i return from the DB
'Set the X Axis and Y Axis
With TChart1.Axis.Bottom
.Automatic = False
.SetMinMax CDate("01/01/2005"), CDate("12/31/2005")
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Separation = 0
.Labels.Size = 25
End With
With TChart1.Axis.Left
.Title.Caption = "Corrosion Rate"
.Automatic = False
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Size = 25
End With
For j = 0 To 5
'add a series
TChart1.AddSeries (scFastLine)
For k = 0 To j + 3
With TChart1.Series(j)
.XValues.DateTime = True
.AddXY Rnd(100), Rnd(100), "", clTeeColor
.AddXY CDate(DateTime.Now + j), CDbl(j), "", clTeeColor
.Marks.Arrow.Visible = True
.Marks.Arrow.Width = 5
.Marks.Arrow.Style = psDot
.Marks.Arrow.Color = TChart1.Series(j).Color
End With
Next
Next
With TChart1.Axis.Bottom
.Title.Caption = "Inspection Date"
.Increment = TChart1.GetDateTimeStep(dtOneDay)
.Labels.DateTimeFormat = "mm/dd/yyyy"
.Automatic = False 'This is redundant
End With
End Function
thanx 4 the help
u cld use the following code. Please add a dragmarks tool to ur chart. ANd commandbutton named cmd_Reset and checkbox ckDragMark
Private Sub ckDragMarks_Click()
TChart1.Tools.Items(0).Active = True
End Sub
Private Sub cmdReset_Click()
Dim i As Integer
For i = 0 To TChart1.SeriesCount
TChart1.Series(i).Marks.ResetPositions
Next
TChart1.Tools.Items(0).Active = False
ckDragMarks.Value = 0
End Sub
Private Sub Form_Load()
LoadGraph
End Sub
Public Function LoadGraph()
TChart1.RemoveAllSeries
'i am actually getting this mina nd max date according to the least and biggest date in the dates i return from the DB
'Set the X Axis and Y Axis
With TChart1.Axis.Bottom
.Automatic = False
.SetMinMax CDate("01/01/2005"), CDate("12/31/2005")
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Separation = 0
.Labels.Size = 25
End With
With TChart1.Axis.Left
.Title.Caption = "Corrosion Rate"
.Automatic = False
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Size = 25
End With
For j = 0 To 5
'add a series
TChart1.AddSeries (scFastLine)
For k = 0 To j + 3
With TChart1.Series(j)
.XValues.DateTime = True
.AddXY Rnd(100), Rnd(100), "", clTeeColor
.AddXY CDate(DateTime.Now + j), CDbl(j), "", clTeeColor
.Marks.Arrow.Visible = True
.Marks.Arrow.Width = 5
.Marks.Arrow.Style = psDot
.Marks.Arrow.Color = TChart1.Series(j).Color
End With
Next
Next
With TChart1.Axis.Bottom
.Title.Caption = "Inspection Date"
.Increment = TChart1.GetDateTimeStep(dtOneDay)
.Labels.DateTimeFormat = "mm/dd/yyyy"
.Automatic = False 'This is redundant
End With
End Function
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Shawn,
Thanks for the code, we have been able to reproduce the problem here. It is a bug and we have added that to our defect list to be fixed in future releases. The code below works fine.
Thanks for the code, we have been able to reproduce the problem here. It is a bug and we have added that to our defect list to be fixed in future releases. The code below works fine.
Code: Select all
Private Sub ckDragMark_Click()
TChart1.Tools.Items(0).Active = True
End Sub
Private Sub cmd_Reset_Click()
For seriesindex = 0 To TChart1.SeriesCount - 1
For i = 0 To TChart1.Series(seriesindex).Count - 1
TChart1.Series(seriesindex).Marks.Positions.Automatic (i)
Next i
Next seriesindex
TChart1.Environment.InternalRepaint
TChart1.Tools.Items(0).Active = False
End Sub
Private Sub Form_Load()
LoadGraph
End Sub
Public Function LoadGraph()
TChart1.RemoveAllSeries
'i am actually getting this mina nd max date according to the least and biggest date in the dates i return from the DB
'Set the X Axis and Y Axis
With TChart1.Axis.Bottom
.Automatic = False
.SetMinMax CDate("01/01/2005"), CDate("12/31/2005")
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Separation = 0
.Labels.Size = 25
End With
With TChart1.Axis.Left
.Title.Caption = "Corrosion Rate"
.Automatic = False
.MaximumOffset = 4
.MinimumOffset = 4
.Labels.Size = 25
End With
For j = 0 To 5
'add a series
TChart1.AddSeries (scFastLine)
For k = 0 To j + 3
With TChart1.Series(j)
.XValues.DateTime = True
.AddXY Rnd(100), Rnd(100), "", clTeeColor
.AddXY CDate(DateTime.Now + j), CDbl(j), "", clTeeColor
.Marks.Visible = True
.Marks.Arrow.Visible = True
.Marks.Arrow.Width = 5
.Marks.Arrow.Style = psDot
.Marks.Arrow.Color = TChart1.Series(j).Color
End With
Next
Next
With TChart1.Axis.Bottom
.Title.Caption = "Inspection Date"
.Increment = TChart1.GetDateTimeStep(dtOneDay)
.Labels.DateTimeFormat = "mm/dd/yyyy"
End With
End Function
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Shawn,
We have investigated the issue and found that ResetPositions worked fine. the problem here is the loop that you should have looped from 0 to SeriesCount-1 so code below works fine:
Shame we didn't notice that before!
We have investigated the issue and found that ResetPositions worked fine. the problem here is the loop that you should have looped from 0 to SeriesCount-1 so code below works fine:
Code: Select all
For i = 0 To TChart1.SeriesCount -1
TChart1.Series(i).Marks.ResetPositions
Next
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |