似乎目前在y轴上只支持整数作为值。我不能使用条形图,因为它不接受序列中的xvalues。在
# the columns value here is int
values = Reference(ws, (2, 2), (10, 2))
# the columns value here is string
values2 = Reference(ws, (2, 1), (10, 1))
series = Series(values, xvalues=values2, title="Chart")
chart = ScatterChart()
chart.append(series)
ws.add_chart(chart)
wb.save(file_name) # exception
File "/lib/python3.4/site-packages/openpyxl/charts/graph.py", line 31, in compute_axes
mini, maxi = self._get_extremes('xvalues')
File "/lib/python3.4/site-packages/openpyxl/charts/graph.py", line 58, in _get_extremes
return min(series_min), max(series_max)
TypeError: unorderable types: NoneType() < int()
如果没有样本数据,很难说太多,但有一点需要注意,数据序列既有数据集,也有标签。散点图不能真正与非数值轴一起工作。在
在项目的示例代码中有一个带有标签的条形图示例。在
相关问题 更多 >
编程相关推荐