Solved

Graphs in VML

Posted on 2002-03-26
3
193 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
ID: 6896920
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
ID: 6897116
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
ID: 6910877
carlmc,

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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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 was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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