File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 1717
1818const t = d3 . transition ( ) . duration ( 600 ) . ease ( d3 . easeQuadOut ) ;
1919
20- function padZero ( s ) {
21- return s < 10 ? "0" + s : s ;
22- }
23-
2420function timeFormatPicker ( n , days ) {
2521 return function ( d , i ) {
2622 if ( days <= 1 ) {
@@ -58,7 +54,7 @@ class Chart extends Component {
5854 return ;
5955 }
6056
61- let daysDiff = Math . round ( ( newProps . dateRange [ 1 ] - newProps . dateRange [ 0 ] ) / 24 / 60 / 60 ) ;
57+ let daysDiff = Math . round ( ( newProps . dateRange [ 1 ] - newProps . dateRange [ 0 ] ) / 1000 / 24 / 60 / 60 ) ;
6258 let stepHours = daysDiff > 1 ? 24 : 1 ;
6359 this . setState ( {
6460 diffInDays : daysDiff ,
@@ -187,6 +183,8 @@ class Chart extends Component {
187183 // hide all "day" ticks if we're watching more than 31 items of data
188184 if ( data . length > 31 ) {
189185 xAxis . tickValues ( data . filter ( d => d . Date . getDate ( ) === 1 ) . map ( d => d . Date ) )
186+ } else if ( data . length > 15 ) {
187+ xAxis . tickValues ( data . filter ( ( d , i ) => d . Date . getDate ( ) === 1 || i === 0 || i == Math . floor ( ( data . length - 1 ) / 2 ) || i === data . length - 1 ) . map ( d => d . Date ) )
190188 }
191189
192190 // empty previous graph
You can’t perform that action at this time.
0 commit comments