Page 1 of 1

AddArrayGrid / SetMinMax Do Not Display Chart Where Desired

Posted: Fri Nov 19, 2004 4:03 pm
by 9524337
Josep,

I have used the snippet below you provided me in another post ("No axis min / max using AddArrayGrid or SetMinMax"). Thank you, very much.

Private Sub Form_Load()
Dim XZArray() As Double
Dim x As Integer, z As Integer
With TChart1
.Legend.Visible = False
.AddSeries scSurface
.Axis.Depth.Visible = True
' initialize dynamic array grid
ReDim XZArray(35)
' fill with random values
For x = 0 To 4
For z = 0 To 6
XZArray(x * 7 + z) = Rnd
Next z
Next x
' add to 3D series:
.Series(0).asSurface.AddArrayGrid 5, 7, XZArray
.Axis.Bottom.SetMinMax 1, 4
.Axis.Depth.SetMinMax 2, 4
End With
End Sub

That works, but try the SetMinMax with different parameters:

.Axis.Bottom.SetMinMax 10, 40
.Axis.Depth.SetMinMax 20, 40
OR
.Axis.Bottom.SetMinMax -1, 2
.Axis.Depth.SetMinMax -2, 0

The chart is not seen or only partially seen. This is indicative of the problem I'm seeing in my actual code. When using .asSurface.AddArrayGrid, how can I display the chart data within the max/min I want since AddArrayGrid's parameter list does not provide this infomation? Thanks!

Posted: Sun Nov 21, 2004 11:03 pm
by Pep
Hi,
The chart is not seen or only partially seen. This is indicative of the problem I'm seeing in my actual code. When
It works fine, it cannot show you any points because has not been added (on this positions). Could you please post or send me a code with which I can reproduce the problem "as is" here ?

SetMinMax

Posted: Mon Nov 22, 2004 4:08 am
by 9524337
Hmmm...it looks like SetMinMax does not work the way I need. It looks like the parameters AMin and AMax in SetMinMax(AMin, AMax: Double) are just literal "Index" values to show on the axis. Since the AddArrayGrid(NumX, NumZ: Integer; XZArray: OleVariant) method gets passed the "number" of X's and the "number" of Z's and the only "real" values you are passing to it to plot are in the XZArray. So I was hoping SetMinMax would provide a way for me to set the min and max values on an axis to, say, -20 deg to 60 deg, or 50cm to 110cm. Since this appears to not be the case, I guess my only alternative is to create custom axes and give them the max and min values of my data in the XArray and ZArray. Does this sound like my best alternative? Thanks for you help!

Posted: Tue Nov 23, 2004 8:42 am
by Pep
Hi,

the parameters AMin and AMax in SetMinMax(AMin, AMax: Double) are just literal "Index" values to show on the axis

The values set by SetMinMax are not the Point index values, they are the real Axis scale values. AMin and AMax values are the minimum and maximum values of the range that you wish displayed on the Axis. Eg. For X data that ranges from 0 to 100 the instruction "Axis.Bottom.SetMinMax(20, 30)" will show only those Points whose X values are between (and including) 20 to 30.

With the example values in your original post, the x range is from 0 to 4 so limiting the X Axis to display values outside of 0 to 4 (eg. 10 to 40) will in effect move the all points off the visible scale.

Custom Axes are conventional Axes in all respects with the flexibility that they may be added/removed as required. SetMinMax will apply similarly to a Custom Axis.

If I have you wish to restrict the Y range of data then you should limit the associated Y Axis (the Left Axis by default).

i.e. TChart.Axis.Left.SetMinMax 0.5,1