Author |
Topic  |
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 17:21:28
|
I've looked high and low through Snitz for the answer to this but it's either never been explained or i'm looking in the wrong places. Anyway...
I've seen on some forums that the bars which graph the poll results are colour-graded. How would I go about implementing this on my site? Is it something that would appear on all browsers?
Thanks.
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/
Edited by - MarkJH on 23 July 2002 17:27:21 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 17:37:44
|
it is just 2 graphics
<SPAN style="layer-background:URL('<%= strImageUrl %>bar2.gif');background:URL('<%= strImageUrl %>bar2.gif');"><img src="<%= strImageUrl %>spacer.gif" width="<%=nThisVal/1.6%>" height="10"></SPAN>
Here is the bar2.gif

|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 17:50:11
|
it would go where you your image tag is at present, I'm not sure what the original code looked like, so it is a bir difficult to tell you exactly.
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 17:58:47
|
Okay, i've found two instances of bar.gif (the original graphic) in the forum code.
In default.asp:
If trim(vAnswers(nCount)) <> "" Then nThisVal = FormatNumber(vCount(nCount)/nMaxValue * nMaxWidth,0) Response.Write " <tr>" & vbNewline & _ " <td width=""30%""><font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & vAnswers(nCount) & "</font></td>" & vbNewline & _ " <td nowrap><font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """><img src=""bar.gif"" width=""" & nThisVal & """ height=""10""> (" & vPercent(nCount) & "%)</font></td>" & vbNewline & _ " <td nowrap width=""10%""><font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """>" & vCount(nCount) & " votes</font></td>" & vbNewline & _ " </tr>" & vbNewline
End If
In topic.asp:
If trim(vAnswers(nCount)) <> "" Then nThisVal = FormatNumber(vCount(nCount)/nMaxValue * nMaxWidth,0) %> <tr> <td width="30%"><font face="<% =strDefaultFontFace %>" color="<% =strForumFontColor %>" size="<% =strDefaultFontSize %>"><%=vAnswers(nCount)%></font></td> <td nowrap><font face="<% =strDefaultFontFace %>" color="<% =strForumFontColor %>" size="<% =strDefaultFontSize %>"><img src="bar.gif" width="<%=nThisVal%>" height="10"> (<%=vPercent(nCount)%> %)</font></td> <td nowrap width="10%"><font face="<% =strDefaultFontFace %>" color="<% =strForumFontColor %>" size="<% =strDefaultFontSize %>"><%=vCount(nCount)%> votes</font></td> </tr> <% End If
I can't think of anywhere else the image tag would be present.
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/
Edited by - MarkJH on 23 July 2002 17:59:16 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 18:04:14
|
okay, just replace this bit <img src=""bar.gif"" width=""" & nThisVal & """ height=""10"">
with the code I posted
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 18:15:42
|
Tried that on default.asp and got this error:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/forum/Default.asp, line 311
" <td nowrap><font face=""" & strDefaultFontFace & """ color=""" & strForumFontColor & """ size=""" & strDefaultFontSize & """><SPAN style="layer-background:URL('<%= strImageUrl ----------------------------------------------------------------------------------------------------------------------------------------------^
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/ |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 18:25:48
|
in your default.asp code, it is a string so you will need to modify the code I posted by changing the " to "" , the <%= to " & and the %> to & "
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 18:47:29
|
Like this?
<SPAN style=""layer-background:URL('" & strImageUrl & "bar2.gif');background:URL('" & strImageUrl & "bar2.gif');""><img src=""" & strImageUrl & "spacer.gif"" width=""" &nThisVal/1.6& """ height=""10""></SPAN>
Okay, it works in default.asp (the active poll) although for some reason, it looks like the first four results in the active poll have got a white box around them... strange.
It didn't work in topic.asp (example: http://www.bandlink.net/forum/topic.asp?TOPIC_ID=7664) there was no graphic at all displayed.
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/ |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 18:51:23
|
I said you oly needed to modify my code for DEFAULT.asp not topic.asp
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 19:01:55
|
Ack, sorry. Combination of lack of ASP knowledge, a drink, too high a screen rez, tiredness and the late hour caused me misread your instructions.  
Okay, it works all round. Thanks for your help Huw!
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/ |
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 19:17:26
|
it should work in netscape, that is why it has two background styles in the span tag
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 19:26:39
|
Well, it's not working for me on Netscape 6.2 for topic.asp or default.asp
There is something strange though. When the page loads, the graphics do appear then disappear again almost instantaneously. 
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/ |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 23 July 2002 : 19:39:24
|
if you do a view source on the page, what do the <span and <img tags look like.
|
 |
|
MarkJH
Senior Member
   
United Kingdom
1722 Posts |
Posted - 23 July 2002 : 19:44:41
|
From default.asp:
<td nowrap><font face="arial" color="white" size="2"><span style="layer-background:URL('bar2.gif');background:URL('bar2.gif');"><img src="spacer.gif" width="125" height="10"></span> (44.5%)</font></td>
bandlink.net - http://www.bandlink.net/ bandlink music forums - http://www.bandlink.net/forum/ |
 |
|
Topic  |
|