From: CMDR furrycat Date: Sun, 31 Jan 2016 19:56:01 +0000 (-0500) Subject: Nicer time axis format. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=8f8595f440fb40b75059f93c3cb7790b774d9869;p=furrycat%2Frace-o-matic.git Nicer time axis format. --- diff --git a/entry.js b/entry.js index 2a6cd7f..e038ab3 100644 --- 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 } } ); diff --git a/lib/timeline.php b/lib/timeline.php index 4dc0c3d..1f569dc 100644 --- a/lib/timeline.php +++ b/lib/timeline.php @@ -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("") @@ -119,7 +119,7 @@ } $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"; diff --git a/timeline.js b/timeline.js index 25ab1b8..f4c7fd8 100644 --- a/timeline.js +++ b/timeline.js @@ -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 } } );