I have a series for which some values are missing. I add them as nulls, which works fine. But the left axis for this series is set to automatic, and the nulls set the axis scale minimum to zero even though the rest of the data is in the range of 400-500. That totally ruins the scale of the graph.
Null values should not affect automatic scaling.
Null values treated as zero in automatic scale
Hi,
a solution for this would be to loop through your series deleting the
Null points - the points before and after the Nulls will then automatically
join up, e.g.
a solution for this would be to loop through your series deleting the
Null points - the points before and after the Nulls will then automatically
join up, e.g.
Code: Select all
Private Sub Command1_Click()
With TChart1
For i = 0 To .Series(0).Count - 1
If .Series(0).IsNull(i) Then
.Series(0).Delete i
End If
Next i
End With
End Sub
Private Sub Form_Load()
With TChart1.Series(0)
.AddNull ""
.AddXY 300, 10, "", clTeeColor
.AddXY 350, 10, "", clTeeColor
.AddXY 400, 10, "", clTeeColor
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Paul,
in that case you could use similar code to the following :
in that case you could use similar code to the following :
Code: Select all
Private Sub Form_Load()
With TChart1.Series(0)
.AddNullXY 5, 0, ""
.AddXY 300, 10, "", clTeeColor
.AddXY 350, 20, "", clTeeColor
.AddXY 400, 40, "", clTeeColor
End With
With TChart1
vmin = .Series(0).YValues.Maximum
For i = 0 To .Series(0).Count - 1
If Not .Series(0).IsNull(i) Then
If .Series(0).YValues.Value(i) < vmin Then
vmin = .Series(0).YValues.Value(i)
End If
End If
Next i
.Axis.Left.SetMinMax vmin, .Series(0).YValues.Maximum
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com