Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Graphs in VML

Posted on 2002-03-26
3
Medium Priority
?
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 600 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

618 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