Manage Learn to apply best practices and optimize your operations.

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.

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.

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close