I would like to have a timeline x-axis, for example, starting from 09:00:00 to 11:30:00, then from 13:00:00 to 15:00:00. Since there is a gap between 11:30:00 and 13:00:00, it seems that the DateAxisItem can't meet my requirements.
I tried to use customized AxisItem like this:
time_line = ["09:00:00", "09:30:00", "10:00:00", "10:30:00", "11:00:00", "11:30:00", "13:00:00","13:30:00", "14:00:00","14:30:00", "15:00:00"] dict_time_line = dict(enumerate(time_line)) ticks = [(k, v) for k, v in dict_time_line.items()] axis_item = pg.AxisItem(orientation='bottom') axis_item.setTicks([ticks]) plot_widget.plotItem.setAxisItems({'bottom': axis_item}) It works, but there is another problem. The time strings overlap!!!
It doesn't automatically hide when I zoom in and out with the mouse wheel. 

没有评论:
发表评论