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

CustomJSTransform #5015

Closed
birdsarah opened this issue Aug 22, 2016 · 5 comments
Closed

CustomJSTransform #5015

birdsarah opened this issue Aug 22, 2016 · 5 comments

Comments

@birdsarah
Copy link
Member

@birdsarah birdsarah commented Aug 22, 2016

Adding new transforms is easy, but people should be able to self serve something like this:

from bokeh.models import CustomJSTransform

transform = CustomJSTransform.from_coffeescript(
    compute="""return 2*x""",
    v_compute="""
        vals = []
        for x in xs:
            vals.push(2*x)
        return vals
    """
)

.....

p.circle(x='x', y='y', size={field: 'x', transform: transform})

Just like #4659, user would know that single x is passed to compute and array xs is passed to v_compute. User would specify a return value and would also be able to pass in args - like for CustomJS.

@birdsarah
Copy link
Member Author

@birdsarah birdsarah commented Aug 22, 2016

ping @hafen

@bryevdv
Copy link
Member

@bryevdv bryevdv commented Dec 20, 2016

This seems low-effort / high value so scheduling it for 0.12.5

@souravsingh
Copy link
Contributor

@souravsingh souravsingh commented Jan 1, 2017

I am interested in working on the issue. How do I start?

@bryevdv
Copy link
Member

@bryevdv bryevdv commented Jan 5, 2017

HI @souravsingh it's going to be very similar to the CustomJS callback. I'd first suggest studying that, and it's JS implementation as well:

https://github.com/bokeh/bokeh/blob/master/bokeh/models/callbacks.py
https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/callbacks/customjs.coffee

It's probably the case that alot of that code can be re-used.

Then the first step would be to define what the python class that will represent a CustomJSTransform should look like. It will be a subclass of Transform with some extra properties to represent the JS code for the transform.

@datnamer
Copy link

@datnamer datnamer commented Jan 5, 2017

Can we do this with pyscript also?

@bryevdv bryevdv self-assigned this Feb 27, 2017
@canavandl canavandl self-assigned this Mar 13, 2017
@canavandl canavandl mentioned this issue Mar 15, 2017
4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.