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

Vbar hbar #4815

Merged
merged 36 commits into from Jul 20, 2016
Merged

Vbar hbar #4815

merged 36 commits into from Jul 20, 2016

Conversation

@ericmjl
Copy link
Contributor

ericmjl commented Jul 16, 2016

No description provided.

@canavandl
Copy link
Contributor

canavandl commented Jul 16, 2016

I think may have accidently checked-in Quad.html and Vbar.html? They'll probably have to be removed.

@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 16, 2016

Thanks for letting me know. I will take care of that.

@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 17, 2016

@canavandl just getting back to the thing you mentioned - where did you put Quad.html and Vbar.html?

@bryevdv
Copy link
Member

bryevdv commented Jul 19, 2016

@ericmjl I think @canavandl is saying that you accidentally checked those files in to the branch (you can see them in "Files Changed" tab). They need to be removed

""")

fill_props = Include(FillProps, use_prefix=False, help="""
The %s values for the rectangles.

This comment has been minimized.

Copy link
@bryevdv

bryevdv Jul 19, 2016

Member

suggest updating both of these to "horizontal bars" instead of "rectangles"

ericmjl added 2 commits Jul 19, 2016
@bryevdv
Copy link
Member

bryevdv commented Jul 19, 2016

FYI while I'm +1 on defaulting bottom=0 I'm +0 on defaulting left=0. I'll leave that to you to decide


bottom = NumberSpec(help="""
The y-coordinates of the bottom edges.
""", default=0)

This comment has been minimized.

Copy link
@bryevdv

bryevdv Jul 19, 2016

Member

OK, being super picky here :) but every other property puts the help last, I think it would be good to be consistent, so devs are never surprised:

 +    bottom = NumberSpec(default=0, help="""
 +    The y-coordinates of the bottom edges.
 +    """)

This comment has been minimized.

Copy link
@ericmjl

ericmjl Jul 19, 2016

Author Contributor

I'm sorry! I should have looked more carefully at the conventions.

This comment has been minimized.

Copy link
@bryevdv

bryevdv Jul 19, 2016

Member

Not at all, it's not the sort of thing that's easy to notice as a patter, again that's why we are here to help!

@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 19, 2016

@bryevdv I think it makes sense to include left=0 as a default, for consistency purposes. Most use cases - data are positively valued, and visually bottom and left are used for zeros.


left = NumberSpec(help="""
The x-coordinates of the left edges.
""", default=0)

This comment has been minimized.

Copy link
@bryevdv

bryevdv Jul 19, 2016

Member

same comment about default being first

@bryevdv
Copy link
Member

bryevdv commented Jul 20, 2016

Ok, I forgot to mention the defaults on the JS side (in the @define blocks) also need to be updated to match, and also the python unit tests need to be updated as well:

https://travis-ci.org/bokeh/bokeh/jobs/145977715#L2468-L2491

@bryevdv
Copy link
Member

bryevdv commented Jul 20, 2016

@ericmjl there is one last test still failing, I'm not sure what it is offhand, but I will look into it this afternoon

@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 20, 2016

@bryevdv I've been trying to debug it too this morning, but I think I'm running into the limits of my knowledge of the bokeh library at this point. Thanks for guiding me along this too, btw!

@bryevdv
Copy link
Member

bryevdv commented Jul 20, 2016

@ericmjl the coffee default values need to be updated to match. The following patch gets the tests passing:

 git diff
diff --git a/bokehjs/src/coffee/models/glyphs/hbar.coffee b/bokehjs/src/coffee/models/glyphs/hbar.coffee
index c176c56..850fdf3 100644
--- a/bokehjs/src/coffee/models/glyphs/hbar.coffee
+++ b/bokehjs/src/coffee/models/glyphs/hbar.coffee
@@ -46,10 +46,10 @@ class HBar extends Glyph.Model

   @mixins ['line', 'fill']
   @define {
-      y:      [ p.NumberSpec   ]
-      height: [ p.DistanceSpec ]
-      left:   [ p.NumberSpec   ]
-      right:  [ p.NumberSpec   ]
+      y:      [ p.NumberSpec     ]
+      height: [ p.DistanceSpec   ]
+      left:   [ p.NumberSpec,  0 ]
+      right:  [ p.NumberSpec     ]
     }

 module.exports =
diff --git a/bokehjs/src/coffee/models/glyphs/vbar.coffee b/bokehjs/src/coffee/models/glyphs/vbar.coffee
index 5ef9ed3..e8e076b 100644
--- a/bokehjs/src/coffee/models/glyphs/vbar.coffee
+++ b/bokehjs/src/coffee/models/glyphs/vbar.coffee
@@ -45,10 +45,10 @@ class VBar extends Glyph.Model

   @mixins ['line', 'fill']
   @define {
-      x:      [ p.NumberSpec   ]
-      width:  [ p.DistanceSpec ]
-      top:    [ p.NumberSpec   ]
-      bottom: [ p.NumberSpec   ]
+      x:      [ p.NumberSpec     ]
+      width:  [ p.DistanceSpec   ]
+      top:    [ p.NumberSpec     ]
+      bottom: [ p.NumberSpec,  0 ]
     }

 module.exports =

Then we should be good to merge.

@bryevdv
Copy link
Member

bryevdv commented Jul 20, 2016

@ericmjl all expected tests passing. Thanks for the great PR! Let me know when you'd like to work on the hit-testing and I can help explain what's going on there.

@bryevdv bryevdv merged commit 8627d3b into bokeh:master Jul 20, 2016
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 21, 2016

@bryevdv thanks for guiding me through! Let me get my life back in order next week, and I'll be back up to try hit testing!

@damianavila
Copy link
Contributor

damianavila commented Jul 22, 2016

@ericmjl @bryevdv is there any issue opened for this PR? Or is it self-contained?

@ericmjl
Copy link
Contributor Author

ericmjl commented Jul 22, 2016

@damianavila I think this is linked to issue #3423. Hit testing is still missing, as mentioned above, but I plan to work on it in a separate PR.

@damianavila
Copy link
Contributor

damianavila commented Jul 22, 2016

Thanks @ericmjl.

@phobson
Copy link

phobson commented Aug 3, 2016

it would seem to me that the hit testing would be identical to the that of the Quad glyph. am I over-simplifying things? I'm messing with this here: phobson#1

@bryevdv
Copy link
Member

bryevdv commented Aug 3, 2016

@phobson yes that would work but the spatial index also has to be built (i.e. the _index_data method also needs to be implemented so that @index exists for _hit_point to make use of). Alternatively, _hit_point could iterate over all the data points and do "point in rect" hit testing by brute force.

@bryevdv
Copy link
Member

bryevdv commented Aug 3, 2016

@phobson as a reference the _index_data for quads is here:

https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/glyphs/quad.coffee#L10-L42

The index needs "top, bottom, left, right" coords. vbar has "top, bottom, x, width" and hbar has "y, height, left, right" so the main task in _index_data implementations for vbar and hbar would be to convert "x, width" into "left, right" and "y, height" into "top, bottom" respectively, then the index data method for each would follow what the one for quad does.

@phobson
Copy link

phobson commented Aug 3, 2016

@bryevdv thanks for the guidance.

I'll spend sometime on this on my own for a while and come back with more complete thoughts and questions -- perhaps with a proper PR.

@bryevdv
Copy link
Member

bryevdv commented Aug 3, 2016

@phobson that would definitely be extremely valuable and appreciated please let us know any questions we can answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

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