ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Jorge
Posted by ChartDirector error '80010108' on Sep-30-2009 05:21
Attachments:
Hi, I'm Jorge Castillo from Mexico City, I don't speak, and write English good, but I try.

Well I have a problem con ChartDirector for ASP.

the error is:
ChartDirector error '80010108'
Automation error The object invoked has disconnected from its clients.

/ivr/club/GraficadorSucursales1.asp, line 117

The page asp have the next code:
..............................................................
<%@ language="vbscript" %>
<!--#include File="SQLConnection.asp"-->
<%
'OBTENGO EL RANGO DE FECHAS
fdesde=request("txtFechaDesde")
fhasta=request("txtFechaHasta")
chkEmpresas2=request("chkEmpresas2")
dim data()
dim data1()
DIM labels()
if fdesde=fhasta then
'la grafica se genera por horas
numeroColumnas=24
redim labels(numeroColumnas),data(numeroColumnas)
for i=0 to numeroColumnas
labels(i)=  i
data(i)=0
next
else
numeroColumnas=abs(datediff("d",fdesde,fhasta))
redim labels(numeroColumnas),data(numeroColumnas)
for  i=numeroColumnas to 0 step -1
labels(i)= cdate(fdesde)+i
data(i)=0
next
end if
y=400
if chkEmpresas2="" then chkEmpresas2=request("chkEmpresas2")
Sucursales =split(chkEmpresas2,", ")
TotalSucursales=ubound(Sucursales)
x=ubound(Sucursales)+1
x=x*(40*numeroColumnas)
if x<500 then x=500


    dim cd
Set cd = CreateObject("ChartDirector.API")
Set c = cd.XYChart(x, y,&HFFFFFF, &H0000FF, 1)
Call c.addTitle("<*align=CENTER*>REDENCIONES POR PROMOCI?N.- REDENCI?N POR EMPRESA<*BR*>("&FDESDE&"-"&FHASTA&")<*/*>", "timesbi.ttf", 09, &H0000FF ).setBackground(&H33CC00,&H33CCCC, cd.softLighting(cd.TOP,4))
Call c.setPlotArea(55, 58, x-100, y-100, &Hf8f8f8, -1, -1, &Hf8f8f8, &Hffffff)
Call c.addLegend(55, 32, False).setBackground(cd.Transparent)
Call c.xAxis().setLabels(labels)
Call c.xAxis().setLabelStyle("arialbd.ttf", 8, &H0000FF)
Call c.yAxis().setLabelStyle("arialbd.ttf", 8,&H0000FF)
Call c.xAxis().setTickOffset(0.5)
Set layer = c.addBarLayer2(cd.Side, 4)

'bucamos los datos a graficar
for x=0 to TotalSucursales
IF fdesde=fhasta then
strsql1="select convert(char(2),fecha,108) as fecha, count(estatus)"&_
" from "& sbase&".dbo.ivr_club_folios "&_
" where idempresa in (select idcampa?a  from "& sbase&".dbo.ivr_club_campanas where idempresa in ("& sucursales(x)&"))"&_
" and estatus=1 "&_
" and fecha>='"&fdesde&" 00:00:00'"&_
" and fecha<='"&fhasta&" 23:59:59'"&_
" group by convert(char(2),fecha,108)"&_
" order by convert(char(2),fecha,108)"
else
strsql1="select convert(char(10),fecha,103) as fecha, count(estatus)"&_
" from "& sbase&".dbo.ivr_club_folios "&_
" where idempresa in (select idcampa?a  from "& sbase&".dbo.ivr_club_campanas where idempresa in ("& sucursales(x)&"))"&_
" and estatus=1 "&_
" and fecha>='"&fdesde&" 00:00:00'"&_
" and fecha<='"&fhasta&" 23:59:59'"&_
" group by convert(char(10),fecha,103)"&_
" order by convert(char(10),fecha,103)"
end if

SET rsContador = createobject("ADODB.recordset")
rsContador.Open strSQL1,adodbconnection
if not rscontador.Eof then
redim data(numeroColumnas)
do while not rscontador.eof
for j=0 to numeroColumnas
cont=rscontador(0)
if fdesde=fhasta then cont = cint(cont)
'Response.Write labels(j) & "=" &  cont & "
"
if trim(labels(j))= trim(cont) then
data(j)=rscontador(1)
end if
next
cont=0
rscontador.movenext
loop

'Response.Write strSQL1
'Response.End
set rsNombre= createobject("ADODB.Recordset")

strsql1="Select nomempresa from " & sBase & ".dbo.ivr_club_empresas where  idempresa=" & sucursales(x)
rsNombre.Open strSQL1, adodbconnection
nombreSucursal=rsNombre(0)
Call layer.addDataSet(data, -1, UCASE(nombreSucursal))
end if

next

IF FDESDE=FHASTA THEN
Call c.xAxis().setLabels(labels)
ELSE
tlabels=ubound(labels)
for j=0 to tlabels
labels(j)=replace(labels(j),"/"&year(now),"")
next
Call c.xAxis().setLabels(labels)
END IF

Call layer.setBarShape(cd.StarShape(6), 0)
Call layer.setBarShape(cd.PolygonShape(6), 1)
Call layer.setBarShape(cd.Cross2Shape(), 2)
Call c.yAxis().setTitle("CANTIDAD")
Call c.xAxis().setTitle("HORA")
Call layer.setAggregateLabelStyle(,8,&H0000FF)
Call layer.setAggregateLabelFormat("{value}")
line 117--> Response.BinaryWrite c.makeChart2(cd.PNG)
response.Flush
Response.End
%>

..............................................................
the path from IE is : http://10.225.175.200/ivr/club/GraficadorSucursales1.asp?tipo=0&MRF=frmResolutividad&btnRefrescar0=Refrescar&JBO=btnRefrescar0&Pantalla=&Valor=Refrescar&txtFechaDesde=2009/01/01&txtFechaHasta=2009/09/29&chkEmpresas2=3

Also I did find the problem and run simplepie.asp from aspdemo of chardirector
and run cdinfo.asp and didn't see a problem, all looks good.

The version that I have in the IIs is 4.1

What I will do for fix it?
GraficadorSucursales1.asp

  Re: Jorge
Posted by Peter Kwan on Oct-01-2009 01:26
Hi Jorge,

If the sample code works, but there is "Automation error The object invoked has disconnected from its clients" in the makeChart2 line, the most common cause of the problem is that the data or parameters used to create the chart are invalid or unreasonable.

For example, in your code, you have:

Set c = cd.XYChart(x, y,&HFFFFFF, &H0000FF, 1)

We do not know what is x, and what is y. If x is 5000000 and y is 4000000, then the chart will be very large. When ChartDirector tries to make the chart, the system may run out of memory, causing this problem.

Also, in your code, you have the line:

Call c.setPlotArea(55, 58, x-100, y-100, &Hf8f8f8, -1, -1, &Hf8f8f8, &Hffffff)

If x and y are small, the x-100 and y-100 can become negative, and this may cause simiilar issues.

To diagnose this type of issues, the common methods are:

(a) Replace the variables with hard coded values, like using:

'hard coded - do not change it
x = 500
y = 400

(b) Comment out the code. If you comment out all lines except the two lines cd.XYChart and c.makeChart2, and use hard coded values for x and y, then chart should work (but is empty). You can then add the lines back one by one. This can help to identify if they trigger the problem.


Hope this can help.

Regards
Peter Kwan

  Re: Jorge
Posted by Peter Kwan on Oct-01-2009 05:11

First at all I am very thankfull for your answer. I had to make changes on my configuration, for example:

if x>5000000 then x=1000000
y=500

and your tips was so usefull.



Thanks a lot.