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

Add possibility for vconcat => columns => expression #9291

Open
1 task done
apb-reports opened this issue Mar 21, 2024 · 0 comments
Open
1 task done

Add possibility for vconcat => columns => expression #9291

apb-reports opened this issue Mar 21, 2024 · 0 comments

Comments

@apb-reports
Copy link

apb-reports commented Mar 21, 2024

I need the ability to have many charts wrap automatically with the use of vconcat and facet. To get this working I need ability to set vconcat columns with an expression.
I can get page width like this:

"params": [
{ "name": "_width", "value": "0", "on": [ { "events": { "source": "window", "type": "resize" }, "update": "windowSize()[0]" }]},
],

Then get width and column width like this:

"transform": [
{"calculate": "windowSize()[0]", "as": "windowWidthTemp"},
{"calculate": "_width", "as": "windowWidth"},
{"calculate": "datum.windowWidth == 0 ? datum.windowWidthTemp : datum.windowWidth", "as": "windowWidthFinal"},
{"calculate": "datum.windowWidthFinal <= 500 ? 1 : datum.windowWidthFinal <= 1000 ? 2 : datum.windowWidthFinal <= 1500 ? 3 : datum.windowWidthFinal <= 2000 ? 4 : 5", "as": "chartColumns"}
]

To wrap things up I need this to work:

"vconcat": [
    {
      "columns": {"expr": "datum.chartColumns"},

Thanks in advance.

My stackoverflow example:
https://stackoverflow.com/questions/78186820/vega-lite-facet-chart-spread-over-columns-and-rows

  • I checked for duplicate issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant