Skip to content

DM-9942: Add plotly support #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 29, 2017
Merged

DM-9942: Add plotly support #340

merged 2 commits into from
Mar 29, 2017

Conversation

robyww
Copy link
Contributor

@robyww robyww commented Mar 24, 2017

  • options to enable plotly
  • plotly defered loading
  • react wrapper
  • prototype LcPeriodPlotly
  • plotly javascript file
  • a concept demo file

 - options to enable plotly
 - plotly defered loading
 - react wrapper
 - prototype LcPeriodPlotly
 - plotly javascript file
 - a concept demo file
@robyww robyww requested review from cwang2016 and tgoldina March 24, 2017 23:42
@robyww robyww self-assigned this Mar 24, 2017
Copy link
Contributor

@tgoldina tgoldina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great overall.

The only issue is with loading from API. If it's not clear how to fix, please merge. I'll put my branch out, so that we have a test case with xy plot on demo page.

type: 'linear',
lineColor: '#e9e9e9',
tickwidth: 1,
ticklen: 5,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tickwidth and ticklen are causing these dashes at the end of y grid lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i will play with it.

* @param scriptName
* @return {Promise} when the script is loaded or failed to load
*/
export function loadScript(scriptName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. We can use lazy load.

@@ -20,7 +20,8 @@
],
options : {
MenuItemKeys: {maskOverlay:true},
catalogSpacialOp: 'polygonWhenPlotExist'
catalogSpacialOp: 'polygonWhenPlotExist',
charts: {chartEngine: 'plotly'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, we'll have this option in all templates that use charts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I put it in everywhere so that they will all pick up the option and we can work on it. IrsaViewer in the IFE repository does not have this option s set.


const getPlotLy= () => {
if (loadedPlotly || loadedPlotlyFailed) {
return loadedPlotly ? Promise.resolve(loadedPlotly) : Promise.reject(Error(LOAD_ERR_MSG));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works fine in firefly.html triview. But when loading a chart from API, I get Plotly not loaded Error: Load Failed: could not load Plotly.

Plotly not loaded Error: Load Failed: could not load Plotly
    at getPlotLy (:8080/firefly/firefly-dev.js:153749)
    at PlotlyWrapper.draw (:8080/firefly/firefly-dev.js:153898)
    at PlotlyWrapper.componentDidMount (:8080/firefly/firefly-dev.js:153942)
    at :8080/firefly/firefly-dev.js:34593
    at measureLifeCyclePerf (:8080/firefly/firefly-dev.js:34403)
    at :8080/firefly/firefly-dev.js:34592
    at CallbackQueue.notifyAll (:8080/firefly/firefly-dev.js:27028)
    at ReactReconcileTransaction.close (:8080/firefly/firefly-dev.js:37746)
    at ReactReconcileTransaction.closeAll (:8080/firefly/firefly-dev.js:28207)
    at ReactReconcileTransaction.perform (:8080/firefly/firefly-dev.js:28154)
:8080/firefly/firefly-dev.js:153749 Uncaught (in promise) Error: Load Failed: could not load Plotly
    at getPlotLy (:8080/firefly/firefly-dev.js:153749)
    at PlotlyWrapper.refUpdate (:8080/firefly/firefly-dev.js:153934)
    at attachRef (:8080/firefly/firefly-dev.js:27293)
    at Object.ReactRef.attachRefs (:8080/firefly/firefly-dev.js:27315)
    at ReactDOMComponent.attachRefs (:8080/firefly/firefly-dev.js:27124)
    at CallbackQueue.notifyAll (:8080/firefly/firefly-dev.js:27028)
    at ReactReconcileTransaction.close (:8080/firefly/firefly-dev.js:37746)
    at ReactReconcileTransaction.closeAll (:8080/firefly/firefly-dev.js:28207)
    at ReactReconcileTransaction.perform (:8080/firefly/firefly-dev.js:28154)
    at ReactUpdatesFlushTransaction.perform (:8080/firefly/firefly-dev.js:28141)

Copy link
Contributor Author

@robyww robyww Mar 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will play with it and see if I can fix it.

console.log('ev', ev);
var update = {
x: [[data[0].x[ev.points[0].pointNumber]]],
y: [[data[0].y[ev.points[0].pointNumber]]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am glad you have it in examples. This extra array wrapper for x and y updates is not documented.
It seems like it's needed only for x andy. For 'shapes' updates – which is also an array – it's not needed.

@robyww robyww merged commit 276b334 into dev Mar 29, 2017
@robyww robyww deleted the dm-9942-add-plotly branch March 29, 2017 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants