AppJet
My Apps
App Directory
Docs
Forum
Help
sign in
App:
chart-test.appjet.net
(by
lozc
)
Overview
Source
Docs
Comments (0)
Clone This App
view as plaintext
/* appjet:version 0.1 */
var
simpleEncoding
=
'
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
'
;
function
simpleEncode
(
values
,
maxValue
)
{
var
chartData
=
[
'
s:
'
]
;
for
(
var
i
=
0
;
i
<
values
.
length
;
i
+
+
)
{
var
currentValue
=
values
[
i
]
;
if
(
!
isNaN
(
currentValue
)
&
&
currentValue
>
=
0
)
{
chartData
.
push
(
simpleEncoding
.
charAt
(
Math
.
round
(
(
simpleEncoding
.
length
-
1
)
*
currentValue
/
maxValue
)
)
)
;
}
else
{
chartData
.
push
(
'
_
'
)
;
}
}
return
chartData
.
join
(
'
'
)
;
}
function
renderPage
(
)
{
var
jsonString
=
wget
(
"
http://creator.zoho.com/lozc/json/47/raw=true
"
)
;
var
jsonData
=
eval
(
'
(
'
+
jsonString
+
'
)
'
)
;
var
dataSet
=
[
jsonData
.
Tally
[
0
]
.
before_dawn
,
jsonData
.
Tally
[
0
]
.
morning
,
jsonData
.
Tally
[
0
]
.
afternoon
,
jsonData
.
Tally
[
0
]
.
night
]
;
var
biggest
=
dataSet
[
0
]
;
for
(
x
=
0
;
x
<
dataSet
.
length
;
x
+
+
)
{
if
(
dataSet
[
x
]
>
biggest
)
{
biggest
=
dataSet
[
x
]
}
}
var
tallyEncoded
=
simpleEncode
(
dataSet
,
(
biggest
+
15
)
)
;
var
chartURL
=
"
http://chart.apis.google.com/chart?chs=400x125&chd=
"
+
tallyEncoded
+
"
&cht=lc&chxt=x,y&chxl=0:|before dawn|morning|afternoon|night|1:|0|
"
+
Math
.
round
(
(
biggest
*
.
25
)
)
+
"
|
"
+
Math
.
round
(
(
biggest
/
2
)
)
+
"
|
"
+
Math
.
round
(
(
biggest
*
.
75
)
)
+
"
|
"
+
(
biggest
+
15
)
;
print
(
IMG
(
{
src
:
chartURL
}
)
)
;
print
(
IFRAME
(
{
height
:
"
274px
"
,
width
:
"
100%
"
,
name
:
"
zohoform610
"
,
frameborder
:
"
0
"
,
scrolling
:
"
no
"
,
src
:
"
http://creator.zoho.com/showForm.do?formLinkId=610&link=true&sharedBy=lozc&nexturl=http://chart-test.appjet.com/&open=parent
"
}
)
)
;
}
renderPage
(
)
;
© Copyright 2007-2008 AppJet Inc.