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 inline plugin support to charts. #3363

Merged
merged 1 commit into from
Dec 18, 2016
Merged

Add inline plugin support to charts. #3363

merged 1 commit into from
Dec 18, 2016

Conversation

etimberg
Copy link
Member

@etimberg etimberg commented Sep 24, 2016

Implementation of this plugins proposal.

Fixed #3335

* @returns {Boolean} false if any of the plugins return false, else returns true.
*/
notify: function(extension, args) {
var plugins = this._plugins;
Copy link
Member

Choose a reason for hiding this comment

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

I think this would have been easier and shorter:

var options = (chart && chart.options) || {};
var plugins = [].concat(this._plugins, options.plugins || []);

// ... previous code ...

Copy link
Member Author

Choose a reason for hiding this comment

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

good call. I will update that and fix the merge conflict

@arxpoetica
Copy link

You guys rock!

@simonbrunel
Copy link
Member

@etimberg I pushed the new implementation per our Slack discussions: it doesn't contain user documentation but once we switch to the new docs, I will move most of the proposal content into it.

});
var res = Chart.plugins.notify('check');
expect(res).toBeTruthy();
});

it('should return FALSE if no plugin explicitly returns FALSE', function() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This was already existing but I think it should be 'should return FALSE if any plugin explicitly returns FALSE'

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch! I will change it, rebase the branch and fix conflicts.

Copy link
Member Author

Choose a reason for hiding this comment

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

perfect! then I think we can merge this if you feel its ready

Copy link
Member

Choose a reason for hiding this comment

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

I would wait until we have the doc written and merge everything in one commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, sounds like a good plan to me

Plugins can now be declared in the chart `config.plugins` array and will only be applied to the associated chart(s), after the globally registered plugins. Plugin specific options are now scoped under the `config.options.plugins` options. Hooks now receive the chart instance as first argument and the plugin options as last argument.
@simonbrunel
Copy link
Member

@etimberg I rebased the branch on master, so should be ready to be merged. Since we can't get the new doc ready soon, maybe we should consider to merge it now and write doc later?

@etimberg
Copy link
Member Author

Sure, that's ok by me. We should just make sure we don't release without the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants