Solved

Graphs in VML

Posted on 2002-03-26
3
189 Views
Last Modified: 2008-02-26
Has anyone got a simple example of how I can dynamically produce a bar chart on a web page based on a differing recordset - using VML

I need a simple example where I can specify the limits of the X and Y axis and the differing height of 3 bars.

I believe VML is the best way to do this. If not what other options are there without any client side requirements.

Thanks
0
Comment
Question by:carlmc
  • 3
3 Comments
 
LVL 3

Expert Comment

by:barryfandango
Comment Utility
carlmc,

If your graphing needs are relatively simple, you could generate a simple HTML table to create your graph, in the form of a horizontal bar chart.  This would guarantee client-side compatibility.

i.e. given a recordset rs with two fields, "name" and "value,"

...
<table width=100%>
<%
xlimit = 100
do while not rs.eof
  %>
  <tr><td align=right><%=rs("name")%></td><td>

  <table width=100% bgcolor=blue><tr><td width=<%=(rs("value")/xlimit)*100 %></td><td></td></tr></table>

  </td><td></td></tr>
  <%
loop
%>
</table>
...

You could add modifications to cycle the color as well.
0
 
LVL 3

Accepted Solution

by:
barryfandango earned 200 total points
Comment Utility
And here is an example of a vertical bar chart :

...
<table cellpadding=5>
<tr>
<%
ylimit = 100
tableheight = 300
do while not rs.EOF
%>
<td valign=bottom>
<table height=<%=(rs("value")/ylimit)*tableheight%> bgcolor=blue><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>
</td>
<%
loop
%>
</tr><tr>
<%
rs.movefirst
do while not rs.eof
%>
<td><%=rs("name")%></td>
<%
loop
%>
</tr></table>
...

if you take advantage of the various table parameters (ie cellpadding, etc) you have considerable formatting options.  To change the width of the bars, increase or decrease the number of "&nbsp"'s in each one.  To change the spacing between them, modify the cellpadding parameter, etc etc.
0
 
LVL 3

Expert Comment

by:barryfandango
Comment Utility
carlmc,

do these help answer your question?  Is there any other information you need?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now