?
Solved

Graphs in VML

Posted on 2002-03-26
3
Medium Priority
?
206 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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