I am creating a horizontal stack bar chart and want to add legend , but i want legend color on the basis of field are define in my data(i.e color_name) in each data element
i want legend use my color field and also show legend label on the basis of different field i.e "occuring_event" . how it is possible what are modification in data set require to achieve this.
i just used scale range in specs as but not look same as i want scale range use plz check in editor
There is an example in the docs you can use as a guide:
https://vega.github.io/vega-lite/docs/scale.html#example-setting-color-range-based-on-a-field