Brand spanking new to Altair. Trying to do something that seems like it should be straightforward, but I'm hitting a wall.
Trying to get the title of a tooltip to be the x-axis value.
Code's fairly straightforward:
df = pd.DataFrame({
"x": ["Poor", "Fair", "Good", "Very Good", "Excellent"],
"y": [0, 1, 3, 0, 12],
"color": ["#356FC7", "#82AAE3", "#33578D", "#CBCBCB", "#90959B"]
})
chart = alt.Chart(df).mark_bar().properties(
height=200,
width=200
).encode(
x=alt.X("x:N", sort=None),
y=alt.Y("y:Q"),
color=alt.Color("color:N", scale=None),
tooltip=[alt.Tooltip("y", title="x")]
)
Rather than the hard-coded "x" for the title, how can I get the tooltip to use the x-axis value?
Thanks in advance!