www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Canvas in Gtk connected to D?

reply Mike McKee <volomike gmail.com> writes:
Is there a way to do a canvas in GTK3 so that I can use chart.js, 
and connect this to D? See, in something similar, a guy named 
Julien Wintz figured out that Qt's QQuickWidget acts much like 
the webkit Canvas object, and thus was able to port chart.js to 
that widget. This allows one to use Qt + QQuickWidget + D (or any 
Qt-supported language for that matter) to draw charts using 
Javascript, using the chart.js documentation. What's also 
fascinating about this is that it's fairly lightweight -- 
Julien's solution doesn't use Chromium (or other webkit 
implementation) to make it work. (It should be noted, however, 
that QQuickWidget uses OpenGL, however.) Likewise, it would be 
great if I could do something similar in GTK3.

See, I like D, and I'm getting somewhere with it with GTK3, but 
doing static charts like I see with chart.js is important for my 
use of this language.
Sep 14 2015
next sibling parent Alexander Hausmann <hausmann.alex gmail.com> writes:
Am 14.09.2015 um 19:05 schrieb Mike McKee:
 Is there a way to do a canvas in GTK3 so that I can use chart.js, and
 connect this to D? See, in something similar, a guy named Julien Wintz
 figured out that Qt's QQuickWidget acts much like the webkit Canvas
 object, and thus was able to port chart.js to that widget. This allows
 one to use Qt + QQuickWidget + D (or any Qt-supported language for that
 matter) to draw charts using Javascript, using the chart.js
 documentation. What's also fascinating about this is that it's fairly
 lightweight -- Julien's solution doesn't use Chromium (or other webkit
 implementation) to make it work. (It should be noted, however, that
 QQuickWidget uses OpenGL, however.) Likewise, it would be great if I
 could do something similar in GTK3.
 
 See, I like D, and I'm getting somewhere with it with GTK3, but doing
 static charts like I see with chart.js is important for my use of this
 language.
 
I'm guessing the port was so easy because the QQuickWidgets have access to the V8 javascript engine (from Chromium ) that is included with Qt. As GTK doesn't have a javascript engine integrated a straightforward port of chartjs won't work.
Sep 14 2015
prev sibling parent reply Justin Whear <justin economicmodeling.com> writes:
On Mon, 14 Sep 2015 17:05:16 +0000, Mike McKee wrote:

 Is there a way to do a canvas in GTK3 so that I can use chart.js,
Mike, as this is really a GTK3 question and not specific to D (if GTK will let you do it in C, you can do it in D), you might have better success asking the GTK forum (gtkforums.com). Another avenue of research would be to look at CEF (D bindings here: http://code.dlang.org/packages/ derelict-cef) and see if that will integrate with your toolkit.
Sep 14 2015
parent reply Mike McKee <volomike gmail.com> writes:
On Monday, 14 September 2015 at 19:56:57 UTC, Justin Whear wrote:
 Mike, as this is really a GTK3 question and not specific to D 
 (if GTK will let you do it in C, you can do it in D), you might 
 have better success asking the GTK forum (gtkforums.com).  
 Another avenue of research would be to look at CEF (D bindings 
 here: http://code.dlang.org/packages/ derelict-cef) and see if 
 that will integrate with your toolkit.
Unfortunately derelict-cef is still alpha and not documented well yet. The developer is working on a book on another project, I hear. I'll ask in the GTK Forums what they recommend as the most recently recommended approach for doing static charts in GTK3.
Sep 14 2015
parent Mike McKee <volomike gmail.com> writes:
On Monday, 14 September 2015 at 21:57:23 UTC, Mike McKee wrote:
 I'll ask in the GTK Forums what they recommend as the most 
 recently recommended approach for doing static charts in GTK3.
BTW, the gtkforums.com site doesn't just let anyone in. I'm still waiting on an admin to approve me. :(
Sep 14 2015