Skip to content

Split and reuse functions reside inside index files of scattergl scatterpolargl and splom traces #3967

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 8 commits into from
Jun 17, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jun 17, 2019

Currently the index files of all traces except scattergl, scatterpolargl & splom are compact and only declare different functionalities of the trace.

Having similar pattern in scattegl and other two can help improve the readability & requiring of different parts (e.g. when requiring parts of scattergl in scatterpolargl).

In this PR the functions inside the index files of the three are separated and moved to calc, plot, select, hover, helpers and update_scene files.

@plotly/plotly_js


var DESELECTDIM = require('../../constants/interactions').DESELECTDIM;

function styleTextSelection(cd) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, yeah this one isn't ideal. It is under a style.js, but it's not really a _module.style method. Ok if we move this thing to ./helpers.js instead?

var calcColorscale = require('../scatter/colorscale_calc');
var convertMarkerStyle = require('../scattergl/convert').markerStyle;

function editStyle(gd, cd0) {
Copy link
Contributor

@etpinard etpinard Jun 17, 2019

Choose a reason for hiding this comment

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

Same here, I'm not sure this belongs in a style.js file. I'd be ok we either:

  • moving this logic to splom/index.js
  • renaming this file to edit_style.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in e27ea9c.

Copy link
Contributor

@etpinard etpinard left a comment

Choose a reason for hiding this comment

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

Ooops I made review by accident.

sceneUpdate: sceneUpdate,
calcHover: calcHover,
sceneUpdate: require('./scene_update'),
calcHover: hover.calcHover,
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to export these off ScatterGl anymore (I think).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!
Done in bb12f68.

Copy link
Contributor

@etpinard etpinard left a comment

Choose a reason for hiding this comment

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

Ooops I made review by accident.

@etpinard
Copy link
Contributor

Thanks for doing this @archmoj !!

I like the way you split the cross-trace plot logic into an update_scene.js file. That's probably something we'll standardise across all regl traces old (parcoords) and upcoming (gl3d).

@etpinard
Copy link
Contributor

Nicely done @archmoj !!

💃

@archmoj archmoj merged commit 56f3bb7 into master Jun 17, 2019
@archmoj archmoj deleted the scattergl-separate-calc-plot branch June 17, 2019 17:41
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