File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -290,6 +290,19 @@ function renderPlot(data) {
290290
291291 var lastHighlightPoints = null , lastHighlightX = null ;
292292
293+ // When there's a single data point, xMin===xMax and Dygraph clips the dot
294+ // at the canvas edge. Compute an explicit dateWindow with padding.
295+ var singlePointWindow = null ;
296+ if ( built . data . length === 1 ) {
297+ var xVal = equidistant ? built . data [ 0 ] [ 0 ] : built . data [ 0 ] [ 0 ] . getTime ( ) ;
298+ if ( equidistant ) {
299+ singlePointWindow = [ xVal - 1 , xVal + 1 ] ;
300+ } else {
301+ var dayMs = 86400000 ;
302+ singlePointWindow = [ new Date ( xVal - dayMs ) , new Date ( xVal + dayMs ) ] ;
303+ }
304+ }
305+
293306 plotInstance = new Dygraph (
294307 document . getElementById ( 'plot' ) ,
295308 built . data ,
@@ -307,6 +320,7 @@ function renderPlot(data) {
307320 y : { valueRange : [ 0 , null ] }
308321 } ,
309322 xRangePad : 20 ,
323+ dateWindow : singlePointWindow ,
310324 connectSeparatedPoints : true ,
311325 underlayCallback : function ( canvas , area , g ) {
312326 versionBoundaries . forEach ( function ( b ) {
You can’t perform that action at this time.
0 commit comments