Post by metro on Sept 14, 2015 10:15:35 GMT -5
This is where I show my lack of knowledge
I'm trying to display a selection of charts repeatedly
to one graphic object. seems I have to refresh the whole
screen to get the desired result.(tackling that now)
any help appreciated
UPDATE:
so AJAX is what we need
www.w3schools.com/Ajax/ajax_intro.asp
I'm trying to display a selection of charts repeatedly
to one graphic object. seems I have to refresh the whole
screen to get the desired result.(tackling that now)
any help appreciated
UPDATE:
so AJAX is what we need
www.w3schools.com/Ajax/ajax_intro.asp
'***********
DIM a$(57)
global DR$,ChartCode$
'LOAD ASX CODES
AsxOptCodesList$ = "AGL,AIO,AMC,AMP,ANZ,ASX,AWC,BEN,BHP,BLD,BOQ,BSL,BXB,CBA,CCL,CIM,COH,CPU,CSL,CSR,FMG,FXJ,GPT,HVN,IAG,"
AsxOptCodesList$ = AsxOptCodesList$ + "AJHX,LLC,MQA,MQG,MYR,NAB,NCM,ORG,ORI,OSH,OZL,PPX,QAN,QBE,RIO,SGP,STO,STW,SUN,TAH,"
AsxOptCodesList$ = AsxOptCodesList$ + "TCL,TEN,TLS,TOL,TTS,WBC,WDC,WES,WOR,WOW,WPL,XJO"
for a=1 to 57
a$(a)=WORD$(AsxOptCodesList$,a,",")
next a
selected$=""
Call setCSS
gosub [displaymain]
gosub [displaynav]
'DEFAULT CHART
ChartCode$="^AXJO"
DR$="1y"
gosub [CREATEGRAPHIC]
gosub [DISPLAYCHART]
wait
[select] 'LISTBOX CHOICE
selected$=#lb selection$()
print
ChartCode$=selected$
if ChartCode$<>"XJO" then
ChartCode$=ChartCode$+".AX"
end if
if ChartCode$="XJO" then
ChartCode$="^A"+ChartCode$
end if
GOSUB [DISPLAYCHART]
WAIT
[displaynav]
div navigation
print "Menu"
print
listbox #lb,a$(),1
print
print
link #sel, "Get Selection",[select]
print
print
print
link #d1, "One Day", [BuildChart]
link #d5, "Five Days", [BuildChart]
link #m3 , "Three Months", [BuildChart]
link #m6, "Six Months", [BuildChart]
link #y1, "ONE YEAR", [BuildChart]
link #y2, "TWO YEARS", [BuildChart]
link #y5, "FIVE YEARS", [BuildChart]
link #ya, "All HISTORY", [BuildChart]
#d1 CSSClass("fancyButton")
#d5 CSSClass("fancyButton")
#m3 CSSClass("fancyButton")
#m6 CSSClass("fancyButton")
#y1 CSSClass("fancyButton")
#y2 CSSClass("fancyButton")
#y5 CSSClass("fancyButton")
#ya CSSClass("fancyButton")
end div
RETURN
WAIT
[CREATEGRAPHIC]
graphic #g, 800, 600
RETURN
[DISPLAYCHART]
urlfile$ = "http://chart.finance.yahoo.com/z?s=" +ChartCode$+ "&t="+DR$+"&q=l&l=on&z=l&p=m10,m50,v&a=r14 "
page$=HTTPGET$(urlfile$)
open "pic.png" for binary as #1
print #1, page$
close #1
'Load the image
loadimage "picture", "pic.png"
'create a graphic object.
'draw the image in the graphic object.
#g place(0,0)
#g drawimage("picture",0,0)
'display it on the web page
render #g
RETURN
[displaymain]
div Container 'Main
html "<head>"
html "<h1> ASX CHARTS</h1>"
html "</head>"
html "<div align='right'>"
end div
RETURN
'***********************SUBS************************
[BuildChart]
' 'SETUP DATE RANGES AVAILABLE
' timespan$="1d,5d,3m,6m,1y,2y,5y,my"
print " ":print "Handle is ";EventKey$
if EventKey$= "#d1" then DR$="1d"
if EventKey$= "#d5" then DR$="d5"
if EventKey$= "#m3" then DR$="m3"
if EventKey$= "#m6" then DR$="m6"
if EventKey$= "#y1" then DR$="y1"
if EventKey$= "#y2" then DR$="y2"
if EventKey$= "#y5" then DR$="y5"
if EventKey$= "#ma" then DR$="ma"
GOSUB [DISPLAYCHART]
WAIT
Sub setCSS
CSSID #Container, "{
align center
margin-left: auto;
margin-right: auto;
width: 70%;
Margin: 20px Auto;
Background-Color: #C6C6B8;
Font-Family: Tahoma;
Font-Size: 1em;
Font-Weight: Bold;
Text-Align: Center;
Color: Black;
Width: 1100px;
Height: 710px;
Padding: 20px 20px 0px 10px;
Border-Color: #45453D;
Border-Size: Thick;
Border-Style: Ridge;
Border-Bottom-Style: Ridge;
}"
cssid #navigation, "{
font-family: Tahoma;
font-size: small;
color: #CC0000;
border-right: 3px solid #666666;
background: #ADAD99;
padding: 4px;
width: 250px;
height: 570px;
float: left;
white-space: normal;
background-repeat: repeat;
background-image: url('/pagebg.PNG');
Text-Align: Center;
}"
'********************************************************
CSSID #footer, "{
Background-Color:#77776E;
Font-Family: Verdana;
Width: 1100px;
Height: 25px;
Padding: 5px 5px 5px 0px;
Text-Align: Center;
}"
CSSID #mytable, "{
Font-Family: Verdana;
Font-Size: .75em;
Padding: 10px 10px 0px 0px;
Width: 675px;
Height: 570px;
Background-Color: #FFFFFF;
overflow-y: scroll;
}"
CSSID #h1, "{
font-family: Tahoma;
display: block;
font-family: Tahoma;
color: #3D3D1F;
font-size: 2em;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}"
'minimum CSSClass to make a link look like a button
CSSClass "a.linkButton", "{
align center
Width: 140px;
Height: 30px;
Text-Align: Center;
Border-Width: Medium;
Border-Style: Outset;
Text-Decoration: None;
Display: Block;
}"
'more styles added
CSSClass "a.fancyButton", "{
align center;
Text-Decoration: None;
Font-Size: 14pt;
Font-Weight: Bold;
Width: 240px;
Height: 30px;
Display: Block;
Background: #C0C0C00;
Color: #000000;
Text-Align: Center;
Border-Width: Thick;
Border-Style: Outset;
Border-Color: #AAAAAA;
}"
End Sub