---
title: "Välta stapeldiagram."
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/73730-välta-stapeldiagram"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "solbulle"
published: "2003-04-10T20:12:33.000Z"
updated: "2003-04-11T21:32:27.000Z"
replies: 2
views: 305
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/73730-välta-stapeldiagram"
---

# Välta stapeldiagram.

## #1 — solbulle, 2003-04-10T20:12Z

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.](http://www.asp101.com/samples/bar_chart_stacked.asp)

Permalänk: https://www.webforum.nu/p/73730

## #2 — Jesper T, 2003-04-11T19:41Z

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>

Permalänk: https://www.webforum.nu/p/1008735

## #3 — solbulle, 2003-04-11T21:32Z

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

Permalänk: https://www.webforum.nu/p/1008802

---

Tråden på webben: https://www.webforum.nu/amne/asp/73730-välta-stapeldiagram
