Nicer time axis format.
authorCMDR furrycat <elite@furrycat.net>
Sun, 31 Jan 2016 19:56:01 +0000 (14:56 -0500)
committerCMDR furrycat <elite@furrycat.net>
Sun, 31 Jan 2016 19:56:01 +0000 (14:56 -0500)
entry.js
lib/timeline.php
timeline.js

index 2a6cd7f..e038ab3 100644 (file)
--- a/entry.js
+++ b/entry.js
@@ -610,7 +610,7 @@ function do_plot(table, canvas) {
 
   Plotly.plot(canvas, points, {
     title: 'Competitor distance',
-    xaxis: { title: 'Time (s)', autorange: true, rangemode: 'nonnegative'  },
+    xaxis: { title: 'Time (s)', autorange: true, rangemode: 'nonnegative', tickformat: '%H:%M:%S'  },
     yaxis: { title: 'Distance (Ly)', autorange: true, rangemode: 'nonnegative' },
     margin: { t: 0 } }
   );
index 4dc0c3d..1f569dc 100644 (file)
@@ -72,7 +72,7 @@
       if (! $entry_distance[$entry_id]) $entry_distance[$entry_id] = 0.0;
       $plot_key = $entry->getShip()->getCompetitor()->getCmdrName() . " #$entry_id";
       if (! is_array($plots[$plot_key])) $plots[$plot_key] = array(
-        "x" => array(0),
+        "x" => array("2001-01-01 00:00:00"),
         "y" => array(0),
         "name" => $plot_key,
         "text" => array("")
           }
           $total_distance = $entry_distance[$entry_id];
           $plot_key = $competitor->getCmdrName() . " #$entry_id";
-          $plots[$plot_key]["x"][] = $time;
+          $plots[$plot_key]["x"][] = "2001-01-01 $delta";
           $plots[$plot_key]["y"][] = $total_distance;
           $order = "station $station_order";
           if ($allotted_time) $order = "lap $lap_number $order";
index 25ab1b8..f4c7fd8 100644 (file)
@@ -36,7 +36,7 @@ function loaded() {
   if (canvas && points) {
     Plotly.plot(canvas, points, {
       title: 'Competitor distance',
-      xaxis: { title: 'Time (s)', autorange: true, rangemode: 'nonnegative'  },
+      xaxis: { title: 'Time', autorange: true, rangemode: 'nonnegative', tickformat: '%H:%M:%S'  },
       yaxis: { title: 'Distance (Ly)', autorange: true, rangemode: 'nonnegative' },
       margin: { t: 0 } }
     );