Is there an API for extending D3 like with jQuery? With jQuery we are able to extend it like this:
$.fn.myExtnesion = function () {
return $(this).each(function myPlugincode(){
});
};
Is there a similar API for D3?
It is possible to add functions directly to the various D3 object prototypes, we've used this in the library I am building to add functions to d3 selections for example.
For example:
d3.selection.prototype.layout = function() {
// your code goes here, where 'this' is the D3 selection
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With