D3 Gauge widget - Error while applying context TypeError: d3.tween is not a function

https://appstore.home.mendix.com/link/app/8677/ When I directly open the page which has this gauge widget, it’s working perfectly But when I go to some other page and then come to this page, it’s showing a loading blue lines and I see this error in console In another case it’s showing the widget but the pointer is in 0 as it’s not able to get the values and throws the same error.
2 answers

I took a look at your test project and have found the problem. There is custom widget in your app that is called ‘LineChart’ that also comes with the D3 library, but a newer version of it, v4. My Gauge chart widget uses v3. These libraries are causing conflicts now in your app.

The custom LineChart widget is coming with v4 overwriting my v3 D3 version. This v4 D3 version does not have a specific function, namely d3.tween, that is used by my D3 Gauge Chart, hence the error is thrown. See also:


What should have happened I think is that when running ‘Check Widgets’ in the Tools section in the Modeler, or bundling widgets, Mendix Studio Pro should have spotted this, you have 2 different definitions of D3.

So this is not really due to one of the widgets. When you strip the LineChart, the widget will work again.

I see 3 options, the most favorable being on top:

  1. Drop de LineChart widget from your app. Mendix offers other LineChart widgets that are actually supported by Mendix. Do you have any reason to not use the one supported by Mendix?
  2. Change the other custom (not in AppStore I believe?) widget to make use of the same D3 version that my D3 Gauge Chart widget is using;
  3. If you really need this custom LineChart widget, adjust my widget to make use of the v4 of D3 library.



It is hard for me to understand where it goes wrong. I have a test app in which many use cases -similar to yours as well- are working (and which I use as a regression test app). 

Can you recreate this issue in a test app and invite me? Then I will solve it for you.

EDIT 20-12-2019

I just released a new version of the widget -Mendix 8 compliant- in the AppStore, version 1.4.0. In this version I use the same D3 library as Mendix uses (4.13.0), hence the widget should work now in all those cases!