Dear support,
In my application, I used a horizontal series and one drag point tool. When the values (x axis values) change the drag point tool works fine. But when the values are constant, the chart becomes erratic when I drag one point with the following code. Apprently the teechart code found the wrong index.
for(i=0;i<10;i++)
{
m_Chart1.Series(0).Add(1000,"",clTeeColor);
}
void aaa::OnOnDragPointToolDragPointTchart1(long Index)
{
// TODO: Add your control notification handler code here
double Data=m_Chart1.Series(0).GetPointValue(Index);
if(Data<0)
m_Chart1.Series(0).SetPointValue(Index,0);
//GetPointValue(Index);
}
if I change the value from 1000 to 1, the code seems works fine.
Thanks,
hh
bug in OnDragPointToolDragPoint
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi bchatt,
I could reproduce this problem here. This is because the left axis only has one value. This implies that the left axis minimum and maximum values are the same and has no scale and this makes the chart behave like this when dragging a point. A solution to it is manually setting left axis minimum and maximum values:
I could reproduce this problem here. This is because the left axis only has one value. This implies that the left axis minimum and maximum values are the same and has no scale and this makes the chart behave like this when dragging a point. A solution to it is manually setting left axis minimum and maximum values:
Code: Select all
Private Sub Form_Load()
With TChart1.Series(0)
For i = 0 To 9
.Add 1000, "", clTeeColor
Next
TChart1.Axis.Left.SetMinMax .YValues.Minimum - 100, .YValues.Maximum + 100
End With
End Sub
Private Sub TChart1_OnDragPointToolDragPoint(ByVal Index As Long)
Dim Data As Double
Data = TChart1.Series(0).PointValue(Index)
If Data < 0 Then
TChart1.Series(0).PointValue(Index) = 0
End If
End Sub
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 |
Hi,
yes, you're correct, it is a bug, it happens with horiz. point Series, I've added down our defect list and a fix for it will be considered to inclusion for the next maintenance releases.
In meantime a workaround is to change the Axis min and max manually :
yes, you're correct, it is a bug, it happens with horiz. point Series, I've added down our defect list and a fix for it will be considered to inclusion for the next maintenance releases.
In meantime a workaround is to change the Axis min and max manually :
Code: Select all
Private Sub Form_Load()
With TChart1.Series(0)
For i = 0 To 9
.Add 1000, "", clTeeColor
Next
TChart1.Axis.Bottom.SetMinMax .XValues.Minimum - 100, .XValues.Maximum + 100
End With
End Sub
Private Sub TChart1_OnDragPointToolDragPoint(ByVal Index As Long)
Dim Data As Double
If TChart1.Series(0).XValues.Value(Index) > TChart1.Axis.Bottom.Maximum Then
TChart1.Axis.Bottom.Maximum = TChart1.Series(0).XValues.Value(Index)
End If
If TChart1.Series(0).XValues.Value(Index) < TChart1.Axis.Bottom.Minimum Then
TChart1.Axis.Bottom.Minimum = TChart1.Series(0).XValues.Value(Index)
End If
Data = TChart1.Series(0).PointValue(Index)
If Data < 0 Then
TChart1.Series(0).PointValue(Index) = 0
End If
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com