Protaeus
Protaeus

Reputation: 159

Rounded bars breaks tooltip in Altair

I am creating a stacked bar chart in altair and discovered that the toolbar and interactivity (data not shown for latter) breaks if I round the top of the bars. I tested on the dataset provided with altair as shown below to simplify the issue. Is there a way to resolve this issue or is it the nature of how the rounding works? If I remove the mark_bar options to round the corners (cornerRadiusTopLeft and cornerRadiusTopRight), the tooltip returns when hovering as shown below the code.

import altair as alt
from vega_datasets import data

source = data.seattle_weather()

alt.Chart(source).mark_bar(
    cornerRadiusTopLeft=3,
    cornerRadiusTopRight=3
).encode(
    x='month(date):O',
    y='count():Q',
    color='weather:N',
    tooltip=['precipitation', 'wind']
)

enter image description here

Upvotes: 1

Views: 247

Answers (1)

jakevdp
jakevdp

Reputation: 86320

This is due to a bug in Vega-Lite; see https://github.com/vega/vega-lite/issues/5956

Until that is fixed, I don't know of any workaround aside from avoiding rounded bars with tooltips.

Upvotes: 2

Related Questions