Tip

Creating a column color chart on a Web page using LotusScript

Adding this LotusScript code to an agent will create a simple column chart on a Web page using divs. The script generates random colors and values, so you may need to provide your own values if you want further customization.

You can see a demo here: http://www.notessidan.se/A55B53/blogg.nsf/pixel?Openagent

Sub Initialize
 
Dim session As New notessession,db 
As notesdatabase,doc As notesdocument 
Dim i As Integer, 
x As Integer,y As Integer, z As Integer,
h As Integer,v As Integer, s As Integer,
t As Integer
 
Print "<style css>"
Print |.frame{position:absolute;z-index:100;
background-color:white;
border-left:1px;border-right:1px;border-top:0px;
border-bottom:0px;
border-color:black;border-style:solid;width:500px;
height:300px;top:50px;left:50px;}|
Print |.stapel{position:absolute;z-index:10;
border-left:1px;border-right:1px;
border-top:1px;border-bottom:1px;
border-color:black;border-style:solid;
font-family:verdana;font-size:10px;text-align:center;
bottom:0px;width:30px}|
Print |.month {position:absolute;z-index:10;
border:0px;border-color:black;
border-style:solid;font-family:verdana;
font-size:10px;text-align:center;
background-color:white;bottom:-25px;
width:30px;height:20px}|
Print | .left {position:absolute;z-index:-100px;
border-top:0px;border-left:0px;
padding:0px;border-right:0px;
border-bottom:1px;border-color:black;
border-style:solid;font-family:verdana;
font-size:10px;text-align:left;
background-color:none;left:-30px;
width:530px;height:20px}|
Print "</style>"
 
v = 10
Print |<div class=frame>|
For i = 1 To 12
 h = Int(Rnd * 300) 
 x = Int(Rnd * 256) 
 y = Int(Rnd * 256) 
 z = Int(Rnd * 256) 
 Print |<div class=stapel title=
"| + mo(i) + |: | + Cstr(h) + |" 
style=background-color:rgb
(|Cstr(x)|,| + Cstr(y) + |,| + Cstr(z) + |);left:| + 
Cstr(v) + |px;height:| + Cstr(h) + |px>| 
+ Cstr(h) + |</div>|
Print |<div class=month style=left:| 
+ Cstr(v) + 
|px;>| + mo(i) + |</div>|  
v = 40*i + 10
Next 
 
t = 0
For s = 1 To 4
Print |<div class=left style=bottom:| 
+ Cstr(t) + |>| + Cstr(t) + |</div>|  
t = 100*s
Next
Print |</div>|
End Sub

Function mo(no As Integer) As String
 
Select Case no
Case 1:mo = "Jan"
Case 2:mo = "Feb"
Case 3:mo = "Mar"
Case 4:mo = "Apr"
Case 5:mo = "May"
Case 6:mo = "Jun"
Case 7:mo = "Jul"
Case 8:mo = "Aug"
Case 9:mo = "Sep"
Case 10:mo = "Okt"
Case 11:mo = "Nov"
Case 12:mo = "Dec"
End Select
 
End Function

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Thomas Adrian. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was first published in August 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.