|
Contour Chart -> "Error converting argument 1 to type class DoubleArray" problem |
Posted by Akim on Sep-06-2010 14:26 |
|
Private linex()
Private liney()
Private linex1()
Private liney1()
Private linexa1()
Private lineya1()
Private datax1()
Private datay1()
Private datax2()
Private datay2()
Public Sub GetLineOrbit(s$, xx As Integer)
'INTERROGATE COMPONENT to produce satellite pass list
Dim dtrun, southbound As Boolean
Dim julian As Double, k As Integer, threshdeg
Dim az As Double, el As Double, longit As Double, lat As Double, range As Double, rr As Double, alt As Double
Dim phase As Double, siapganti As Boolean, Pmax As Single, Pmin As Single, Pmax1 As Single, Pmin1 As Single, PmaxAbs As Single
threshdeg = 0.01: 'Radians
entry% = 0
Erase wxsat
dtrun = Me.txttimeutc.Text
awal = True
z = 96
Call redimension(98)
'Me.Text1.Text = ""
For k = 0 To z 'Step 2
dt = createtime_next_run(True, dtrun, k)
julian = objSatlist.DateTimeToJT(dt): 'convert date to Julian Days
'Retrieve day's list of passes from Component - in string passes$
passes$ = objSatlist.PassListForPeriod(s$, dt, min_seconds, days, min_elevation)
'Check for satellite visibility
isvis = objSatlist.Isvisible(s$, julian, threshdeg, southbound, az, el, longit, lat, range, rr, alt, phase)
longi = str$(rtd(longit))
lati = str$(rtd(lat))
' this code input to array linex dan liney
If longi > 180 Then
linex(k) = (longi - 360)
Else
linex(k) = (longi)
End If
liney(k) = (lati)
Next
For i = 0 To 98
If IsEmpty(linex(i)) Then
linex1(i) = cd.NoValue
liney1(i) = cd.NoValue
Call FillLine(i, xx)
...
Else...
...
linex1(i) = linex(i)
liney1(i) = liney(i)
Call FillLine(i, xx)
End If
Next
End Sub
=============================
Public Sub redimension(zz)
ReDim linexa1(zz)
ReDim lineya1(zz)
end sub
=============================
Private Sub FillLine(i, xx As Integer)
Select Case xx
Case 1
linexa1(i) = linex1(i)
lineya1(i) = liney1(i)
==============================
Public Sub createChart_Sattelite(viewer As Object)
Dim cd As New ChartDirector.API
Dim xx As Single
' Create a XYChart object of size 450 x 540 pixels
'Set viewer.Object = Nothing
Dim c As XYChart
'Dim layer As ContourLayer
Set c = cd.XYChart(815, 510)
Call c.addTitle(JudulContour, "ariali.ttf", 10, &HFFFFFF)
On Error GoTo salah
Call c.setPlotArea(45, 40, 750, 380, -1, -1, -1, c.dashLineColor(&H80000000, cd.DefaultShading), -1)
Call c.yAxis().setLinearScale(-90, 90, 30)
Call c.XAxis().setLinearScale(-180, 180, Array("", 210, 240, 270, 300, 330, 0, 30, 60, 90, 120, 150, 180))
Call c.getPlotArea().moveGridBefore(layer)
Call c.addText(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() / 2, c.getPlotArea().getTopY() + 7 + c.getPlotArea().getHeight() / 2, "<*img=" & App.Path & "\\" & "world_map_ok.gif*>", "normal", 8, &H0, cd.Center)
Dim layer1 As ScatterLayer
Set layer1 = c.addScatterLayer(dataX0, dataY0, "Satellite", cd.StarShape(3), 19) '.getDataSet(1).setDataSymbol(icons(2))
' Add labels to the chart as an extra field
' Call layer1.getDataSet(0).setDataSymbol2(icons(0))
Call layer1.addExtraField(dataZ0)
Call layer1.setDataLabelFormat("{field0}")
Call c.addScatterLayer(datax1, datay1, "MOON", cd.CircleShape, 18, &H888888)
Call c.addScatterLayer(datax2, datay2, "SUN", cd.CircleShape, 18, cd.goldColor)
' lokasi observer
lokasi = Array(strlokasi)
Dim layer2 As ScatterLayer
Set layer2 = c.addScatterLayer(dataxb, datayb, strlokasi, cd.StarShape(4), 15) ', &HFF3333, &HFF3333)
Call layer2.addExtraField(lokasi)
Call layer2.setDataLabelFormat("{field0}")
Dim layer0 As LineLayer
Set layer0 = c.addLineLayer2()
Call layer0.addDataSet((lineya1), &H80)
Call layer0.setXData((linexa1))
Call layer0.setLineWidth(2)
Set viewer.Chart = c
Set viewer.Picture = c.makePicture()
viewer.ImageMap = viewer.Chart.getHTMLImageMap("clickable", "", "title='[{dataSetName}] Lon:{x};Lat={value}'")
Exit Sub
salah:
MsgBox err.Description, vbExclamation, strJudul
End Sub
|
Re: Contour Chart -> "Error converting argument 1 to type class DoubleArray" problem |
Posted by Akim on Sep-06-2010 14:29 |
|
i have the code.
when i run the error is
"Error converting argument 1 to type class DoubleArray"
need help!
thanks~ |
Re: Contour Chart -> "Error converting argument 1 to type class DoubleArray" problem |
Posted by Peter Kwan on Sep-07-2010 00:03 |
|
Hi Akim,
The error just means your argument is not an array of numbers.
To solve the problem, please remove the "On Error GoTo salah", and run your code in the VB IDE, so that your code will break on the line that produces the error. Then please print the contents of the argument in the VB debugger. Check if it is an array, and if it contains non numbers.
For example, suppose the code breaks at the line:
Set layer1 = c.addScatterLayer(dataX0, dataY0, "Satellite", cd.StarShape(3), 19) '.getDataSet(1).setDataSymbol(icons(2))
In the debugger, please do:
For i = 0 To Ubound(dataX0): Print "<<" & dataX0(i) & ">>": Next
Check if all the outputs are numbers. If there are non numbers, then this is the cause of the problem.
If you need further help, please inform me which line is causing the error, and the output of the debugger using the above code.
Hope this can help.
Regards
Peter Kwan |
Re: Contour Chart -> "Error converting argument 1 to type class DoubleArray" problem |
Posted by Akim on Sep-07-2010 23:37 |
|
Thank you Mr.Peter. the problem has been solved.
the error cause the Regional Setting.
thanks |
|