I have an horizontal bullet chart. The x-axis goes from 0%
to 100%
.
Currently, all ticks are by default “text-centered”:
This makes that the first tick (0%
) and the last tick (100%
) stick out of the left and right ends of the chart. However, I’d like that my ticks don’t stick out:
How to make the 0%
(first) tick left aligned, the 100%
(last) one right aligned, and all the others centred?
MWE:
import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.figure_factory as ff
app = dash.Dash(__name__)
fig = ff.create_bullet(
orientation='h',
ranges='range',
measures='data',
data=[dict(
range=[.4, .5, 1],
data=[0, .42],
)],
title=None,
hovermode=False,
xaxis=dict(
range=[0, 1],
fixedrange=True,
tickformat=',.0%',
automargin=False,
),
)
app.layout = html.Div(
[
dcc.Graph(
id='bullet-chart',
figure=fig,
config=dict(
displayModeBar=False
),
),
]
)
if __name__ == '__main__':
app.run_server(debug=True)