Hi everyone, I want to overlay bar charts on top of each other. To do this, I use the ‘base’-property of the Bar-Chart figure, to create offset, see the code and pictures below. The charts are looking good but there is a problem with the hover of the inner bars, if I use the hovermode=‘clsest’. As you can see on the first picture, if I hover on the right end of the inner bar, the hover information is correct but if I go to the left side of the inner bar, I get the hovertext of the outer Bar-Chart, which is wrong. How can I combat this problem ?
Hover-Good
Hover-Bad
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children='Prototype'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [15], 'y': ['A'], 'type': 'bar', 'name': 'A', 'orientation': 'h'},
{'x': [15], 'y': ['B'], 'type': 'bar', 'name': 'B', 'orientation': 'h'},
{'x': [15], 'y': ['C'], 'type': 'bar', 'name': 'C', 'orientation': 'h'},
{'x': [15], 'y': ['D'], 'type': 'bar', 'name': 'D', 'orientation': 'h'},
## Activations
{'x': [4], 'y': ['B'], 'type': 'bar', 'base': 7, 'width': 0.5, 'orientation': 'h'},
],
'layout': {
'title': 'Dash Data Visualization',
'barmode': 'stack',
'hovermode': 'closest',
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)