Hi. I’m trying to make a highlight on hover effect on my line chart, but I’m getting the following error:
I did some googling, looked at Vega Lite’s documention, looked at @Greg workout, but I still did not find where I should put the param definitions in order to remove the duplicate error. I know if I use the code example from the the documentation I will get it to work, but I wanna learn how to put it on my own, so I have more freedom and in the future can implement it on already made visuals, shaping it as I wish.
Thank you.
FatMasked.pbix (3.4 MB)
Code
{
“data”: {“name”: “dataset”},
“params”: [
{
“name”: “highlight”,
“select”: {
“type”: “point”,
“on”: “mouseover”,
“encodings”: [“x”, “y”]
}
},
{
“name”: “select”,
“select”: “point”
}
],
“encoding”: {
“color”: {
“condition”: {
“param”: “highlight”,
“field”: “Regiao”,
“type”: “nominal”,
“legend”: null
},
“value”: “grey”
},
“opacity”: {
“condition”: {
“param”: “highlight”,
“value”: 1
},
“value”: 0.2
}
},
“layer”: [
{
“mark”: “line”,
“encoding”: {
“x”: {
“field”: “Dia Mes”,
“type”: “nominal”,
“title”: “date”
},
“y”: {
“field”: “Faturamento”,
“type”: “quantitative”,
“title”: “Faturamento”
}
}
},
{
“encoding”: {
“x”: {
“aggregate”: “max”,
“field”: “Dia Mes”,
“type”: “nominal”
},
“y”: {
“aggregate”: {
“argmax”: “Dia Mes”
},
“field”: “Faturamento”,
“type”: “quantitative”
}
},
“layer”: [
{“mark”: {“type”: “circle”}},
{
“mark”: {
“type”: “text”,
“align”: “left”,
“dx”: 4
},
“encoding”: {
“text”: {
“field”: “Regiao”,
“type”: “nominal”
}
}
}
]
}
],
“config”: {“view”: {“stroke”: null}}
}