Hi, I would like to put an horizontal line on the area chart representing the monthly goal, which should be a constant value for the entire month, like on this pic below (the pic below is not an area chart, but shows the line properly):
The code is below (I tried using rules, etc, but was not successfull):
Vega Lite Code
{
“data”: {“name”: “dataset”},
“config”: {
“view”: {“stroke”: “transparent”}
},
“layer”: [
{
“mark”: {
“type”: “area”,
“interpolate”: “natural”,
“point”: {“color”: “green”},
“tooltip”: true,
“grid”: null,
“line”: {“color”: “green”},
“color”: {
“x1”: 0,
“x2”: 0,
“y1”: 0,
“y2”: 1,
“gradient”: “linear”,
“stops”: [
{
“offset”: 0,
“color”: “green”
},
{
“offset”: 1,
“color”: “white”
}
],
“point”: {
“filled”: true,
“color”: “#4B7430”
}
}
}
},
{
“mark”: {“type”: “rule”, “color”: “red”},
“encoding”: {“y”: {“datum”: 12, “type”: “quantitative”}},
“tooltip”: true
},
{
“mark”: {
“type”: “text”,
“dx”: -8,
“dy”: -10,
“color”: “white”,
“baseline”: “middle”,
“align”: “top”,
“fontSize”: 14
},
“encoding”: {
“text”: {
“field”: “Faturamento”,
“format”: “.2f”
}
}
}
],
“encoding”: {
“x”: {
“field”: “Dia Mes”,
“type”: “nominal”,
“axis”: {
“title”: null,
“labelAngle”: 0,
“labelColor”: “white”,
“labelFontSize”: 12
}
},
“y”: {
“field”: “Faturamento”,
“type”: “quantitative”,
“title”: null,
“axis”: {
“labelColor”: “black”,
“labelFontSize”: 12
}
}
}
}
Thanks