View Full Version : how to create line graph

08-09-2002, 01:11 AM
hi all
i am working on a web page that displays a predicted temperature curve given the daily high and low. So far, I have the two values and the formula to generate temperature
values of every hour of the day, so I have 24 values, and I want to display the results as a smooth curve using JavaScript. I have seen some existing examples on creating Bar graphs, but that doesn't help me much. If anyone can give me some
suggestions and pointers to get started, it will be great!


08-09-2002, 03:39 AM
I can't give you specifics for solving your problem but let me just say I strongly suspect javascript is not up to the task. My fuzzy rememberances of doing curve fitting in an upper-level computer science course is that it was dripping with calculus and it takes a computer language like FORTRAN that's designed for handling heavy-duty math stuff.

Maybe the National Weather Service or National Oceanographic and Atmospheric Administration (NOAA) might be able to help. Couldn't hurt to ask! Maybe they have some reasonably simplistic algorithms for use by the weatherman wannabe.

08-09-2002, 03:52 AM
Are you talking about doing regressions on the data, then creating a single line/power curve/quadratic/something else for the data? If so, that'll be some calculus...

If you just mean smoothly connecting data points, I'd look into SVG and more particularly a <path/> element. :)

08-09-2002, 06:00 AM
I guess it might not be possible in JavaScript. I ended up using Flash MX's chart component, and it turns out great. I just need a simple curve that represents different data points, so FLash is close enough, i guess.

Thanks for your suggestions!