I have BAR chart using plotly. Graph is perfectly fine the way I want. I can display X-axis and Y-axis values as annotation in each bar as well. I can export the same in html file and looks good as well.
Here is issue. If I zoom out or zoom in, annotation text which marked as left aligned, gets disturbed. And from left aligned, it becomes center aligned. In fact, if I just click on graph, annontation alignment gets disturbed. Here is sample code.
bar_df1 = go.Bar(
color=‘rgba(55, 128, 191, 1.0)’
orientation = ‘h’
data = [bar_df1]
xcoord = df1[‘x-axis value’]
y1 = df1[‘y-axis value’]
annotationsList = [dict(
text=str(yi) + str(xi),
font = dict(color = ‘black’ ),
align = ‘center’,
valign = ‘middle’
) for xi, yi in zip(xcoord, y1)]
annotations = annotationsList
layout = go.Layout(annotations=annotations, width = 800,
plot_bgcolor=‘rgb(248, 248, 255)’
fig = go.Figure(data=data, layout=layout)
Could you please suggest a way to resolve issue.