Click here to Skip to main content
15,897,371 members
Articles / Web Development / HTML

Discover ISAPI. Feed Provider for Graphical Applets

Rate me:
Please Sign up or sign in to vote.
4.00/5 (9 votes)
16 May 20023 min read 74.1K   2.3K   45  
Sample of using ISAPI extension to give online data to graphical applets.
  • isapidemofeed.zip
  • aspdemofeed.zip
    • AspDemoFeed
      • cgi-bin
        • IsapiDemoFeed.dll
      • Default.asp
      • HTML_End.asp
      • HTML_Head.asp
      • Images
        • Cat.gif
        • Competition.GIF
        • History.GIF
        • IntradayIndex.GIF
        • IntradayTicker.GIF
        • JStable.GIF
        • MarketMap.gif
        • Scroller.GIF
        • spacer.gif
        • Table.GIF
      • Includes
      • style.css
      • Tools
        • GraphHistory
          • Classes
            • Images
              • _vti_cnf
                • bckg1.jpg
                • bckg2.jpg
                • Bkg.gif
              • bckg1.jpg
              • bckg2.jpg
              • Bkg.gif
            • index.html
            • QuoteView.class
            • SimpleChart$Row.class
            • SimpleChart.class
            • Ticker$Quote.class
            • Ticker.class
            • TickerHistoryApplet$1.class
            • TickerHistoryApplet$2.class
            • TickerHistoryApplet.class
            • vssver.scc
          • GraphHistory.asp
          • Images
            • bckg1.jpg
            • bckg2.jpg
            • Bkg.gif
        • GraphHistoryCompetition
          • Classes
            • Bkg.gif
            • CompetitionChartApplet.class
            • index.html
            • SimpleChart$Row.class
            • SimpleChart.class
            • Ticker$Quote.class
            • Ticker.class
          • GraphHistoryCompetition.asp
          • Images
            • _down.gif
            • _up.gif
            • Bkg.gif
        • MarketMap
          • _vti_cnf
          • CLASSES
            • _vti_cnf
              • intTable.class
              • MarketMap.class
              • MarketMapApplet$1.class
              • MarketMapApplet$2.class
              • MarketMapApplet.class
              • Sector.class
              • SectorName_ID.class
              • Ticker.class
              • TickerView.class
            • intTable.class
            • MarketMap.class
            • MarketMapApplet$1.class
            • MarketMapApplet$2.class
            • MarketMapApplet.class
            • Sector.class
            • SectorName_ID.class
            • Ticker.class
            • TickerView.class
          • Images
            • 0.GIF
            • 1.GIF
            • -1.GIF
            • 10.GIF
            • -10.GIF
            • 2.GIF
            • -2.GIF
            • 3.GIF
            • -3.GIF
            • 4.GIF
            • -4.GIF
            • 5.GIF
            • -5.GIF
            • 6.GIF
            • -6.GIF
            • 7.GIF
            • -7.GIF
            • 8.GIF
            • -8.GIF
            • 9.GIF
            • -9.GIF
            • Logo_Market_Map.gif
            • transparent.gif
          • MarketMap.asp
        • OnlineCharts
          • Classes
            • IntradayChart
              • DataProvider.class
              • Debug.class
              • IntradayChart$1.class
              • IntradayChart$2.class
              • IntradayChart.class
              • SimpleChart$Row.class
              • SimpleChart.class
              • StripChart.class
              • Ticker.class
              • TickerListener.class
            • IntradayVolume
              • DataProvider.class
              • Debug.class
              • IntradayVolume$1.class
              • IntradayVolume$2.class
              • IntradayVolume$3.class
              • IntradayVolume.class
              • SimpleChart$Row.class
              • SimpleChart.class
              • StripChart.class
              • Ticker.class
              • TickerListener.class
          • Images
            • bgTitle.gif
            • bgTitle2.gif
            • bgTitle3.gif
          • OnlineChartIndex.asp
          • OnlineChartTicker.asp
        • OnlineJStable
          • Classes
            • AutomatFeed.class
            • Debug.class
          • Images
            • _down.gif
            • _up.gif
            • down.gif
            • up.gif
          • OnlineJStable.asp
        • OnlineScroll
          • Classes
            • JavaScroller.coada
              • _vti_cnf
                • datafeed.TXT
                • index.html
                • Loader$Quote.class
                • Loader.class
                • rp.class
                • Scroller.class
              • datafeed.TXT
              • index.html
              • Loader$Quote.class
              • Loader.class
              • rp.class
              • Scroller.class
              • vssver.scc
            • JavaScroller
              • Scroller.jar
          • Images
            • head_scroller.gif
            • ticker_faster.gif
            • ticker_slower.gif
          • OnlineScrollBar.asp
        • OnlineTables
  • db.zip
<!--#include file="../../Includes/_incConnexionOn.asp" -->
<%
sCurr		= "GRD"
sLng		= "ENG"
iIdTicker	= 238

sub OptionListMonths()
Dim i
for i = 1 to 12
	Response.Write "<option value=" & i & ">" & monthname(i, true) & "</option>"
next
end sub

function ZeroNull(field, decimals) 
	if field ="" or field = 0 or isnull(field) then 
		ZeroNull = "N/A"
	else
		ZeroNull = formatnumber(field,decimals)					
	end if
end function

intFirstYear = 1995

Function GetRSDate(id)
	Dim strSQL, objRS
	strSQL = "SELECT max(date) as maxdate FROM vwHistoryData WHERE IdTicker = " & id
		 			 
	Set objRS = Server.CreateObject("ADODB.Recordset")
	objRS.CursorType = 3
	objRS.Open  strSQL, cnx
	Set GetRSDate = objRS
End Function


Dim rsRS 
Set rsRS = Server.CreateObject("ADODB.Recordset")
rsRS.CursorType = 3
set rsRS = GetRSDate(iIdTicker)


%>

<script LANGUAGE="JavaScript"><!--

function refreshChart()
{
	var endDay = document.chartForm.EndDay.options[document.chartForm.EndDay.selectedIndex].text;
	var endMonth = document.chartForm.EndMonth.options[document.chartForm.EndMonth.selectedIndex].value;
	var endYear = document.chartForm.EndYear.options[document.chartForm.EndYear.selectedIndex].text;
	var beginDay = document.chartForm.BeginDay.options[document.chartForm.BeginDay.selectedIndex].text;
	var beginMonth = document.chartForm.BeginMonth.options[document.chartForm.BeginMonth.selectedIndex].value;
	var beginYear = document.chartForm.BeginYear.options[document.chartForm.BeginYear.selectedIndex].text;
	
	var beginDate = beginMonth + "/" + beginDay + "/" + beginYear;
	var endDate = endMonth + "/" + endDay + "/" + endYear;
	
	document.chart.reloadData(beginDate, endDate);
}

function refreshChart2(beginDate, endDate)
{
	document.chart.reloadData(beginDate, endDate);
	setupInterval(beginDate, endDate);
}

function zoomOut(){
	document.chart.zoomOut();
}

function changeTo(how){
	document.chart.setChart(how);
}

function setupInterval(beginDate, endDate)
{
	var beginMonth = beginDate.split('/')[0];
	var beginDay = beginDate.split('/')[1];
	var beginYear = beginDate.split('/')[2];
	
	var endMonth = endDate.split('/')[0];
	var endDay = endDate.split('/')[1];
	var endYear = endDate.split('/')[2];
	
	for (var i=0; i < document.chartForm.BeginDay.options.length; i++)
	{
		if (beginDay == document.chartForm.BeginDay.options[i].text)
		{
			document.chartForm.BeginDay.options[i].selected = true;
		}
		else
		{
			document.chartForm.BeginDay.options[i].selected = false;
		}
	}
	
	for (var i=0; i < document.chartForm.BeginMonth.options.length; i++)
	{
		if (beginMonth == document.chartForm.BeginMonth.options[i].value)
		{
			document.chartForm.BeginMonth.options[i].selected = true;
		}
		else
		{
			document.chartForm.BeginMonth.options[i].selected = false;
		}
	}
	
	for (var i=0; i < document.chartForm.BeginYear.options.length; i++)
	{
		if (beginYear == document.chartForm.BeginYear.options[i].text)
		{
			document.chartForm.BeginYear.options[i].selected = true;
		}
		else
		{
			document.chartForm.BeginYear.options[i].selected = false;
		}
	}
	
	for (var i=0; i < document.chartForm.EndDay.options.length; i++)
	{
		if (endDay == document.chartForm.EndDay.options[i].text)
		{
			document.chartForm.EndDay.options[i].selected = true;
		}
		else
		{
			document.chartForm.EndDay.options[i].selected = false;
		}
	}

	for (var i=0; i < document.chartForm.EndMonth.options.length; i++)
	{
		if (endMonth == document.chartForm.EndMonth.options[i].value)
		{
			document.chartForm.EndMonth.options[i].selected = true;
		}
		else
		{
			document.chartForm.EndMonth.options[i].selected = false;
		}
	}
	
	for (var i=0; i < document.chartForm.EndYear.options.length; i++)
	{
		if (endYear == document.chartForm.EndYear.options[i].text)
		{
			document.chartForm.EndYear.options[i].selected = true;
		}
		else
		{
			document.chartForm.EndYear.options[i].selected = false;
		}
	}
}


//--></script>

<!--		<br><B>Usage:</B><br>		  - click right mouse button to get in/out of detail mode<br>		  - in detail mode drag the mouse to scroll the chart<br><br>-->
<%

Dim maxDate, maxBDate, intMonth, intDay, intYear, intBMonth, intBDay, intBYear 
Dim maxB3Date, maxB6Date, maxB12Date

maxDate = rsRS("maxdate")

maxBDate = maxDate - 12*30			'12 months before end date												
intDay = Day(maxDate)
intMonth = Month(maxDate)
intYear = Year(maxDate)

intBDay = Day(maxBDate)
intBMonth = Month(maxBDate)
intBYear = Year(maxBDate)
maxB3Date = maxDate - 90
maxB6Date = maxDate - 180
maxB12Date = maxDate - 360

'Response.Write maxDate &  "<br>"
'Response.Write intBMonth & "/" & intBDay & "/" & intBYear
'Response.end			
%>
<head>
	<title>GRAPH HISTORY</title>
	<META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<META HTTP-EQUIV="cache-control" VALUE="no-cache, no-store, must-revalidate">
	<meta http-equiv="Content-Type" content="text/html; charset=Windows-1253">
	<link REL="STYLESHEET" HREF="../Style.css" TYPE="text/css">
</head>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000392" VLINK="#000392" ALINK="#000392" LEFTMARGIN=0 TOPMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0>

<table width="438" border="0" cellspacing="0" cellpadding="0">
	<tr>		
		<td></td>
	</tr>
	<tr>
		<td height=1 bgcolor="#000000"><img src="../../Images/spacer.gif" width="1" height="1" alt border="0"></td>
	</tr>
	<tr>
		<td align="center">
			<applet CODE="TickerHistoryApplet.class" codebase="CLASSES/" WIDTH="438" HEIGHT="300" id="chart" name="chart" VIEWASTEXT>
			<!--this should be the ID not the symbol! Use FAKE for random generated values-->
			<param name="tickerID" value="<%=iIdTicker%>">
			<!--start date of the history :) MM/DD/YY-->
			<param name="beginDate" value="<%=intBMonth & "/" & intBDay & "/" & intBYear%>">
			<!--end date of the history :) MM/DD/YY -->
			<param name="endDate" value="<%=intMonth & "/" & intDay & "/" & intYear%>">
			<!-- currency -->
			<param name="currency" value="<%=sCurr%>">
			<!-- language -->
			<param name="lang" value="<%=sLng%>">
			<!-- baseURL to get data from. A HTTP QUERY_STRING will be appended -->
			
			<param name="baseURL" value="<%=Application("WebURL")%>cgi-bin/IsapiDemoFeed.dll?GetHistoryData">
		    <!--background color-->
			<param name="upTooltipColor" value="105973">
			<param name="downTooltipColor" value="105973">
			<param name="separator" value=",">
			<param name="lineCount" value="1">
			<param name="lineColors" value="000000">
			<param name="lineThickness" value="1">        
			<param name="decimalsPrecision" value="1">
			<param name="fontName" value="Verdana">
			<param name="fontSize" value="11">    
			<!-- fontStyle can contain values: BOLD, ITALIC (or both) or PLAIN-->
			<param name="fontStyle" value="PLAIN">
			<param name="legendFontColor" value="FFFFFF">
			<param name="fontColor" value="000000">
			<param name="mouseDragLineColor" value="ff0000">
			<param name="crossColor" value="ff0000">
			<param name="gridColor" value="105973">
			<param name="axesColor" value="105973">
			<param name="axesShadowColor" value="FFFFCC">
			<param name="backgroundColor" value="FCE6C7">
			<!-- backGround image can be in gif/jpg format; must be located in the classes` directory -->
			<param name="backgroundImage" value="none">
			<param name="borderColor" value="105973">
			<param name="Header" value="Date:,High:,Low,Last Price:,  Risk:,Change:,Volume:">
			</applet>
		</td>
	</tr>
</table>

<table border="0" cellspacing="0" cellpadding="1" bgcolor="#939393" align="center">
	<tr>
		<form NAME="chartForm">
		<td>
			<table cellspacing="1" cellpadding="0" border="0" bgcolor="#FCE6C7">
				<tr>
					<td class="TableB"><%="BeginDate"%></td>
					<td class="TableB">
						<select ID="BeginMonth" NAME="BeginMonth" class="TableB">
								<%call OptionListMonths()%>
						</select>
					</td><td class="TableB">
						<select ID="BeginDay" NAME="BeginDay" class="TableB">
							<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option>
							<option>6</option><option>7</option><option>8</option><option>9</option><option>10</option>
							<option>11</option><option>12</option><option>13</option><option>14</option><option>15</option>
							<option>16</option><option>17</option><option>18</option><option>19</option><option>20</option>
							<option>21</option><option>22</option><option>23</option><option>24</option><option>25</option>
							<option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option>
						</select>
					</td><td class="TableB">
						<select ID="BeginYear" NAME="BeginYear" class="TableB">
						<%'Begin part two of added by mus
						intLastYear = YEAR(Date())
						For intCurrentYear = intFirstYear To intLastYear
						%>
							<option><%=intCurrentYear%></option>
						<%Next
						'End of part two of added by mus%>	
						</select>
					</td>
				</tr><tr>
					<td class="TableB">
						<%="EndDate"%>
					</td><td class="TableB">
						<select ID="EndMonth" NAME="EndMonth" class="TableB">
								<%call OptionListMonths()%></select>
					</td><td class="TableB">
						<select ID="EndDay" NAME="EndDay" class="TableB"> 
							<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option>
							<option>6</option><option>7</option><option>8</option><option>9</option><option>10</option>
							<option>11</option><option>12</option><option>13</option><option>14</option><option>15</option>
							<option>16</option><option>17</option><option>18</option><option>19</option><option>20</option>
							<option>21</option><option>22</option><option>23</option><option>24</option><option>25</option>
							<option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>31</option>
						</select>
					</td><td class="TableB">
						<select ID="EndYear" NAME="EndYear" class="TableB">
							<%'Begin part three of added by mus
							intLastYear = YEAR(Date())
							For intCurrentYear = intFirstYear To intLastYear
							%>
								<option><%=intCurrentYear%></option>
							<%Next
							'End of part three of added by mus and all end%>	
						</select>
					</td>
				</tr>
			</table>
		</td><td align="right">
			<table cellspacing="1" cellpadding="0" border="0" bgcolor="#FCE6C7" width="100%">
				<tr>
					<td class="TableB">
						<select name="chartType" id="chartType" onChange="changeTo(this.options[this.options.selectedIndex].value);" class="TableB">
							<option value="price"><%="Price"%></option>
							<option value="volume"><%="Volume"%></option>
							<option value="volatility"><%="Risk"%></option>				
						</select>
					</td><td class="TableB" align="right">
						<select name="chartIntervalCH" id="chartIntervalCH" onChange="refreshChart2(this.options[this.options.selectedIndex].value,'<%=intMonth%>/<%=intDay%>/<%=intYear%>');" class="TableB">
							<option value="<%=intBMonth%>/<%=intBDay%>/<%=intBYear%>"><%="OneMonth"%></option>
							<option value="<%=Month(maxB3Date)%>/<%=Day(maxB3Date)%>/<%=Year(maxB3Date)%>"><%="3Months"%></option>
							<option value="<%=Month(maxB6Date)%>/<%=Day(maxB6Date)%>/<%=Year(maxB6Date)%>"><%="6Months"%></option>
							<option value="<%=Month(maxB12Date)%>/<%=Day(maxB12Date)%>/<%=Year(maxB12Date)%>"><%="OneYear"%></option>
						</select>
					</td>
				</tr><tr>
					<td class="TableB" colspan="2" align="center">
						<input TYPE="BUTTON" VALUE="<%="RefreshChart"%>" onClick="refreshChart();" id="BUTTON1" name="BUTTON1" class="TableB">
						<input TYPE="BUTTON" VALUE="<%="ZoomOut"%>" onClick="zoomOut();" id="zoom" name="zoom" class="TableB">
					</td>
				</tr>
			</table>
		</td>
		</form>
	</tr>
</table>


<script LANGUAGE="JavaScript"><!--
document.onLoad=setupInterval('<%=intBMonth%>/<%=intBDay%>/<%=intBYear%>', '<%=intMonth%>/<%=intDay%>/<%=intYear%>');
//--></script>

<!--#include file="../../Includes/_incConnexionOff.asp" -->

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer
Romania Romania
I make programming for over 4 years and extensive experience in C++, ASP, Pascal, MFC, COM+, ATL, TCP/IP, HTTP protocols, XML, XSL, SOAP and SQL.
For the last 2 years i working extensively at the background of financial sites (databases, n tier architecture).

I’m available for contracts and/or outsourcing (<Adrian Bacaianu>adrian_bacaianu@yahoo.com).

Comments and Discussions