Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1567 > unrolled thread

gnuplot running in your browser (compiled with emscripten)

Started byChrist H <chhu79@googlemail.com>
First post2013-01-01 12:39 -0800
Last post2019-06-23 23:34 -0700
Articles 9 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  gnuplot running in your browser (compiled with emscripten) Christ H <chhu79@googlemail.com> - 2013-01-01 12:39 -0800
    Re: gnuplot running in your browser (compiled with emscripten) sfeam <sfeam@users.sourceforge.net> - 2013-01-01 17:00 -0800
      Re: gnuplot running in your browser (compiled with emscripten) Christ H <chhu79@googlemail.com> - 2013-01-02 03:37 -0800
        Re: gnuplot running in your browser (compiled with emscripten) sfeam <sfeam@users.sourceforge.net> - 2013-01-02 11:45 -0800
    Re: gnuplot running in your browser (compiled with emscripten) Christ H <chhu79@googlemail.com> - 2013-01-04 06:13 -0800
      Re: gnuplot running in your browser (compiled with emscripten) Christ H <chhu79@googlemail.com> - 2013-01-14 04:29 -0800
        Re: gnuplot running in your browser (compiled with emscripten) Christ H <chhu79@googlemail.com> - 2013-01-16 03:36 -0800
          Re: gnuplot running in your browser (compiled with emscripten) sfeam <sfeam@users.sourceforge.net> - 2013-01-16 15:36 -0800
    Re: gnuplot running in your browser (compiled with emscripten) yasasvi.peruvemba@gmail.com - 2019-06-23 23:34 -0700

#1567 — gnuplot running in your browser (compiled with emscripten)

FromChrist H <chhu79@googlemail.com>
Date2013-01-01 12:39 -0800
Subjectgnuplot running in your browser (compiled with emscripten)
Message-ID<aab46ae5-c5bd-4dab-80a6-db75d59ffe46@googlegroups.com>
Hi, 
just as an xmas project I tried to compile gnuplot with emscripten and it worked amazingly well. Had to patch some little things, nothing dramatic. Only issue: hidden surface removal is broken (crashes), which might be due to int64 usage. Appreciate feedback. Feel free to have fun with this, no install required, just a modern browser.

Cheers,
Christian

http://gnuplot.respawned.com

[toc] | [next] | [standalone]


#1568

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-01-01 17:00 -0800
Message-ID<kc00ri$glu$1@dont-email.me>
In reply to#1567
Christ H wrote:

> Hi,
> just as an xmas project I tried to compile gnuplot with emscripten and
> it worked amazingly well. Had to patch some little things, nothing
> dramatic. Only issue: hidden surface removal is broken (crashes),
> which might be due to int64 usage. Appreciate feedback. Feel free to
> have fun with this, no install required, just a modern browser.
>
> http://gnuplot.respawned.com

What a great holiday project!
Some thoughts after a quick trial run:

2.5MB is pretty small already, but I think you could cut that down
further by trimming the number of terminal drivers in the build.
I can't see much point in context/corel/mif/pslatex/tektronix support.

Aside from the problem with hidden3d, I notice that NaN and infinities
are not handled correctly.  You can see this by running imageNAN.dem or
by typing "print NaN".

I get an error page saying 
"error on line 80 at column 36: Encoding error"
if there are UTF-8 characters in the input script.
It's not clear what level of the processing stack is involved;
this is not an error from gnuplot per se.

I would have thought that modifying the script to use
  set term svg enhanced size 1000,700 mouse \
           jsdir "http://gnuplot.sourceforge.net/demo_svg_4.6/"
would be sufficient to enable mousing, but it isn't.  This
could be due to sandboxing by the browser (chrome), but I didn't 
pursue it further.  Clearly it should work to include the mousing
support scripts with the rest of the downloaded code, however
in order to play with the mousing script it would be easier if it
lived in a separate editable location.  Which brings me to...

The obvious next step is to extend the mousing code so that you
get true 3D interactive rotation and zoom.  
That would be spectacular!

3D mouse support would be easier to do using the canvas terminal
instead of svg because that way there needn't be an intermediate
file (svg.out) in local storage.  
Either way the amount of new code required would be small;
so far as I can see, the only thing required is to add hooks so
that mouse events trigger a call back into the existing
gp_exec_event() routine.  It could well be that no change is 
needed to the core gnuplot code at all, only to the separate
mousing scripts and the wrapping HTML on the web page.

Please send me, or upload to the SourceForge site, whatever
code changes you needed to "patch some little things".
I'd be happy to shepherd them into the current CVS version.

	Happy New Year,

		Ethan

> 
> Cheers,
> Christian
> 
> http://gnuplot.respawned.com

[toc] | [prev] | [next] | [standalone]


#1570

FromChrist H <chhu79@googlemail.com>
Date2013-01-02 03:37 -0800
Message-ID<426e561f-b6fe-4635-a7f0-76c1964c4cb6@googlegroups.com>
In reply to#1568
Hi Ethan,

thanks for the feedback! I am a researcher and was trying to run my fluid-dynamics code in the browser, which worked surprisingly well too, so the next thing was visualizing the results, where gnuplot is superior than any other JS libraries out there to plot things. My goal was to produce nice printable plots, which is why I focused on svg and not so much on mousing. 
You clearly tested this already more than I did. :)

> 2.5MB is pretty small already, but I think you could cut that down
> further by trimming the number of terminal drivers in the build.
> I can't see much point in context/corel/mif/pslatex/tektronix support.
Great idea! I removed X support via configure options already. Where would I need to start? Or is this possible with more config options?


> Aside from the problem with hidden3d, I notice that NaN and infinities
> are not handled correctly.  You can see this by running imageNAN.dem or
> by typing "print NaN".
I see, that might be a tough one, although JS handles infinity, NaN etc properly...

> I get an error page saying 
> "error on line 80 at column 36: Encoding error"
> if there are UTF-8 characters in the input script.
> It's not clear what level of the processing stack is involved;
> this is not an error from gnuplot per se.
Agreed, I am not sure how encoding is handled for HTML elements. What did you do? I tried to include a German umlaut character in the label, I don't get an error but the svg is corrupted or not created. 

> 
> I would have thought that modifying the script to use
>   set term svg enhanced size 1000,700 mouse \
>            jsdir "http://gnuplot.sourceforge.net/demo_svg_4.6/"
> would be sufficient to enable mousing, but it isn't.  This
> could be due to sandboxing by the browser (chrome), but I didn't 
> pursue it further.  Clearly it should work to include the mousing
> support scripts with the rest of the downloaded code, however
> in order to play with the mousing script it would be easier if it
> lived in a separate editable location.  Which brings me to...
I don't understand the mousing support, does gnuplot produce an additional js?

> 
> The obvious next step is to extend the mousing code so that you
> get true 3D interactive rotation and zoom.  
> That would be spectacular!
... and tough! ;) You are thinking of a simple feedback of new rotation parameters to the script? Even then you would need something like a cube that the user rotates to illustrate the new rotation position... 


> 
> 3D mouse support would be easier to do using the canvas terminal
> instead of svg because that way there needn't be an intermediate
> file (svg.out) in local storage.  
> 
> Either way the amount of new code required would be small;
> so far as I can see, the only thing required is to add hooks so
> that mouse events trigger a call back into the existing
> gp_exec_event() routine.  It could well be that no change is 
> needed to the core gnuplot code at all, only to the separate
> mousing scripts and the wrapping HTML on the web page.
> 
Regarding 3D, I would love to see features like volume-rendering, iso-surface and slices. I could not find an open-source tool that can do this, but I understand that's a whole new level. 

> Please send me, or upload to the SourceForge site, whatever
> code changes you needed to "patch some little things".
> I'd be happy to shepherd them into the current CVS version.
Great! I needed the most time testing what configure options work. Disabling readline was important, and I think the only patch in the src was in gnprintf(), because the emscripten printf does not understand "% g" so I compacted it with a simple else-statement in the if (???=="% g") branch when nothing happens with the string. Maybe there is even more trouble with formatting... I am happy to share the pre/post JS files needed and the compile script, and the little API I wrote. It is possible to host all this at sourceforge as well as my web server simply serves static files here... You cannot see the pre/post js files as they are "compiled" with gnuplot itself.


> 
> 	Happy New Year,
To you too! 

> 
> 
> 
> 		Ethan
> 

[toc] | [prev] | [next] | [standalone]


#1571

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-01-02 11:45 -0800
Message-ID<kc22pc$2i5$1@dont-email.me>
In reply to#1570
Christ H wrote:

>>
>> The obvious next step is to extend the mousing code so that you
>> get true 3D interactive rotation and zoom.
>> That would be spectacular!
> ... and tough! ;) You are thinking of a simple feedback of new rotation
> parameters to the script? Even then you would need something like a cube
> that the user rotates to illustrate the new rotation position...

I don't see why it would need to be any different from the 3D mousing
support we have had for ages in the interactive terminals win/x11/wxt/qt.
Since you have created a javascript version of all the core routines,
the only missing bit is to attach a call to the emscriptened gp_exec_event()
routine as an action to be triggered on mouse events.

I'll send a more detailed reply off-line.

	Ethan

[toc] | [prev] | [next] | [standalone]


#1574

FromChrist H <chhu79@googlemail.com>
Date2013-01-04 06:13 -0800
Message-ID<295d5310-45d5-4882-b08b-a9ecb279fcac@googlegroups.com>
In reply to#1567
Quick heads-up:
- I could fix the UTF8 issue. That was related to the virtual file system and how a JS string is converted to an array (all files are arrays of bytes).
- Unnecessary terminals are out, JS reduced to 1.7MB, gzip'd 460kB.
- IE10 & iOS6 compatible now.

On Tuesday, January 1, 2013 9:39:38 PM UTC+1, Christ H wrote:
> Hi, 
> 
> just as an xmas project I tried to compile gnuplot with emscripten and it worked amazingly well. Had to patch some little things, nothing dramatic. Only issue: hidden surface removal is broken (crashes), which might be due to int64 usage. Appreciate feedback. Feel free to have fun with this, no install required, just a modern browser.
> 
> 
> 
> Cheers,
> 
> Christian
> 
> 
> 
> http://gnuplot.respawned.com

[toc] | [prev] | [next] | [standalone]


#1576

FromChrist H <chhu79@googlemail.com>
Date2013-01-14 04:29 -0800
Message-ID<3677c73c-15f1-4790-9191-bea603417170@googlegroups.com>
In reply to#1574
Mousing works now too.
Still working on hidden surface bug...

C

On Friday, January 4, 2013 3:13:14 PM UTC+1, Christ H wrote:
> Quick heads-up:
> 
> - I could fix the UTF8 issue. That was related to the virtual file system and how a JS string is converted to an array (all files are arrays of bytes).
> 
> - Unnecessary terminals are out, JS reduced to 1.7MB, gzip'd 460kB.
> 
> - IE10 & iOS6 compatible now.
> 
> 
> 
> On Tuesday, January 1, 2013 9:39:38 PM UTC+1, Christ H wrote:
> 
> > Hi, 
> 
> > 
> 
> > just as an xmas project I tried to compile gnuplot with emscripten and it worked amazingly well. Had to patch some little things, nothing dramatic. Only issue: hidden surface removal is broken (crashes), which might be due to int64 usage. Appreciate feedback. Feel free to have fun with this, no install required, just a modern browser.
> 
> > 
> 
> > 
> 
> > 
> 
> > Cheers,
> 
> > 
> 
> > Christian
> 
> > 
> 
> > 
> 
> > 
> 
> > http://gnuplot.respawned.com

[toc] | [prev] | [next] | [standalone]


#1577

FromChrist H <chhu79@googlemail.com>
Date2013-01-16 03:36 -0800
Message-ID<dd7c3683-ead6-4d4d-ad21-cd1a13e8b140@googlegroups.com>
In reply to#1576
Unfortunately mousing has some serious scaling issues, and it prevents the user from right-click, save-as... option. I'm thinking of reverting back to <img> tag.


On Monday, January 14, 2013 1:29:36 PM UTC+1, Christ H wrote:
> Mousing works now too.
> 
> Still working on hidden surface bug...
> 
> 
> 
> C
> 
> 
> 
> On Friday, January 4, 2013 3:13:14 PM UTC+1, Christ H wrote:
> 
> > Quick heads-up:
> 
> > 
> 
> > - I could fix the UTF8 issue. That was related to the virtual file system and how a JS string is converted to an array (all files are arrays of bytes).
> 
> > 
> 
> > - Unnecessary terminals are out, JS reduced to 1.7MB, gzip'd 460kB.
> 
> > 
> 
> > - IE10 & iOS6 compatible now.
> 
> > 
> 
> > 
> 
> > 
> 
> > On Tuesday, January 1, 2013 9:39:38 PM UTC+1, Christ H wrote:
> 
> > 
> 
> > > Hi, 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > just as an xmas project I tried to compile gnuplot with emscripten and it worked amazingly well. Had to patch some little things, nothing dramatic. Only issue: hidden surface removal is broken (crashes), which might be due to int64 usage. Appreciate feedback. Feel free to have fun with this, no install required, just a modern browser.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Cheers,
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Christian
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > http://gnuplot.respawned.com

[toc] | [prev] | [next] | [standalone]


#1578

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-01-16 15:36 -0800
Message-ID<kd7di0$21d$1@dont-email.me>
In reply to#1577
Christ H wrote:

> Unfortunately mousing has some serious scaling issues,

I noticed that.  But I'm sure it's fixable.
It might be due to the SVG element being embedded in a 
separate frame? 

> and it prevents the user from right-click, save-as... option. 

I don't see that here.  gnuplot's SVG mousing code ignores right-click.  
I don't have any problems with right-click + save-as in either chrome 
or firefox.   What browser are you having trouble with? 

> I'm thinking of reverting back to <img> tag.
>> 
>> Still working on hidden surface bug...

You might try

   ./configure --disable-h3d-quadtree --enable-h3d-gridbox

That selects a different hidden surface algorithm.
No promises, but at least you'd be executing a different code path.

	Ethan

>> 
>> 
>> C
>> 

>> > > http://gnuplot.respawned.com

[toc] | [prev] | [next] | [standalone]


#4203

Fromyasasvi.peruvemba@gmail.com
Date2019-06-23 23:34 -0700
Message-ID<f088da03-78a8-4bf2-a1ac-b01e5211482c@googlegroups.com>
In reply to#1567
On Wednesday, 2 January 2013 02:09:38 UTC+5:30, Christ H  wrote:
> Hi, 
> just as an xmas project I tried to compile gnuplot with emscripten and it worked amazingly well. Had to patch some little things, nothing dramatic. Only issue: hidden surface removal is broken (crashes), which might be due to int64 usage. Appreciate feedback. Feel free to have fun with this, no install required, just a modern browser.
> 
> Cheers,
> Christian
> 
> http://gnuplot.respawned.com

Hey Christian, I too am trying to port gnuplot, but currently, I keep getting an error "out.svg not found", after dealing with a few other errors, this seems to be where i'm getting stuck, it could be great if you could share any details regarding this!

>Regards,
>Yasasvi

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web