View Full Version : Draw Line chart In ASP
09-03-2005, 07:01 PM
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
09-03-2005, 10:00 PM
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:
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 &""">"
09-04-2005, 04:26 AM
Hi Tks for help but wha I am looking for are Line chart but not Bar chart...
09-05-2005, 02:09 PM
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.
09-05-2005, 02:46 PM
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
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.