Create a chart object in LotusScript ?

D

doxeone

hello

I'd like to create an object in LotusScript to build dynamic Charts in
a web page,

I don't find the way to create this object in LotusScript...

Any ideas ?

Thanks a lot
 
A

Alvin Bruney - ASP.NET MVP

If the language supports instantiating COM components, use the appropriate
syntax as defined in the language to create a chart object and use its
methods.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
D

doxeone

Hi Alvin and thank you for answering

Do you know where can i find forums or tutorials to find the right
syntaxes for create the object ?

I don't find in the Lotus Notes help...

Thanks a lot & sorry for my english, i'm french :)
 
A

Alvin Bruney - ASP.NET MVP

I don't know of any lotus script resources, however you can get the black
book. It will show you how to build charts in .NET and vb/javascript. From
there, you can simply port the syntax to lotus script.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
D

doxeone

Ok thanks you Alvin :) i succeed in create my object... But i have
another problem now :| i don't have any errors when i run my code but
how can i do to display the charts ?

If the only solution is to "print" a .gif file or is it possible to
embed the component in the page to interact with ??

How can i do for that...?

My current code is :

Sub Initialize
On Error Goto erreur

' On declare le graphique, les constantes et la categorie (echelle des
dates)
Dim ChartSpace1, Cht, axCategory

' On recupere l'objet
Set ChartSpace1 = CreateObject("OWC11.ChartSpace")

With ChartSpace1
.Clear
.Charts.Add
.Charts(0).SeriesCollection.Add
.Charts(0).SeriesCollection(0).Caption = strCaption
.Charts(0).SeriesCollection(0).SetData .Constants.chDimCategories, _
.Constants.chDataLiteral, varCategories
.Charts(0).SeriesCollection(0).SetData .Constants.chDimValues, _
.Constants.chDataLiteral, varValues
.Charts(0).Type = .Constants.chChartTypeBarClustered
.Charts(0).Axes(.Constants.chAxisPositionBottom).NumberFormat =
"$#,##0"
End With

Exit Sub

erreur:
Print Cstr(Err) + " : " + Error$ + " at line " + Cstr(Erl)
Exit Sub
End Sub

thank you
 
A

Alvin Bruney - ASP.NET MVP

the script language must support some form of writing the object to the
response stream for display in the browser, or you can embed the object in
the page using the <clsid> tag, load data and simply display it.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
D

doxeone

I come back here for another problem (one more sorry), i follow your
advices and use intensively the msdn reference to work but i am
discouraged...

I "translate" a vbscript script which is working very well to
lotusscript (which are very similar)
the vbscript's one worked pretty good but not the lotusscript one,
datas are good, there are not the problem.

but in html page the office component launch but the charts are not
builded (image to illustrate this :
http://pix.nofrag.com/09/9b/2662a36b515451f08b354d3b6e50.html at left
the lotusscript at right the vbscript)

here is the code :

VB :

Sub Initialize
On Error Goto erreur

Dim strCat As String
Dim strVal As String

Set s = New notessession
Set db = s.CurrentDatabase
Set contextDoc = s.DocumentContext
docUNID = getQueryVal(contextDoc.Query_String_Decoded(0),"docUNID")
Set queryDoc = db.GetDocumentByUNID(docUNID)

strVal = "Array("
For i=0 To Ubound(queryDoc.Expr2 )
strVal = strVal +|"|+Format$(queryDoc.Expr2(i))+|",|
Next
strVal = Left$(strVal,Len(strVal)-1)
strVal = strVal +")"

strCat = "Array("
For i=0 To Ubound(queryDoc.Expr2 )
strCat = strCat +|"|+Format$(queryDoc.COUNTRY_NAME(i))+|",|
Next
strCat = Left$(strCat,Len(strCat)-1)
strCat = strCat +")"

Print |<html>|
Print |<body>|
Print |<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="ChartSpace1" style="width:100%;"></object>|
Print |</body>|
Print |<script language="vbscript">|
Print |Function Window_OnLoad()|
Print |Set c = ChartSpace1.Constants|
Print |Set oCht = ChartSpace1.Charts.Add|
Print |Set oSer = oCht.SeriesCollection.Add|
Print |oSer.SetData c.chDimCategories, -1, |+strCat+||
Print |oSer.SetData c.chDimValues, -1, |+strVal+||
Print |oSer.Interior.Color = "green"|
Print |End Function|
Print |</script>|
Print |</html>|

Exit Sub

erreur:
Print Cstr(Err) + " : " + Error$ + " at line " + Cstr(Erl)
Exit Sub
End Sub


And the LS :

Sub Initialize
On Error Goto erreur

Dim login As String
Dim password As String
Dim UDLPath As String

Set s = New notessession
Set db = s.CurrentDatabase
Set contextDoc = s.DocumentContext
docUNID = getQueryVal(contextDoc.Query_String_Decoded(0),"docUNID")
Set queryDoc = db.GetDocumentByUNID(docUNID)

originQuery = queryDoc.qQuery(0)
SQLQuery = queryDoc.inWorkQuery(0)

If SQLQuery="" Then
SQLQuery = originQuery
End If

login = queryDoc.qLogin(0)
password = queryDoc.qPassword(0)
UDLPath = queryDoc.qUDLPath(0)
orderBy = queryDoc.orderBy(0)
sortBy = queryDoc.sortBy(0)

Set cn = CreateObject("adodb.connection")
Call cn.open("File Name="+UDLPath+"",login,password)
Set Result = CreateObject("ADODB.Recordset")
Result.Open SQLQuery, cn

Dim strCat As Variant
Dim strVal As Variant

strCat = queryDoc.COUNTRY_NAME
strVal = queryDoc.Expr2

Dim ChartSpace1,c,cht,sc
Set ChartSpace1 = CreateObject("OWC11.ChartSpace")
With ChartSpace1
Set c = .Constants
Set cht = .Charts.Add()
cht.Type = c.chChartTypeColumnClustered

cht.SetData c.chDimSeriesNames, c.chDataLiteral, "test"
cht.SetData c.chDimCategories,c.chDataLiteral, strCat
cht.SeriesCollection(0).SetData c.chDimValues,c.chDataLiteral,
strVal
End With

Print {Content-Type:text/html}
Print |<html>|
Print |<head>|
Print |<title>|+queryDoc.qTitle(0)+|</title>|
Print |<body>|
Print |<object classid="clsid:0002E556-0000-0000-C000-000000000046"
id="ChartSpace1" style="width:100%;"></object>|
Print |</body>|
Print |</html>|

Exit Sub

erreur:
Print Cstr(Err) + " : " + Error$ + " at line " + Cstr(Erl)
Exit Sub
End Sub


Where is the problem ??? i m desperate... thanks for helping
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top