vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

feat: support autosize fit for faceted plots

Open drgould opened this issue 4 years ago • 29 comments

Based on discussion in #5219 and stealing some code from #5225, this adds support for specifying the outer plot dimensions and sizing the inner facets automatically which subsequently allows unlocking autosize: fit(-x/-y) for faceted plots.

Note: this is only for specs which explicitly define the facet operator at the top level.

  • [x] Add tests
  • [x] Update docs

drgould avatar Jun 22 '20 22:06 drgould

This is exciting. @drgould let us know when this is ready for a review.

I know @willium was interested in this feature as well.

domoritz avatar Aug 12 '20 20:08 domoritz

Hi @drgould, do you plan to finish this pull request?

domoritz avatar Nov 19 '20 18:11 domoritz

Sorry, yeah I haven't had a chance to get back to this. My team has been hard at work implementing vega-lite into our product and this kinda fell on the back burner. We just launched it on Tues. so now were starting to pick back up some of this tech debt. The version we're currently using is a bit behind and we've been in need some of the new features so this will likely be prioritized very soon.

drgould avatar Nov 19 '20 19:11 drgould

Oh, that's awesome to hear. Congrats on launching the feature 🎉 . If you want, you can send a pull request to add it to https://vega.github.io/vega-lite/ecosystem.html.

More generally, I would be happy to collaborate more closely on features and make sure to do a quick review/release turn around when you need a particular feature for your product. You have probably seen our roadmap and if there are bigger things you would like to tackle, we can add it there as well.

domoritz avatar Nov 19 '20 19:11 domoritz

Hi @domoritz @drgould ! We would really need this feature as we are developing customisable widget dashboards using vega-lite. So having responsive grouped bar charts is mandatory for us and I think it's impossible without this ticket.

Do you need any help to merge this ? I'd be glad to help on that in order to have this into vega-lite :)

wmarques avatar Feb 25 '21 10:02 wmarques

@wmarques yes, I won't have the cycles to implement this but I can review a pull request. Could you open a new pull request with this code and any improvements you want to make?

domoritz avatar Feb 25 '21 10:02 domoritz

@domoritz Sure, i'll check if this code works for us first, thanks for the quick answer !

wmarques avatar Feb 25 '21 10:02 wmarques

Thank you for offering to help. I look forward to your contributions.

domoritz avatar Feb 25 '21 10:02 domoritz

@wmarques If all you need is a "responsive" grouped bar it's fairly easy to accomplish without faceting using a few transforms and a labelExpr: https://vega.github.io/editor/#/gist/2d591c1cea91c8281e27900240f058b8/grouped_bar_single_layer.json

As for finishing up this PR, it's finally in my tasks for this sprint so I should be finishing it up very soon.

drgould avatar Feb 25 '21 19:02 drgould

@drgould Oh thanks alot I'll look into your example ! And that's great news for this ticket :) Thank you both for your very fast help !

wmarques avatar Feb 26 '21 09:02 wmarques

Just wanted to check in to see whether you need any help with getting this over the finish line. Please mark the pull request as ready for review when you want me to look at it.

domoritz avatar Mar 14 '21 03:03 domoritz

Ok I think I have this in a good enough place to open this up for review. I need a bit of guidance about any additional unit/spec/visual tests that might help as well as for the changes to the docs.

Edit: looking into the failing tests. Edit 2: tests fixed

drgould avatar Mar 15 '21 16:03 drgould

I'm running into an issue with the PR checks on this one. I added a new example for regression testing but I can't get it to build when running yarn build:examples locally and it's also failing here for the same reason. It's saying it can't find the data file (https://github.com/chartio/vega-lite/runs/2222993356?check_suite_focus=true#step:9:2952). I also tried to regenerate an existing example and it failed with the same error.

drgould avatar Mar 30 '21 19:03 drgould

The example generation depends on specifics of the OS so we usually let the ci do it (see contributing docs). If the ci doesn't do it for you, can you check your setup in your fork? I can help if there is some issue with it.

domoritz avatar Mar 30 '21 19:03 domoritz

Yeah there definitely seems to be an issue with how the fork is set up. The really weird thing is it was working when I originally created this PR and didn't touch any of the workflows/etc. so ¯\_(ツ)_/¯

The only thing I see that's obviously wrong is the check workflow can't commit likely because the actions bot key is meant for this repo rather than the fork. But regardless the examples still aren't building correctly.

drgould avatar Mar 31 '21 16:03 drgould

Can you try setting a GH_PAT in your repo secrets of your fork? If it doesn't work, I can copy your branch into this repo when you think it's ready.

You can definitely build the schema locally, though (using yarn schema).

domoritz avatar Mar 31 '21 17:03 domoritz

I copied the pull request to our repo over at https://github.com/vega/vega-lite/pull/7356 so we can build the examples.

domoritz avatar Apr 04 '21 18:04 domoritz

@drgould is there anything I can help with to get this pull request over the finish line?

domoritz avatar Apr 13 '21 15:04 domoritz

Sorry been working on some other things and haven't had a chance to get back to this. I'll hopefully have some time to make those changes soon.

drgould avatar Apr 13 '21 23:04 drgould

Hello.

Doest the pyramidal distribution (ie: using hconcat) will be affected by this feature and became responsive ?

Thank you.

Code: Vega editor

cdomergue avatar Apr 15 '21 09:04 cdomergue

No, this is for faceted charts only. We already support single view and layered plots.

domoritz avatar Apr 15 '21 14:04 domoritz

@drgould Is there anything we can help with to get this pull request over the finish line?

domoritz avatar May 25 '21 15:05 domoritz

Our priorities shifted quite significantly a couple months ago and I haven't had any time to get back to this. I was hoping I would be able to carve out some time to finish this up but realistically I won't be able to do any work on this for at least 3 months. At this point it might be better if someone else takes this over.

drgould avatar May 26 '21 21:05 drgould

Thanks for the update and good luck with the new direction @drgould.

@wmarques do you have time to take it from here?

domoritz avatar May 26 '21 22:05 domoritz

is this likely to get released soon? its exactly what i need

Since it's not merged, no. Please help us push it over the finish line if you need it.

domoritz avatar Aug 14 '21 21:08 domoritz

Interested in this one as well.

fgenoese avatar Jan 06 '22 09:01 fgenoese

Since it's not merged, no. Please help us push it over the finish line if you need it.

Would you be able to summarize what is needed for this to be completed? I may have some time to look into it!

BradyJ27 avatar Sep 27 '23 20:09 BradyJ27

That's awesome. It's been a while so I can't summarize it but you should find everything in the comments in this pull request. Let us know if you have specific questions.

domoritz avatar Sep 29 '23 12:09 domoritz