Menu

#515 support for d3.js, X3D, gITF or GeoTIFF image formats for interactive web plotting? (rotation using mouse and x,y and z coordinates on the mouse cursor for 3d plots)

open
nobody
None
5
2020-12-14
2020-10-17
No

Interactive plots on the web are a really important aspect of plotting, as of 2020! gnuplot is really feature rich but its hard to choose it over other plotting programs, especially when you've to make presentations and so.

Discussion

  • Anonymous

    Anonymous - 2020-10-17

    Among those,
    d3.js(which plotly is using) https://d3js.org
    or gITF using WebGL https://github.com/KhronosGroup/glTF/blob/master/README.md
    look the most promising.
    d3.js especially as its tried and tested
    Might be worth giving wasm a look as well! https://webassembly.org/

     

    Last edit: Anonymous 2020-10-17
  • Anonymous

    Anonymous - 2020-10-17

    Anyway to have interactive plots on the web would do! I've given a few suggestions above, but the choice of method is completely the maker's choice! Again, its really important to have that feature at the current moment, for GNUPLOT.
    Also, if possible, the 3d image made should be completely independent of gnuplot to embed it in websites.
    Thank you!

     
  • Ethan Merritt

    Ethan Merritt - 2020-10-17

    I 100% agree with you that if one were starting today to write a plotting program it would be important to consider both web-based interaction and 3D plotting. But gnuplot was designed and implemented more than 30 years ago. 3D displays did not exist. The web did not exist. From the outset gnuplot tried to support a wide range of output devices, but 30 years ago that meant pen plotters, character cell terminals, and a few exotic options like PostScript. It took a lot of work to retro-fit things that now seem obvious, like transparency, smooth colors, non-ASCII text, desktop interactive displays, web browsers rather than pen plotters, onto the original code 2D framework. Because the input and output design layers are modular, the project could step-by-step add drivers for laser printers, then X-terminals, then workstations, then color workstations, then web-friendly formats like svg and html. But those additional features are still attached to a core layer of code that is a 2D framework. By the time anything reaches the output stages of the program, 3D coordinates have been lost. So there is no way to add an output driver for a VR format or Mesa or any other "modern" 3D data representation. You (er, "we") would have to rewrite the core layer of the program to preserve 3D coordinates rather than flattening them to 2D before sending them to an output module. Not impossible, but a huge job compared to adding a new output mode by supplying a new modular driver that plugs in to the existing framework.

    Long story short: a request for 3D output is not so much a "feature request" as a "redesign the entire program" request. If that's a project that appeals to someone, they are welcome to work on it. But if it's a question of "could a quick change to gnuplot provide web-based 3D interaction for my current project?", the answer is no. For that you would have to look for other another program.

     
  • Anonymous

    Anonymous - 2020-10-17

    I totally understand. Thank you!
    May I ask if gnuplot (C program itself) can just be compiled using webasm? The compiled version available separately, for the web? https://webassembly.org/ https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
    Would that make gnuplots web application, with a few minor tweaks?
    Pardon me if I'm wrong, although its just a thought. Kindly check it out, if possible.😅

     
    • Ethan Merritt

      Ethan Merritt - 2020-10-17

      That was the link I provided in response to your other query:
      http://gnuplot.respawned.com/

       
  • Anonymous

    Anonymous - 2020-10-17

    So gnuplot.respawned.com is kinda web based version of gnuplot?
    Is there a way I can use it in a website or something? I can use two sliders (with 0:360) and use them with view(v1,v2) somehow! I can already do that! The only problem being, when they get converted to html, the connection with gnuplot breaks, and the slider is not associated with the plot anymore....

     

    Last edit: Anonymous 2020-10-17
  • Anonymous

    Anonymous - 2020-10-17

    gnuplot.respawned.com is a js version of gnuplot right?
    Thanks! I'll try tinkering with it! Also, right now emscripten provides wasm compilation too! I think the site or the github project use js and not wasm (as it says 2014 and wasm was released in 2017). wasm is a lot faster, comes close to native speed!

    Anyway! Thanks for the help! Especially, its great knowing that something like gnuplot-js exists!

     

    Last edit: Anonymous 2020-10-19
  • Anonymous

    Anonymous - 2020-10-19

    @sfeam
    For now, how bout something like a terminal for web?
    It'll be connected to gnuplot in the system? As soon as one shuts down gnuplot, the image will disappear too. Same functionality as the qt terminal, just on a browser!
    Can this be done? Should I open a new feature request for it?
    Something like, set terminal web
    and splot() or plot() would open my browser instead of qt terminal

     

    Last edit: Anonymous 2020-10-19
    • Ethan Merritt

      Ethan Merritt - 2020-10-19

      What would be the point? It would be less capable that existing interactive terminals. FWIW, I use gnuplot as a back end for several of my web sites. Gnuplot creates a set of images (svg or png) and a dynamically created web page displays them. No changes to gnuplot needed. But they are only intereactive to the extent that the svg image is accompanied by javascript for mousing. That gets back to the original question, right?

       

      Last edit: Ethan Merritt 2020-10-19
      • Mathias Zechmeister

        It would be less capable that existing interactive terminals.

        Do you mean qt, wxt, svg, canvas? d3.js has much more interactivity than those! The interactivity of svg and canvas is quite limited. And when zooming the tics are gone soon.

         
  • Anonymous

    Anonymous - 2020-10-19

    The above would be a satisfactory solution and would kinda solve the rotation problem too, until the core functionality of gnuplot can be compiled using webasm(which'd probably take a few years...).
    @sfeam or any other devs, If it can't be done, feel free to close this feature request!

     

    Last edit: Anonymous 2020-10-19
  • Anonymous

    Anonymous - 2020-10-19

    I'm currently using a wrapper of gnuplot in a high level language and using it to make a jupyter notebook tutorial. The tutorial involves a lot of 3d plots, so interactivity is important! It'll also be a tutorial to gnuplot basics and how to use it to plot data!

     

    Last edit: Anonymous 2020-10-19
  • Anonymous

    Anonymous - 2020-10-19

    Also, qt has webassembly support now... https://www.qt.io/qt-examples-for-webassembly

    From the site

    WebAssembly

    WebAssembly is a bytecode representation that is meant to be targeted by high-level programming languages such as C++ and to be executed inside a virtual machine in a browser. From Qt's perspective, WebAssembly is just another target platform. Starting with Qt 5.13.0, it is an officially supported target platform for selected, relevant modules. You can download the binary builds on Linux, macOS and Windows host platforms and build your Qt applications to be run inside a web browser. Below are some examples and demos that we have prepared to show Qt running in a browser. More examples will be added here later.

    WebAssembly support in browsers is evolving rapidly. We currently recommend using Chrome or Firefox for the best possible experience.

    "just another target platform"
    Can't the qt terminal be just "compiled" again? @sfeam If possible, please look into this....

     

    Last edit: Anonymous 2020-10-19
    • Ethan Merritt

      Ethan Merritt - 2020-12-14

      So far as I can tell the qt-as-web-assembly only helps if gnuplot itself is already running in the web browser. In other words, if you already have gnuplot built via Emscripten then it would make lots of sense to modify/rebuild the qt terminal as the primary output mode rather than (as in the gnuplot.respawned.com example) producing a file (svg/png/etc) that is then displayed as a static image on the web page. So yes, this is a great idea. But it has to be a second step, not the first step.

       
  • Anonymous

    Anonymous - 2020-12-14

    Thanks a lot for looking into it!
    I think its worth a try, although whenever you get time for it!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.