Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Draw Line chart In ASP

    Hi All ,
    Is it possible to draw line chart in asp with access db data? Any special installation or add on component needed to mke this happen? Pls advise & show some sample.Tks

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    very possible and easily done with no components.
    1) you will need a very small 1 pixel image of a color that is viewable against your background.
    2) count the records of your database
    3) use this value to display the results you may have to use a multiplier if the number of results is small


    Here is an example I used to display a bar chart of hits by page:
    Code:
    SQL = "SELECT COUNT(pageName) AS PageCount, hits.pageName, hits.cid FROM hits WHERE pageName = 'home page' AND hits.monthYear = '" & strPeriod & "' GROUP BY hits.pageName, hits.cid ORDER BY COUNT(pageName) DESC"
    objRs.Open SQL, objConn, adOpenStatic, adLockOptimistic
    Dim MaxRecordCounter : MaxRecordCounter = objRs.RecordCount
    'set the width of the horizontal bar 
    barWidth = (CInt(((oRs("PageCount").Value) / MaxRecordCounter) * 100) * 3) + 5
    'display the bar
    Response.Write "<img src=""images/1.jpg"" height=""12"" width=""" & barwidth &""">"
    Last edited by miranda; 09-03-2005 at 10:04 PM.

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Tks for help but wha I am looking for are Line chart but not Bar chart...

  • #4
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Yeah, for that you're going to need a component. Well you probably could do it in straight ASP if you're feeling adventurous but why spend all that time reinventing the wheel? I couldn't reccommend any, I've never used one, but a quick Google for "ASP charting component" throws up hundreds of potential matches.

  • #5
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    you could simulate a line graph using the bar chart method using 1px wide bars and interpolating the data inbetween each step. To just a line, rather than everything under the line coloured in you could use a transparent image with a 1px coloured image on top


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •