我的代码:
# Create website bar chart
website_fig = go.Bar(
x=[
today + " - " + one_week,
one_week + " - " + two_week,
two_week + " - " + three_week,
three_week + " - " + four_week,
],
y=[
product_data[today + " - " + one_week][network],
product_data[one_week + " - " + two_week][network],
product_data[two_week + " - " + three_week][network],
product_data[three_week + " - " + four_week][network]
],
name="Website statistic"
)
y
中的值为3, 0, 0, 0
。我已经打印了。使用type(value)
尝试了它们的类型,它是class int
。图表以-1, -0.5, 0, 0.5, 1
y轴呈现。 x轴很好。我尝试将y
的值替换为硬编码的3,0,0,0
,并且可以正常工作。试图使用int(value)
将它们设置为整数,并尝试将它们分别乘以1 int(value) * 1
和value * 1
。
谢谢您的每一个建议!整个代码为here