Created
July 10, 2018 15:49
-
-
Save nyurik/713eec64a4a5553f54a1d074615b01ad to your computer and use it in GitHub Desktop.
vega with conditional image (centered and stretched to the largest size preserving aspect ration)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega/v4.json", | |
"width": 200, | |
"height": 200, | |
"padding": 5, | |
"marks": [ | |
{ | |
"type": "image", | |
"encode": { | |
"enter": { | |
"url": [ | |
{ | |
"test": "false", | |
"value": "https://www.maxpixel.net/static/photo/1x/Ailurus-Fulgens-Red-Panda-Panda-Fire-Fox-Bear-Cat-3040830.jpg" | |
}, | |
{ | |
"value": "https://www.thelocal.de/userdata/images/article/fa6fd5014ccbd8f4392f716473ab6ff354f871505d9128820bbb0461cce1d645.jpg" | |
} | |
], | |
"x": {"signal": "width/2"}, | |
"y": {"signal": "height/2"}, | |
"width": {"signal": "width"}, | |
"height": {"signal": "height"}, | |
"align": {"value": "center"}, | |
"baseline": {"value": "middle"} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment