Skip to content
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

Add global transforms config option #852

Merged
merged 4 commits into from
Aug 12, 2016
Merged

Add global transforms config option #852

merged 4 commits into from
Aug 12, 2016

Conversation

etpinard
Copy link
Contributor

so that users can now set transform globally for all traces going through Plotly.plot.

Example:

Plotly.setPlotConfig({
  globalTransforms: [{
    type: 'filter',
    /* */
  }] 
});

// will apply a filter to all traces plotted herein

cc @bpostlethwaite

- so that transform can use fullTrace._input,
  index and _expandedIndex
- transform options can be specified using the config arg
  or globally using Plotly.setPlotConfig()
- global transforms are applied to all traces
  and are supplied before all other trace transforms.
@etpinard etpinard added this to the v1.17.0 milestone Aug 12, 2016
filtersrc: 'x'
}, '- trace second');
});

Copy link
Member

Choose a reason for hiding this comment

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

looks great!
What do you think about one additional test that ensures transforms have access to fullTrace._input user data? Just in case someone other than yourself decides to refactor one day and accidentally breaks a bunch of userspace transforms.

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 call

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 6af72d0

@bpostlethwaite
Copy link
Member

looks great, one 🐅 question but otherwise 💃

- Plots.supplyDefaults({data: [], layout: {}}) should work always!
expect(dataOut[0]._input).toBe(dataIn[0]);
expect(opts.transform).toBe(transformOut);
expect(opts.fullTrace._input).toBe(dataIn[0]);
expect(opts.layout).toBe(layout);
Copy link
Member

Choose a reason for hiding this comment

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

👍

@etpinard etpinard merged commit 5811c3f into master Aug 12, 2016
@etpinard etpinard deleted the global-transforms branch August 12, 2016 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants