@@ -101,8 +101,8 @@ export class GraphHistogramComponent implements OnChanges, AfterViewInit {
101101 type : 'histogram' ,
102102 autobinx : false ,
103103 xbins : {
104- start : Math . min . apply ( Math , this . points [ i ] . x ) ,
105- end : Math . max . apply ( Math , this . points [ i ] . x ) ,
104+ start : this . arrayMin ( this . points [ i ] . x ) ,
105+ end : this . arrayMax ( this . points [ i ] . x ) ,
106106 size : this . size
107107 }
108108 } ) ;
@@ -120,8 +120,8 @@ export class GraphHistogramComponent implements OnChanges, AfterViewInit {
120120 for ( let i : number = 0 ; i < changes . points . currentValue . length ; i ++ ) {
121121 update1 . x . push ( changes . points . currentValue [ i ] . x ) ; //Calculates the changes for each trace again
122122 update1 . xbins . push ( {
123- start : Math . min . apply ( Math , changes . points . currentValue [ i ] . x ) ,
124- end : Math . max . apply ( Math , changes . points . currentValue [ i ] . x ) ,
123+ start : this . arrayMin ( changes . points . currentValue [ i ] . x ) ,
124+ end : this . arrayMax ( changes . points . currentValue [ i ] . x ) ,
125125 size : this . size
126126 } ) ;
127127 }
@@ -138,6 +138,26 @@ export class GraphHistogramComponent implements OnChanges, AfterViewInit {
138138 }
139139 }
140140
141+ /**
142+ * Maximum of given array
143+ * @param array
144+ */
145+ private arrayMax ( array ) {
146+ return array . reduce ( function ( a , b ) {
147+ return Math . max ( a , b ) ;
148+ } ) ;
149+ }
150+
151+ /**
152+ * Minimum of given array
153+ * @param array
154+ */
155+ private arrayMin ( array ) {
156+ return array . reduce ( function ( a , b ) {
157+ return Math . min ( a , b ) ;
158+ } ) ;
159+ }
160+
141161 /**
142162 * Redraw the layout after changing the YAxis title
143163 * @param $event
0 commit comments