CC’ing Ryan Hafen, who is the primary maintainer of RBokeh. He is in the middle of making foundational improvements to RBokeh including auto generating a “bokeh.models” low level API, so that the high level interfaces can be insulated and more maintained. So now is a good time to ask about this, actually.
Otherwise, from a general point of view, you’d need to create the right pile of JSON that including a JSON object to represent your extension in the document, and you need to define a JS module that implements the extension that gets executed first. A small one would look something like this:
"custom/bk_script_5f5f109f0ce649818d9b2abce022f66a.my_formatter": [function(require, module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var extend = function (child, parent) { for (var key in parent) {
if (hasProp.call(parent, key))
child[key] = parent[key];
} function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
var tick_formatter_1 = require("models/formatters/tick_formatter");
exports.MyFormatter = (function (superClass) {
extend(MyFormatter, superClass);
function MyFormatter() {
return MyFormatter.__super__.constructor.apply(this, arguments);
}
MyFormatter.prototype.type = "MyFormatter";
MyFormatter.prototype.doFormat = function (ticks) {
var formatted, i, j, ref;
formatted = ["" + ticks[0]];
for (i = j = 1, ref = ticks.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
formatted.push("+" + ((ticks[i] - ticks[0]).toPrecision(2)));
}
return formatted;
};
return MyFormatter;
})(tick_formatter_1.TickFormatter);
}, {}],
The Bokeh python API has conveniences to help generate all this, by looking at implementation so presumably to make RBokeh easily extendible it would need some high level functions that do something similar.
Thanks,
Bryan
On Aug 7, 2017, at 02:08, miles.mcbain@gmail.com wrote:
Hi,
I am after a brief overview about what would be involved in making an extension like the Surface3d example usable from R. My guess is that this involves passing the JS implementation through R? At a high level what R functions would need to be created/updated to facilitate this?
Depending on what is involved, I may be able to get some time at work to make the changes and push back upstream.
Kind Regards,
Miles
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a054cc61-05a1-4b15-b572-b9cc6dbada4b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.