Solved

How do we create a chart in classic ASP without using the Visual Studio.  Please provide some kind of tutorial.

Posted on 2004-04-11
8
842 Views
Last Modified: 2012-06-27
How do you go about creating a decent dynamic chart (pie and bar) in classic ASP.  Also can someone please do some kind of tutorial with sample data.  I'm sure this will not only benefit me but also all of us who are forced to use ASP and no budget to buy third party software.   I will really appreciate this.

I need to know how viable it is because I am going to the meeting and I want to make sure I can do this before recommending asp.  How do we go about taking result from a query (recordset) and use it as a data in creating my charts in ASP pages.  Thank you

Please help

mdbbound
0
Comment
Question by:mdbbound
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 12

Expert Comment

by:lil_puffball
ID: 10803217
Don't think it's possible in ASP, but you can use a combination of ASP and Javascript. Basically you would get the data from the database using ASP (server side), and write it to javascript records, then call javascript functions to create the graphs (client side).
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 225 total points
ID: 10803253
Here is one approach that we have used some years back:
Charting with Office Web Components (OWC)
http://www.4guysfromrolla.com/webtech/022101-1.shtml

But this should give you an overview of all your options:
Learn More about Graphing!
http://www.4guysfromrolla.com/webtech/LearnMore/Graphing.asp
0
 
LVL 21

Assisted Solution

by:ap_sajith
ap_sajith earned 225 total points
ID: 10803677
I am afraid you will have to use a flash graphing solution if you were to have good looking charts with excellent performance. If you have your own flash programmers, you can easily get them to write a swf for you as there are some good tutorials available for them. Otherwise, i can suggest a few of the existing flash charting components available. The price range differs from $49 for fXgraph to many thousands for globfx.

I have brought and used fxgraph in my applications. It comes with a redistributable licence and flash source code and all this for $49!! (Less than a man day's cost). It saves you a hell lot of time and your app would look great. I have tried using the Javascript graphing solutions and they are all Ugly and crude.. not to mention resource intensive.

FusionCharts - http://www.infosoftglobal.com/FusionCharts (Advanced graphing option of fxgraph below-too pricey)
fXgraph - http://www.infosoftglobal.com/fXgraph (The Best When it comes to value for money)
Swiff Charts - http://www.globfx.com/  (The Best... but Very Very Very Expensive!)
Dundas Charts - http://www.dundas.com/charting/asp/index.aspx?section=ASP&body=body.htm

http://www.aspin.com/home/components/graphics/charts/    -  gives you a full list of components available for you.

I think its not just asp that suffers when it comes to graphing solutions. Almost all the languages would need third party components for good graphing and excellent visual effects.

You might want to have a look at this...http://www.infosoftglobal.com/fXgraph/pricing.html

Cheers!!
0
 
LVL 11

Assisted Solution

by:Slimshaneey
Slimshaneey earned 50 total points
ID: 10812092
Here is some code that I wrote a couple weeks ago for creating simple bar charts. Only ASP and div's used!

<%
      Dim arrVals, iBarWidth, iMaxHeight
      Dim arrColours, arrfonts
'//The colours for the various cols. All looped.
      arrcolours = array("#C93D3D","#00974D", "#FEEE00","#1E6CB5")
      arrfonts = array("white", "white", "black","white")
      iBarWidth = 35
      iMaxHeight = 300
       arrVals = array(101,233,211,44,22,22,55,666,343)      
      
      %>
      <table border=0 padding=0 cellpadding="0"cellspacing="0">
      <tr>            
            <td width=400 align="center">
                  <div id="parentdiv" style="padding:4px;position:relative; height:<%= iMaxHeight + 2%>px; width:<%= (iBarWidth * (Ubound(arrVals,2) + 1) )+ 2%>px; border: 1px solid #000;">
                  <%
                  For i = 0 to UBound(arrVals,2)
                  %>
                        <div id="col1" style="bordercolor:#ffffff;position:absolute;left:<%= iBarWidth * i%>px; top: <%=iMaxHeight - (Cint(arrVals(3,i)*3))%>px; width:<%= iBarWidth%>px;height:<%= Cint(arrVals(3,i)*3)%>px; background-color:<%= arrColours(i mod (uBound(ArrColours) + 1))%>;color:<%= arrFonts(i mod (uBound(ArrFonts) + 1))%>">
                        <div style="height=height:<%= (Cint(arrVals(3,i)*3) - 6)%>px;;writing-mode: tb-rl;filter: flipv flipv;font:  8pt Arial;">&nbsp;<%= MonthName(Month(arrVals(0,i)),true)%><br>&nbsp;<em><strong><%= arrvals(1,i) & " / " & arrVals(2,i) & "-" & Cint(arrVals(3,i)) & "%" %></strong></em></div>
                        </div>
                  <%
                  Next
                  %>
                  </div>
            </td>
      </tr>
      <tr><td style="font:Arial, Helvetica, sans-serif; color:grey; font-size:9px;">Label for chart</td></tr>
</table>
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10812099
Actually, you should use this code, as this works for variable maximum values, whereas the last one is written for percentage values...
Dim arrVals, iBarWidth, iMaxHeight
     Dim arrColours, arrfonts
'//The colours for the various cols. All looped.
     arrcolours = array("#C93D3D","#00974D", "#FEEE00","#1E6CB5")
'//This is then the corresponding font colour for the colours above
     arrfonts = array("white", "white", "black","white")
     iBarWidth = 35
     iMaxHeight = 300
      arrVals = array(101,233,211,44,22,22,55,666,343)    

Dim divValue, tmpVal
      tmpVal = 300
      For i = 0 to Ubound(arrVals,2)
            If tmpVal < arrVals(1,i) then
                  tmpVal = arrvals(1,i)
            End if      
      Next
      
      divValue = 1
      If tmpVal > iMaxHeight then
            divValue = ((tmpVal + 50)/iMaxHeight)
      End if
      
            
      %>
      <table border=0 padding=0 cellpadding="0"cellspacing="0">
      <tr>            
            <td width=400 align="center">
                  <div id="parentdiv" style="padding:4px;position:relative; height:<%= iMaxHeight + 2%>px; width:<%= (iBarWidth * (Ubound(arrVals,2) + 1) )+ 2%>px; border: 1px solid #000;">
                  <%
                  For i = 0 to UBound(arrVals,2)
                  %>
                        <div id="col1" style="bordercolor:#ffffff;position:absolute;left:<%= iBarWidth * i%>px; top: <%=iMaxHeight - (Cint(arrVals(1,i)/divValue))%>px; width:<%= iBarWidth%>px;height:<%= Cint(arrVals(1,i)/divValue)%>px; background-color:<%= arrColours(i mod (uBound(ArrColours) + 1))%>;color:<%= arrFonts(i mod (uBound(ArrFonts) + 1))%>">
                        <div style="height:<%= (Cint(arrVals(1,i)/divValue) - 6)%>px;;writing-mode: tb-rl;filter: flipv flipv;font:  8pt Arial;">&nbsp;<%= MonthName(Month(arrVals(0,i)),true)%> - <%= arrvals(1,i)%></div>
                        </div>
                  <%
                  Next
                  %>
                  </div>
            </td>
      </tr>
      <tr><td style="font:Arial, Helvetica, sans-serif; color:grey; font-size:9px;">Monthly subscription Numbers</em></td></tr>
</table>
0
 

Author Comment

by:mdbbound
ID: 10820915
lil_puffball:

Thanks.  I checked out the link www.4guysfromrolla.com.  It's clean code and with explanation.  I have yet to try it.  It's 2 of the best reference I've seen so far.  Have you ever tried it?

ap  sajith:
I looked at those graphs and they really look great.  I'm trying to find out the differences in pricing $49, $99 $799,  I want to make sure of the licensing and distribution description but could not find it.  I'm probably just too tired.  I'll take a look at it again.  Thanks

Slimshaneey:
Thanks. Wow I can never come up with these code by myself.  I am still trying to understand it.  I have yet to try it.  I'm looking for the  part where it gets its data from a recordset or query as I prefer my charts to be dynamic.  It's 2 of the most manageable and clear code I've seen out there.  Just don't know how the output looks like.  You may also want to checkout the link posted by lil_puffball.

If I had the visual studio or ultradev or interdev, can these tool make it easier to create the chart that we are after.  I have to seen the UI of these tools and have no idea on how to use them.  Although, I've used the Dreamweaver MX (not the 2004) for Coldfusion.  Why would microsoft make it so hard to create these charts.  It's very frustrating.
0
 
LVL 12

Expert Comment

by:lil_puffball
ID: 10827126
actually, the link was from acperkins. ;)
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10827359
Thanks :)

>>Have you ever tried it?<<
And yes, I also said I tried it ("Here is one approach that we have used some years back")
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

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 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…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now