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
868 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to hide hide popup page refresh second time? 10 122
format nvarchar field as mm/dd/yyyy 4 68
ASP Button to clear text 4 53
Query still returning duplicates 5 27
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

18 Experts available now in Live!

Get 1:1 Help Now