Skip to Content

Is it possible to include d3 v3 into Design Studio SDK Component?

It looks like Design Studio 1.3 uses D3 v2.10. I'd like to leverage D3 v3 for a component. Has anyone successfully managed to include d3 v3 into Design Studio? If so, do we know if this is a valid use of the SDK or does it violate any principle since CVOM charts rely on a certain version of d3?

I see where Former Member did it for Lumira here (Lumira Geoextension with datamaps.js and topojson.js) however I don't think Design Studio uses require.js nor am I sure if his inclusion of d3 v3 is also technically a bad idea for Lumira since it also uses CVOM charts?

Just wondering if there's any answers before I go trying to use d3 v3!

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jun 24, 2014 at 02:05 PM

    Clear answer: No! Design Studio and Lumira both use CVOM, which is based on D3.v2.js.

    As with most frameworks, D3 creates at least one global variable. If you would include another version of D3 with your component, you would overwrite the current one. Nobody knows what effect this could have.

    In Lumira they havily use Require.js that could theoretically support multiple versions of the same lib. So it could work there, but I would not guarantee. In Design Studio it would definitly cause problems.

    Reiner.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 23, 2014 at 09:35 PM

    Hi Mike,

    As I recall, during the SDK Beta Program we were advised against trying to manually load a newer version of D3 via the include tag in the contribution.xml file to avoid causing conflicts with the standard D3 library included in DS. Technically, I suppose you could load your own version of D3 if you could guarantee that no other components based on the DS standard D3 version were going to be used in the application.

    Perhaps the DS Team can confirm if the above position still applies.

    Mustafa.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2014 at 08:22 AM

    Hi all,

    quick thought: why don't you just modify your copy of d3 as such, that you pass a different context to the d3-closure?

    Then it doesn't register on the window, but on your own "namespace". As far as I can see D3 sticks to the context and doesn't fiddle outside of it, so a second instance of D3 should be safe ...

    Like so:

    var myNamespace = {};

    (function(){

    // D3 definition

    }).call(myNamespace);

    Now your D3 sits inside

    myNamespace.d3.xxxx ... or do I miss any problems with that?

    Regards,

    Jonas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.