• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1025
  • Last Modified:

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

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
mdbbound
Asked:
mdbbound
  • 2
  • 2
  • 2
  • +2
3 Solutions
 
lil_puffballCommented:
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
 
Anthony PerkinsCommented:
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
 
ap_sajithCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
SlimshaneeyCommented:
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
 
SlimshaneeyCommented:
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
 
mdbboundAuthor Commented:
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
 
lil_puffballCommented:
actually, the link was from acperkins. ;)
0
 
Anthony PerkinsCommented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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