Skip to content
Advertisement

Vega-lite: Legend label expression to include value of multiple fields

My code is as follows;

JavaScript

Below is the link to the vega editor.

https://vega.github.io/editor/#/gist/947b2a99801bc6a08d468cdb9acbeb50/legend.json

My aim is to show the legend to include value of 2 fields i.e. type and count fields with a hyphen. Example :
In the image below, I wanted to show the legends as
‘Apple – twenty’
and
‘Mango – ten’
How could I do the same? enter image description here

Advertisement

Answer

enter image description here

I would just create a new calculated field and use that.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement