@@ 595-603 (lines=9) @@ | ||
592 | if i == 0: |
|
593 | return values[0] |
|
594 | else: |
|
595 | if v - values[i - 1] <= values[i] - v: |
|
596 | return values[i - 1] |
|
597 | else: |
|
598 | return values[i] |
|
599 | ||
600 | __intervals = [ |
|
601 | 1, 2, 5, 10, 15, 30, 60, |
|
602 | 2 * 60, 10 * 60, 30 * 60, 3600, |
|
603 | 2 * 3600, 3 * 3600, 6 * 3600, 12 * 3600, 24 * 3600, |
|
604 | ] |
|
605 | ||
606 | def plot_on_mpl_axes(self, ax): |
|
@@ 622-628 (lines=7) @@ | ||
619 | max_time = ( |
|
620 | max(a.max_time for a in self.__actions.itervalues()).replace(microsecond=0) + |
|
621 | datetime.timedelta(seconds=1) |
|
622 | ) |
|
623 | duration = int((max_time - min_time).total_seconds()) |
|
624 | ||
625 | ax.set_xlabel("Local time") |
|
626 | ax.set_xlim(min_time, max_time) |
|
627 | ax.xaxis_date() |
|
628 | ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter("%H:%M:%S")) |
|
629 | ax.xaxis.set_major_locator(matplotlib.dates.AutoDateLocator(maxticks=4, minticks=5)) |
|
630 | ||
631 | ax2 = ax.twiny() |