| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ice legend visibility.
…legend assignment.
…pies with showlegend and/or legend as arrays
|
@alexshoe Hi Alex! Do you possibly have an estimate when this PR could be tackled? Also, let me know if you have any questions :) |
Sorry, something went wrong.
|
Hey @my-tien! Sorry, just working through a backlog of different PRs that I was assigned. I'll start reviewing this tomorrow. |
Sorry, something went wrong.
…isibility # Conflicts: # test/plot-schema.json
|
@alexshoe Hi Alex, I saw that my branch got out of date and conflicted with the current test/plot-schema.json . EDIT: After wiping node_modules and re-installing with npm i the errors went away.
|
Sorry, something went wrong.
|
@my-tien could you please add some more information to the OP? I'm interested in seeing sections describing:
With that, I'll be able to better review the changes. |
Sorry, something went wrong.
…d instead of labels.
|
Hi @camdecoster, I also updated the OP and added a better description of the properties for the plot schema. Please let me know if anything is unclear or missing! |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for adding this feature! There are a few changes to make, but it seems to work well.
Sorry, something went wrong.
There was a problem hiding this comment.
Here are a few more suggestions.
Sorry, something went wrong.
| return value === true || value === false; | ||
| } | ||
|
|
||
| if (opts.arrayOk && isArrayOrTypedArray(v) && v.length > 0 && v.every(isBoolean)) { |
There was a problem hiding this comment.
Do you anticipate typed arrays being used here?
Sorry, something went wrong.
There was a problem hiding this comment.
No. So the general approach is not to accept typed arrays everywhere a normal array is accepted? Should I just check for Array.isArray?
Sorry, something went wrong.
There was a problem hiding this comment.
If no typed arrays are anticipated, then I think you should just use Array.isArray.
Sorry, something went wrong.
coerce: Simplify test for isSubplotId Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
There was a problem hiding this comment.
Looks good! Thanks for adding this feature.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR makes it possible to pass arrays to the pie properties 'legend' and 'showlegend' so that legend assignment and visibility can be configured per slice.
Changes:
Previously, traces.pie.legend and traces.pie.showlegend only accepted one value that applied for all slices. With this PR, slice legend entries can be grouped and individual slices can be hidden in the legend:
{ "data": [ { "labels": [ "BBBBBBBBBBBBBBBBBB", "AAAAAAAAAAAAAAAAAA", "222222222222222222", "111111111111111111", "unimportant" ], "values": [10, 15, 13, 19, 1], "type": "pie", "showlegend": [true, true, true, true, false], "legend": ["legend", "legend", "legend2", "legend2"] } ], "layout": { "width": 400, "height": 400, "legend": { "title": { "text": "Group 1" }, "xanchor": "left", "yanchor": "top", "x": -0.2, "y": -0.1 }, "legend2": { "title": { "text": "Group 2" }, "xanchor": "left", "yanchor": "top", "x": 0.6, "y": -0.1 } } }Result
Old behavior
No possibility to group slices semantically or to hide a slice. Also takes up more vertical space.

Testing
For testing, I added 3 mocks:
Note:
This feature is not expected to work when pie values are not set.
Disclaimer I am required to add that…the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.