Thursday, December 4, 2025

Re: JsInterop wrapping of D3 js

To be honest not really no.

I didn't like the chaining pattern when I saw it initially. If there was a jfreechart (https://www.jfree.org/jfreechart/) like library back then I would use it. Now it looks like there is one: https://github.com/jfree/jsfreechart Wow!

But...

D3 is built around the selection object - exactly like jQuery. This presents some interesting capabilities.

For example you can have a big table and D3 will read the data from there. There is no need to duplicate the data, to sync them etc.

Furthermore the possibility to transform any random js example on the web in GWT java quickly, was a productivity boost.

That approach really paid off also for debugging. Consider the following case. D3 java does not work. What's the problem? Is it the bindings? Let's create a small example in js and run it natively. If it works it's the binding's fault. If it doesn't work then it is the way we use D3 or worse a D3 bug.

So I believe it was a pragmatic approach. We could use D3 docs, D3 examples etc.

Hope that helps.

   Vassilis









On Thu, Dec 4, 2025 at 10:08 PM 'Tim Macpherson' via GWT Users <google-web-toolkit@googlegroups.com> wrote:
For you the chaining patterns are ok in  java ? I have several thousand lines of D3 js code, all written in Java patterns with little chaining. Converting it to TS is tedious but every step makes the codebase easier in the ide.
AI told me the d3 lib by Bostock can't be  in TS if anyone wants to edit it, we just get TS types from it


On Thu, Dec 4, 2025 at 7:54 PM, Vassilis Virvilis
I have a ~750 LOC file that maps the subset my application uses of an older version (3.5.x) of D3 to jsinterop.

I managed to write Java in a very javascript way with this. Chaining was also working. If you return a Selection object everything works as expected. Transforming the JS examples was very straightforward with minimal changes.

I have even filed a bug report when I had hit GWT limitations... https://github.com/gwtproject/gwt/issues/9675

I always wanted to clean it up, update it to the latest D3 and post it as OpenSource in Github but I never found the time...

    Vassilis

On Thu, Dec 4, 2025 at 9:27 PM 'Tim Macpherson' via GWT Users <google-web-toolkit@googlegroups.com> wrote:
There was one but d3 requires following the js samples.
I am having to use typescript to make sense of my extensive D3 js code. 
I'm now thinking seems like TS is coercing  new writers of js to write more like Java because the old style 'duck typing' chaining methods can't be typed by TS

(written on phone, sorry about typos)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/575562369.7270741.1764876458368%40mail.yahoo.com.


--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CAKbOjEw%2BF%2Buydq_1Q48fwfXwsByZmen%3D6rzPx_Z9UPZouO56LQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/910453741.7287381.1764878899400%40mail.yahoo.com.


--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/CAKbOjEwy86s1EsBR1xUy8LypxegbeGYHvVfWLgTbBrqutiT%2BOA%40mail.gmail.com.

No comments:

Post a Comment