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

Comments

@birdsarah
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

This comment has been minimized.

Show comment
Hide comment
@birdsarah
Member

birdsarah commented Aug 22, 2016

ping @hafen

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Dec 20, 2016

Member

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

Member

bryevdv commented Dec 20, 2016

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

@souravsingh

This comment has been minimized.

Show comment
Hide comment
@souravsingh

souravsingh Jan 1, 2017

Contributor

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

Contributor

souravsingh commented Jan 1, 2017

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

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Jan 5, 2017

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@datnamer

datnamer Jan 5, 2017

Can we do this with pyscript also?

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 referenced this issue Mar 15, 2017

Merged

Add support for CustomJSTransform #5995

4 of 4 tasks complete

@bryevdv bryevdv closed this in #5995 Mar 20, 2017

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