#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Js data visualization tools


    First time post! I am brand new to web development and am wondering if someone can help me out. Is it possible to use javascript data visualization tools (see datavisualization.ch for examples) to create graphs, plots, etc. but have them compiled directly to an image file, such as a png?

    Intuitively it seems to me if javascript is made for web development, I should still be able to use it "offline" to create the graphics it is typically used to create online.
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,110
    Rep Power
    119
    Look into learning about the HTML5 Canvas element and how you can use JavaScript to display: graphs, plots, images, and etc., with it.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by web_loone08
    Look into learning about the HTML5 Canvas element and how you can use JavaScript to display: graphs, plots, images, and etc., with it.
    Thanks for the reply. Upon re-reading my post it seems I wasn't very clear in what I'm looking for...

    I'm looking to do something along the lines of:
    • write a program in javascript and use the aforementioned tools
    • run the program in my terminal and have it create png or various other image files


    Essentially I am trying to figure out how to use the .js tools without opening a web browser. Is this possible? Any ideas?
  6. #4
  7. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,110
    Rep Power
    119
    JavaScript is a client side scripting language and the browser, is the "client"; so... in short... no. I would look into either C or VB.net or something along those lines; for something like this. You need a program, that is computer based and not browser based... for something like this.
    Last edited by web_loone08; January 14th, 2013 at 09:21 PM.
  8. #5
  9. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    It is actually possible, just not very common. JavaScript is an interpreted language, so you need an interpreter program to run JavaScript scripts. Normally, the scripts are run using an interpreter built into the web browser, but there are interpreters designed to run scripts outside of a browser (one example is Rhino).

    However, this doesn't necessarily mean that any given JavaScript library will be compatible with it. Most JavaScript libraries are designed to work within an HTML page's document object model, which may not exist within the context of a non-web browser interpreter. So those libraries would not work.

    Additionally, unless those libraries are specifically designed to work with a particular interpreter, it's not likely that they would work very well for generating files directly, even if they did run OK within the context provided by the interpreter.

    So in summary, you should use some other language for this.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo