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 · 6 comments · Fixed by #5995
Closed

CustomJSTransform #5015

birdsarah opened this issue Aug 22, 2016 · 6 comments · Fixed by #5995

Comments

@birdsarah
Copy link
Member

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

ping @hafen

@bryevdv
Copy link
Member

bryevdv commented Dec 20, 2016

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

@souravsingh
Copy link
Contributor

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

@bryevdv
Copy link
Member

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 commented Jan 5, 2017

Can we do this with pyscript also?

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants