Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2004, 06:30 AM
Authorized User
 
Join Date: Nov 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default graph

Having experimented with one component for drawing a line graph (see my earlier thread) ive been unable to get it to work the way that i want it to. Can anyone give me any advice on the best way to draw a line graph using asp.

The information is stored in an access database, with the y axis having a numerical value and the x axis a date value. ie test on 19/07/04 value is 4 etc.


Any help is greatly appreciated

Paul

 
Old July 26th, 2004, 08:09 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

I suppose your problem is to give a date type value as the Y-Axis scale. Not every chart tools will permit a non-numeric value at the axis.

You can try showing only the date part of the date value as the Y Axis scale.

BTW, which is the component you are using ? The one I usually use is Chart director from http://www.advsofteng.com

Could you please explain the nature of the graph so I may able to help you further.
 
Old July 26th, 2004, 08:18 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

I have just confirmed that ChartDirector can accept only days as the X / Y axis values and use a lable for each date. This means you can use day part of the date as the Y Axis value and then each such day value may be given a corresponding label whose text is the complete date.

For e.g. Suppose you are plotting daily sales variations from 1st of month to 31st of month, you can have 31 equally spaced co-ordinates at X-Axis. They corresponds to one date each. The val;ue of these co-ordinates will be from 1 to 31. Then at each of these points you can specify the label as 1st Jul 04, 2nd Jul04, etc. etc.

This must be possible in your component also.
 
Old July 26th, 2004, 09:02 AM
Authorized User
 
Join Date: Nov 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The components is called csGraph. It may work in the same way as the one you use. How would the day number work, if for example the values spanned across several months, for example test data for two months with one test every single day? as i presume the day number after 31 would revert back to one?

thanks for all of your help

 
Old July 26th, 2004, 09:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

If the data is spanned across more than one month (or year), you can create the value for a date as below.

iDatePart=day(datevalue)
iMonthPart=month(datevalue)
iYearPart=Year(datevalue)

lYValue=10000 * iYearPart + 100* iMonthPart + iDatePart

The max value of lYValue will be 99991231 which is very well below the maximum integer that can be handled by ASP.

You can use lYValue as the Y Cordinate value and give cdate(datevalue) as the lable part.

You can decide the max of such a value and the minimum of it (corresponding to the last date and first date). Then you can decide the scale to be used.

It is ofcourse not possible to show all the dates over past 10 years in a single graph. You may need to filter data and show results in more than one graph (perhaps one graph per year or so). But this is a design issue and need to be talked with your client.
 
Old July 26th, 2004, 10:06 AM
Authorized User
 
Join Date: Nov 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey thats great!, Many many thanks, thankfully i dont think the client will need ten years worth of data ( i hope!)

thanks again
Paul






Similar Threads
Thread Thread Starter Forum Replies Last Post
TO draw a graph shravanmv Visual Basic 2008 Essentials 0 May 12th, 2008 11:53 PM
Graph Problems ryan_goal C++ Programming 0 October 7th, 2006 03:08 AM
Graph in asp mateenmohd Classic ASP Basics 0 June 2nd, 2006 11:05 AM
UPDATE: Can't see my graph inge_03 Crystal Reports 0 March 20th, 2006 11:44 AM
graph pab006 Classic ASP Basics 1 April 30th, 2004 10:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.