Plotly.js: Using Plotly with Salesforce (strict mode now enforced)

Created on 3 Jul 2016  路  5Comments  路  Source: plotly/plotly.js

Hello!

I'm super excited that Plotly is now open source, and I'm hoping to use it with an app I'm developing on the Salesforce platform.

Salesforce has recently put in place a new policy for 3rd party Javascript libraries: https://developer.salesforce.com/blogs/developer-relations/2016/04/introducing-lockerservice-lightning-components.html

Amongst other things, "strict" is on be default, and there are numerous areas where Plotly is failing.

I've just started looking through the errors and found a few things like:

<<<12586
var d3_document = this.document;
>>>
var d3_document = document;

<<< 13741
var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
>>>
var d3_mouse_bug44083 = navigator && /WebKit/.test(navigator.userAgent) ? -1 : 0;

I'm not sure if the roadmap for Plot.ly includes support for moving to ES6 (where strict is on be default), or if Plotly is using the D3.v4 (which I believe is ES6 compatible...).

If it's not, then I will look into seeing how many changes and where need to happen to get Plotly running again on Salesforce.

Thanks!

maintenance

Most helpful comment

Is there a v2.0.0 branch that is at any level of stability? I'd be happy to help test it when that effort gets underway.

Not at the moment, unfortunately. I'll comment on this thread once a v2.0.0 branch is up. That will probably have to wait for September 2016.

All 5 comments

Thanks for writing in.

All source files in this repo have strict mode enabled (as per the strict eslint rule).

I believe that most of our dependencies (e.g. the gl-vis packages) are strict mode compatible (thought I haven't checked).

So, this issue should be resolved by at the same time we bump d3 to v4 as part of our v2.0.0 release in late-2016. See more info here.

Thanks Etienne. I had sort of assumed there was a D3 versioning issue. Is there a v2.0.0 branch that is at any level of stability? I'd be happy to help test it when that effort gets underway.

Is there a v2.0.0 branch that is at any level of stability? I'd be happy to help test it when that effort gets underway.

Not at the moment, unfortunately. I'll comment on this thread once a v2.0.0 branch is up. That will probably have to wait for September 2016.

In the mean time, I'd recommend taking a looking at this gist that shows how to bundle plotly.js without d3.

Then, maybe someone out there made a patched version of [email protected] that is strict mode compatible.

The specific Salesforce enforcement officially takes effect in October, so I might be able to stay on current versions. That is excellent advice though, so I will see if I can track it down.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxwell8888 picture maxwell8888  路  3Comments

pynklu picture pynklu  路  3Comments

mithi picture mithi  路  3Comments

tim-sauchuk picture tim-sauchuk  路  3Comments

jonmmease picture jonmmease  路  3Comments