[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Graphs in VML

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
carlmc
Asked:
carlmc
  • 3
1 Solution
 
barryfandangoCommented:
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
 
barryfandangoCommented:
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
 
barryfandangoCommented:
carlmc,

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now