webForumDet fria alternativet

Välta stapeldiagram.

ASP

2 svar · 298 visningar · startad av solbulle

Medlem sedan mars 20015 287 inlägg
Frågan#1

Nu har jag fått fatt på ett diagramscript tack vare Jesper. Dock vil jag välta det hela och få till ett liggande diagram av det hela.

Kommer inte långt i denna kod så hjälp skulle sitta bra.

<DIV STYLE="position:relative;left:0;top:0">
	<TABLE BORDER="<%= TABLE_BORDER %>" CELLSPACING="0" CELLPADDING="0" STYLE="position:relative;left:0;top:0">
	<TR>
		<TD VALIGN="bottom"><IMG SRC="./images/spacer_black.gif" BORDER="0" WIDTH="<%= GRAPH_BORDER %>" HEIGHT="<%= GRAPH_HEIGHT %>"></TD>
		<%
		' We're now in the body of the chart.  Loop through the data showing the bars!
		For I = 0 To UBound(aValues)
			iBarHeight = Int((aValues(I) / iMaxValue) * GRAPH_HEIGHT)

			' This is a hack since browsers ignore a 0 as an image dimension!
			If iBarHeight = 0 Then iBarHeight = 1
				%>
			<TD VALIGN="bottom"><IMG SRC="./images/spacer.gif" BORDER="0" WIDTH="<%= GRAPH_SPACER %>" HEIGHT="1"></TD>
			<TD VALIGN="bottom">
			<%
			iii = 0
			For ii = 0 To UBound(aColors) -1
				aTmp(ii) = iii + (Int((aBars(ii+1,I) / iMaxValue) * GRAPH_HEIGHT))
			%>
				<IMG SRC="./images/spacer_<%= aColors(ii) %>.gif"    STYLE="position:absolute; Left:<%= ((iBarWidth +2) * (I)) +6  %>; bottom:-1; z-index:<%= UBound(aColors) - ii %>" BORDER="0" WIDTH="<%= iBarWidth %>" HEIGHT="<%= aTmp(ii) %>" ALT="<%= aBars(ii +1,I) & vbTab & aToolTip(ii) %>">
			<%  
				iii = aTmp(ii) 
			Next 'ii
	Next 'I
%>
	</TD>
	</TR>
	</TABLE>
</div>

Detta är då inte komplett kod, hojt gärna om ni vill ha den, orginalet finns här.

Medlem sedan nov. 20017 144 inlägg
#2

Fulkod kommer här:

   ' Start drawing the graph
   %>
<H2><%= strTitle %></H2>

             
<div style="Border:<%= TABLE_BORDER %>px solid Black;">
              
               <%
               ' We're now in the body of the chart.
               ' Loop through the data showing the bars!
               For I = 0 To UBound(aValues)
                  iBarHeight = Int((aValues(I) / iMaxValue) * GRAPH_HEIGHT)

                  ' This is a hack since browsers ignore a 0 as an image dimension!
                  If iBarHeight = 0 Then iBarHeight = 1
               %>
			   <br>
                  <%
                  iii = 0
                  For ii = 0 To UBound(aColors) -1
                     aTmp(ii) = iii + (Int((aBars(ii+1,I) / iMaxValue) * GRAPH_HEIGHT))
                  %><IMG SRC="spacer_<%= aColors(ii) %>.gif" BORDER="0" WIDTH="<%= aTmp(ii) %>" HEIGHT="<%= iBarWidth %>" ALT="<%= aBars(ii +1,I) & vbTab & aToolTip(ii) %>"><%  
                     iii = aTmp(ii) 
                  Next 'ii
               
               Next 'I
               %>
              </div>
            <%
          
End Sub

Se htmlforumet:
http://www.webforum.nu/showthread.php?s=&threadid=72268

Medlem sedan mars 20015 287 inlägg
#3

Ja du... vad ska man säga? Kanonbra! :)

287 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
120 ms — deklarationer (db)
0 ms — hämta statistik (cache)
164 ms — hämta tråd, inlägg och bilagor (db)
121 ms — ändringar (db)