Slackbot
05/01/2023, 7:30 PMangie
05/01/2023, 7:52 PMPlot.plot({
color: { legend: true },
height: 500,
width: 1200,
facet: {
data: total,
x: "segments"
},
marks: [
Plot.dot(total, {
x: "year",
y: "general renevue",
stroke: "company"
}),
Plot.rect(
total,
Plot.selectLast({
x1: d => d["year"] - 10,
y1: d => d["general renevue"] - 500,
x2: d => d["year"] + 10,
y2: d => d["general renevue"] + 500,
fill: "yellow",
})
),
Plot.text(
total,
Plot.selectLast({
x: "year",
y: "general renevue",
text: "general renevue",
fill: "black",
frameAnchor: "bottom"
})
)
]
})
angie
05/01/2023, 7:53 PMFil
05/01/2023, 9:14 PMPlot.rect(
total,
Plot.selectLast({
inset: -60,
insetTop: -16,
insetBottom: -16,
rx: 15,
fill: "pink",
x: "year",
y: "general renevue",
text: "general renevue",
frameAnchor: "bottom"
})
),
and to make it well-balanced, use lineAnchor: "middle"
in the text markangie
05/01/2023, 10:42 PM