-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
adding support for icon-rotate and icon-allow-overlap in mapbox #4575
Conversation
added to angles example
I fixed the failing codestyle test.
Why would the arrayOk be expect to be true? I understood it as a parameter to signal that this flag should not in fact be allowed to be an array. |
Thanks for the PR!
That's because Lines 66 to 74 in 4d24c36
doesn't |
Ok thanks @zouhairm for fixing the tests! I'll tag your PR under the milestone for the next minor ( Before merging, we'll need to add a few jasmine tests, testing the convert logic, similar to e.g. this one: plotly.js/test/jasmine/tests/scattermapbox_test.js Lines 162 to 198 in 0e444b6
and we'll need to update the |
I've added a jasmine test for checking angles are set in the features dictionary and allow-icon-overlap flag and icon-rotate property in the symbol.layout. LMK if anything else is needed. BTW, do I need to do anything for this to be accessible by plotly.py, or once it is bumped to point to the new version it will update based on the attributes.js? |
@etpinard : please let me know if anything else is needed for this or if it can be tagged for the next release? Also do I need to do something for plotly.py or is that automatic? |
Hey @etpinard or @archmoj - Any updates on timeline for this? Alternatively, if you have some input on how I can get this working on my project by using my own fork while waiting for the PR to be merged? I posted a question in the plotly community: Thanks! |
@nicolaskruchten in the following weeks, when possible, it would be great to have your thoughts on this PR. |
Thanks @archmoj - I'm still really hoping for some instructions on how to use my own fork while waiting for this to be merged. That would be very helpful and motivating for me to continue adding features especially if it can take this long to get a PR merged :| |
Hi @zouhairm ! I'm really sorry we have not been in a position to review your contribution just yet. We've been very short-handed recently, and we will try to get to it soon. With respect to Plotly.py, once a PR is merged, the next release of Plotly.js will contain these changes, and the next release of Plotly.py after the JS release will automatically contain the changes. This happens via code-generation in the Plotly.py repository. It may be possible to run Plotly.py code-generation yourself, based on an un-merged/un-released version of Plotly.js (i.e. your fork) by looking at what https://github.com/plotly/plotly.py/blob/master/contributing.md#update-to-a-new-version-of-plotlyjs does and tweaking some paths to point to your desired version of Plotly.js instead of the official release. If you want to create an issue for this in the Py repo, we can probably help you out and document this more clearly for everyone. Regarding this pull request, we need to get version 1.53 of Plotly.js out the door this week and then recover a little bit so we will take a look during the 1.54 release cycle. Thanks for your patience and apologies about being radio-silent recently. |
Thanks @nicolaskruchten - that's unfortunate about the timing, but I was really hoping this would make it in 1.53 after Etienne's comment . I should have stopped by the plotly offices when I was visiting my parents in Montreal back in February :p I had followed the instructions on updating plotly.js and tried modifying the code but that didn't work and so I posted in the community forums. I'll create an issue on plotly.py with the code I have hopefully get help from there especially if this PR won't be in until 1.54 |
OK. I'm sorry again about the timing, it's been a very tough few weeks for everyone. The good news is that we're expecting the 1.54 cycle to be shorter than usual (2-3 weeks hopefully!), as it mostly contains work that was partly-done in the 1.53 cycle and then deferred so we could get some time-sensitive features shipped. |
@@ -294,7 +318,7 @@ function makeSymbolGeoJSON(calcTrace, gd) { | |||
|
|||
function getFillFunc(attr) { | |||
if(Lib.isArrayOrTypedArray(attr)) { | |||
return function(v) { return v; }; | |||
return function(i) { return attr[i]; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually seems just fine for symbol and text, since those are both strings / string arrays. But what happens for angles if the user provides an array of numbers-as-strings? A single number as a string will get converted to an actual number by coerce
, but for performance we don't reach into arrays to do this (until the calc
step - that would be the one benefit of including angle
in calc, if it was being used from there here, but I don't recommend that because scattermapbox
shares calc with scattergeo
so this would need to be a special case.)
It may be that this is just fine - assuming mapbox casts this angle to a number consistently, and treats non-numbers as 0. Can you confirm that this works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so I tested this, and yes basically coerce seems to turn a string into an actual number which means it gets interpreted as an acceptable angle, but if provided as an array, then string values get passed on to mapbox which treats non-numbers as 0.
I'm not sure whether that's an acceptable behavior, and honestly I don't think I know enough about the code to figure out how to make it work the way it should without having to have a few back and forths and me diving deeper into other functions. So if you don't mind if this is not acceptable, it'd be great if you could suggest a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 1e1458b should do it 🙏
@zouhairm this PR is looking great! Just a few small comments above and we should be ready to go. Apologies again for the delay getting this looked at. |
Co-Authored-By: alexcjohnson <johnson.alex.c@gmail.com>
Co-Authored-By: alexcjohnson <johnson.alex.c@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, aside from me breaking and fixing your test with the explicit 0
, looks like the tests are just a bit flaky, took a little rerunning to pass. Some days CI just does that...
Looks great! 💃 - @archmoj I'll let you merge when you're ready.
heh OK, that was my instigation :) I'm not sure a simple |
Added ability to specify an angle to rotate symbols in scattermapbox.
This uses the icon-rotate from mapbox. Also added the ability to allow icons to overlap.
Note sure who to tag to review ... Tagging @etpinard since you seem to have authored most of the files I'm modifying.
Question: once this is merged, what's needed to ensure that the plotly.py gets the update? are the attributes.js enough to define the schema for it to be recognized as a valid property? How do I test that by pointing my local version of plotly.py to this branch?