Results 1 to 8 of 8

Thread: Graphs in JavaScript

  1. #1
    VBSpike
    Guest

    Graphs in JavaScript

    Is it possible to create a pie-like chart in javascript (and javascript only with HTML obviously) given the percentages (Just like in Excel - you give the excel the numbers and it generates a nice looking chart). And if it is is it also possible to make it interactive (especially looking for onMouseMove and onMouseOut events).
    If not possible what other method would you choose if you had to draw a pie chart from random numbers (entered by the user)

    Thanks for ANY help

  2. #2
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404

    Talking

    You can't do that with javascript and html ( at least not to my knowledge ).

    I've read on php builder that you can create graphics on the fly in PHP.

    Or perhaps Flash is an option, I wouldn't know where to start though but the afore mentioned are probbaly your best bets.

    Most of the dynamic graphs you see on sites are done with graphing software probably written in Perl. We use some on our Intranet (it costs big £ though).

    Another alternative is Active-X I'm not sure what you can do with this as I've never used it!

    Sorry I couldn't be more help but atleast you now have an idea what to search for info on!

  3. #3
    Frenzied Member JungleMan's Avatar
    Join Date
    Feb 2001
    Posts
    2,033
    Also note that with flash you can export to GIF..but it wouldn't be interactive.

    But yeah, flash is the way to go...

    I heard in DHTML 5.5 there is some way to do charts, but not pie charts.
    I'm bringing geeky back...

  4. #4
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    you can make bar type graphs in javascript using tables. But, it really isin't easy to do pie graphs. I would suggest that you look into php or some asp component to make the PIE graphs. but, there is no client side language that is gonna make pie graphs easily for you.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  5. #5
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    Did you get any where with this? I'm curious on doing the same except I can do it with charts. Don't need pie graphs here.


    How would you do it with tables?

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I've done it by creating solid color square images, then writing the <img width="x"> with a computed x via server-side script.

    When SVG (XML-based graphics format) becomes commonplace, dynamic images generation will be pretty easy, IMHO.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  7. #7
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Take a look at http://objectplanet.com/EasyCharts/ You can download an eval copy of their java applet from their site.

  8. #8
    Addicted Member
    Join Date
    Nov 2001
    Location
    Yewston, Texis
    Posts
    240
    I agree with the others that making the graphics in JavaScript would be weak. And forget about being able to create any graphics elements with curves or angles.

    Now creating a JPG on the fly, that's cool. Someone mentioned PHP having the ability to do this and that's true. If you aren't using PHP, you can still generate graphics on the fly using C and utilizing the GD library (that's what PHP uses). Before doing this, make sure your server policy allows you to run compiled executables via the web server.

    You could really do some neat effects if you generate several related pie images and organize them as rollovers so that as you position the mouse over different slices, they separate from the other slices, pop out in 3-d, and show the numbers. This would involve an image map and tying the rollovers to the image map.

    cudabean

Posting Permissions

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



Click Here to Expand Forum to Full Width