using SetNull and Yvalues.Value
using SetNull and Yvalues.Value
hello,
I have chart where some points added with AddXY are disabled with SetNull
Then, after firing onmousemove event; Yvalues.value(index) gives former value added with AddXY
Is there way how to display something like N/A ? instead of former value?
Thanks
I have chart where some points added with AddXY are disabled with SetNull
Then, after firing onmousemove event; Yvalues.value(index) gives former value added with AddXY
Is there way how to display something like N/A ? instead of former value?
Thanks
Re: using SetNull and Yvalues.Value
Hi adenin,
You could check if a point is set as null with IsNull function:
You could check if a point is set as null with IsNull function:
Code: Select all
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim index As Integer
index = TChart1.Series(0).Clicked(X, Y)
If index > -1 Then
If TChart1.Series(0).IsNull(index) Then
TChart1.Header.Text.Text = "N/A"
Else
TChart1.Header.Text.Text = Str$(TChart1.Series(0).YValues.Value(index))
End If
Else
TChart1.Header.Text.Text = "Move the mouse over a point"
End If
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: using SetNull and Yvalues.Value
Hello Alonso,
IsNull helped me, but I discovered problem with setnull;
I fill series like this:
.Series(0).AddXY 41, 0.4946055 ,"" , RGB(200,0,0)
.Series(0).AddXY 42, 0.4946055 ,"" , RGB(200,0,0)
.Series(0).AddXY 43, 0.4062691 ,"" , RGB(200,0,0)
.Series(0).AddXY 44, 0.4994978 ,"" , RGB(200,0,0)
.Series(0).SetNull 43
I use stairs chart, and it does not looks like I expect in two areas (42,43) and (43,44)
description of values created in this event
Sub gr_priemer_OnMouseMove(Shift, X, Y)
if fix(gr_priemer.Series(0).XScreenToValue(X))>=0 and fix(gr_priemer.Series(0).XScreenToValue(X))< 107 then
' 1
'
for p=0 to gr_priemer.Series(0).XValues.Count-1
if gr_priemer.Series(0).XScreenToValue(X) < gr_priemer.Series(0).XValues.Value(p) then
if gr_priemer.Series(0).IsNull(p-1) then
h1="N/A"
exit for
else
h1=FormatNumber(gr_priemer.Series(0).YValues.Value(p-1),3)
exit for
end if
end if
next
gr_priemer.Tools.Items(0).asAnnotation.Text = "pozicia:"&Chr(13)& "Elongation:"&Chr(13)&""
gr_priemer.Tools.Items(3).asAnnotation.Text = fix(gr_priemer.Series(0).XScreenToValue(X)) & Chr(13) & h1 & Chr(13) & ""
end if
is ok, but something else is displayed in mentioned areas
please, could you look at that?
I can't attach file with any extension... each is possible attack vector (.html, .html_file,.txt,also without ext)
IsNull helped me, but I discovered problem with setnull;
I fill series like this:
.Series(0).AddXY 41, 0.4946055 ,"" , RGB(200,0,0)
.Series(0).AddXY 42, 0.4946055 ,"" , RGB(200,0,0)
.Series(0).AddXY 43, 0.4062691 ,"" , RGB(200,0,0)
.Series(0).AddXY 44, 0.4994978 ,"" , RGB(200,0,0)
.Series(0).SetNull 43
I use stairs chart, and it does not looks like I expect in two areas (42,43) and (43,44)
description of values created in this event
Sub gr_priemer_OnMouseMove(Shift, X, Y)
if fix(gr_priemer.Series(0).XScreenToValue(X))>=0 and fix(gr_priemer.Series(0).XScreenToValue(X))< 107 then
' 1
'
for p=0 to gr_priemer.Series(0).XValues.Count-1
if gr_priemer.Series(0).XScreenToValue(X) < gr_priemer.Series(0).XValues.Value(p) then
if gr_priemer.Series(0).IsNull(p-1) then
h1="N/A"
exit for
else
h1=FormatNumber(gr_priemer.Series(0).YValues.Value(p-1),3)
exit for
end if
end if
next
gr_priemer.Tools.Items(0).asAnnotation.Text = "pozicia:"&Chr(13)& "Elongation:"&Chr(13)&""
gr_priemer.Tools.Items(3).asAnnotation.Text = fix(gr_priemer.Series(0).XScreenToValue(X)) & Chr(13) & h1 & Chr(13) & ""
end if
is ok, but something else is displayed in mentioned areas
please, could you look at that?
I can't attach file with any extension... each is possible attack vector (.html, .html_file,.txt,also without ext)
Re: using SetNull and Yvalues.Value
Hi adenin,
I'm not sure to see any problem in the chart that is displayed with the following code:
You could try to attach your files in a .zip, .rar or .7zip.
I'm not sure to see any problem in the chart that is displayed with the following code:
Code: Select all
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.Aspect.View3D = False
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 10
TChart1.Series(0).asLine.Stairs = True
TChart1.Series(0).SetNull 5
For i = 0 To 1
TChart1.Tools.Add tcAnnotate
TChart1.Tools.Items(i).asAnnotation.Left = i * 100
Next
End Sub
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If Fix(TChart1.Series(0).XScreenToValue(X)) >= 0 And Fix(TChart1.Series(0).XScreenToValue(X)) < TChart1.Series(0).Count - 1 Then
For p = 0 To TChart1.Series(0).XValues.Count - 1
If TChart1.Series(0).XScreenToValue(X) < TChart1.Series(0).XValues.Value(p) Then
If TChart1.Series(0).IsNull(p - 1) Then
h1 = "N/A"
Exit For
Else
h1 = FormatNumber(TChart1.Series(0).YValues.Value(p - 1), 3)
Exit For
End If
End If
Next
TChart1.Tools.Items(0).asAnnotation.Text = "pozicia:" & Chr(13) & "Elongation:" & Chr(13) & ""
TChart1.Tools.Items(1).asAnnotation.Text = Fix(TChart1.Series(0).XScreenToValue(X)) & Chr(13) & h1 & Chr(13) & ""
End If
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: using SetNull and Yvalues.Value
I am attaching mentioned file in zip, pls go with mouse cursor into area between (42,43)
and (43,44) and pls look at displayed values - they are correct according to values set by addxy and setnull.
But, chart is not showing those correct data
thanks in advance
Peter
and (43,44) and pls look at displayed values - they are correct according to values set by addxy and setnull.
But, chart is not showing those correct data
thanks in advance
Peter
- Attachments
-
- why_.zip
- (2.66 KiB) Downloaded 645 times
Re: using SetNull and Yvalues.Value
Hi adenin,
I've seen that you are using TeeChart v7. Note that some things related to null points changed at v8. In v8 there is a TreatNulls property to allow you to DontPaint, Skip or Ignore the null points of the series. But also the default treatment for the nulls (DontPaint) has changed. From v8, TeeChart considers that a null point in a line series (or a fast line series) influences both left and right line segments as a line can only be drawn between two visible points.
So in v8 your application doesn't show neither the segment 42-43 or 43-44. And if you would like to show the segment 42-43 and not the 43-44 you should add another visible point at X=43 and set the point with index 44 as null instead of 43.
In v7 you should set as null the point at index 44 and change your condition from mousemove to:
I've seen that you are using TeeChart v7. Note that some things related to null points changed at v8. In v8 there is a TreatNulls property to allow you to DontPaint, Skip or Ignore the null points of the series. But also the default treatment for the nulls (DontPaint) has changed. From v8, TeeChart considers that a null point in a line series (or a fast line series) influences both left and right line segments as a line can only be drawn between two visible points.
So in v8 your application doesn't show neither the segment 42-43 or 43-44. And if you would like to show the segment 42-43 and not the 43-44 you should add another visible point at X=43 and set the point with index 44 as null instead of 43.
In v7 you should set as null the point at index 44 and change your condition from mousemove to:
Code: Select all
if gr_priemer.Series(0).IsNull(p) then
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: using SetNull and Yvalues.Value
it works according to your recommendation, but there left one vert line, which shouldn't be there
...as visible from attached printscreen
is it possible to remove it somehow?
thanks
...as visible from attached printscreen
is it possible to remove it somehow?
thanks
- Attachments
-
- vert_line.zip
- (46.77 KiB) Downloaded 644 times
Re: using SetNull and Yvalues.Value
Hi adenin,
In v7 setting a value as null, in stairs mode, it won't draw the stair that ends in that point, understanding a stair as an horizontal line plus a vertical line. So, if you want to hide two vertical lines and an horizontal line that means that we have to do some trick.
We've hidden a stair setting the 44 as null but it remains a vertical line. What we can do is to make the point 43 to have the same Y value than the 42 and add a new point at X=43 so we can hide its stair.
the following values work fine here. If you don't understand the trick, try playing around the values and pay attention at how the chart changes:
In v7 setting a value as null, in stairs mode, it won't draw the stair that ends in that point, understanding a stair as an horizontal line plus a vertical line. So, if you want to hide two vertical lines and an horizontal line that means that we have to do some trick.
We've hidden a stair setting the 44 as null but it remains a vertical line. What we can do is to make the point 43 to have the same Y value than the 42 and add a new point at X=43 so we can hide its stair.
the following values work fine here. If you don't understand the trick, try playing around the values and pay attention at how the chart changes:
Code: Select all
.Series(0).AddXY 43, .Series(0).YValues.Value(43),"" , RGB(200,0,0)
.Series(0).YValues.Value(43) = .Series(0).YValues.Value(42)
.Series(0).SetNull 44
.Series(0).SetNull 45
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: using SetNull and Yvalues.Value
Alonso, thanks, it behaves exactly as I wanted with your source code.
Re: using SetNull and Yvalues.Value
Hi adenin,
I'm glad to hear that!
I'm glad to hear that!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |