center_camera() {
        // calculate half_screen in world coords
        let stats = this.options.stats;
        let unitsPerPixel = this.options.unitsPerPixel;
        let viewWidthInUnits = this.viewSize.x * unitsPerPixel;

        // check whether at ends or at the center of the graph
        let atStart = (this._currentPosition - stats.x.min) < viewWidthInUnits;
        let atEnd = (stats.x.max - this._currentPosition) < viewWidthInUnits;
        
        // calculate min and max x axis visible
		let xmin = this._camera.position.x * this.options.unitsPerPixel;
        let xmax = xmin + (this._camera.right * 
            this.options.unitsPerPixel * this._camera.scale.x);
        let statsDelta = stats.x.max - stats.x.min;
        let xminNormalized = (xmin - stats.x.min) / statsDelta;
        let xmaxNormalized = (xmax - stats.x.min) / statsDelta;
        let currentCoverage = xmaxNormalized - xminNormalized;

        // if at endpoints, move the most possible to to that side.
        if (atStart) {
            this.setVisibleRange(0, currentCoverage);
            return;
        }

        if (atEnd) {
            this.setVisibleRange(1 - currentCoverage, 1);
            return;
        }

        // move the camera with the same zoom but with the current position 
        // line in the middle. 
        let currentPositionNormalized = (this._currentPosition - stats.x.min) / statsDelta;
        let halfCurrentCoverage = currentCoverage / 2;
        this.setVisibleRange(currentPositionNormalized - halfCurrentCoverage, currentPositionNormalized + halfCurrentCoverage);
    }
/**
     * @private
     * Sets the camera's x position such that the current position line sits 
     * at the center of the renderable area. This method doesn't verify if 
     * the current position is past the bounds of the graph. 
     */
@private
Sets the camera's x position such that the current position line sits
at the center of the renderable area. This method doesn't verify if
the current position is past the bounds of the graph.
@private Sets the camera ' s x position such that the current position line sits at the center of the renderable area . This method doesn ' t verify if the current position is past the bounds of the graph .
center_camera() {
        let stats = this.options.stats;
        let unitsPerPixel = this.options.unitsPerPixel;
        let viewWidthInUnits = this.viewSize.x * unitsPerPixel;
        let atStart = (this._currentPosition - stats.x.min) < viewWidthInUnits;
        let atEnd = (stats.x.max - this._currentPosition) < viewWidthInUnits;
		let xmin = this._camera.position.x * this.options.unitsPerPixel;
        let xmax = xmin + (this._camera.right * 
            this.options.unitsPerPixel * this._camera.scale.x);
        let statsDelta = stats.x.max - stats.x.min;
        let xminNormalized = (xmin - stats.x.min) / statsDelta;
        let xmaxNormalized = (xmax - stats.x.min) / statsDelta;
        let currentCoverage = xmaxNormalized - xminNormalized;
        if (atStart) {
            this.setVisibleRange(0, currentCoverage);
            return;
        }
        if (atEnd) {
            this.setVisibleRange(1 - currentCoverage, 1);
            return;
        }
        let currentPositionNormalized = (this._currentPosition - stats.x.min) / statsDelta;
        let halfCurrentCoverage = currentCoverage / 2;
        this.setVisibleRange(currentPositionNormalized - halfCurrentCoverage, currentPositionNormalized + halfCurrentCoverage);
    }
center_camera ( ) { let stats = this . options . stats ; let unitsPerPixel = this . options . unitsPerPixel ; let viewWidthInUnits = this . viewSize . x * unitsPerPixel ; let atStart = ( this . _currentPosition - stats . x . min ) < viewWidthInUnits ; let atEnd = ( stats . x . max - this . _currentPosition ) < viewWidthInUnits ; let xmin = this . _camera . position . x * this . options . unitsPerPixel ; let xmax = xmin + ( this . _camera . right * this . options . unitsPerPixel * this . _camera . scale . x ) ; let statsDelta = stats . x . max - stats . x . min ; let xminNormalized = ( xmin - stats . x . min ) / statsDelta ; let xmaxNormalized = ( xmax - stats . x . min ) / statsDelta ; let currentCoverage = xmaxNormalized - xminNormalized ; if ( atStart ) { this . setVisibleRange ( 0 , currentCoverage ) ; return ; } if ( atEnd ) { this . setVisibleRange ( 1 - currentCoverage , 1 ) ; return ; } let currentPositionNormalized = ( this . _currentPosition - stats . x . min ) / statsDelta ; let halfCurrentCoverage = currentCoverage / 2 ; this . setVisibleRange ( currentPositionNormalized - halfCurrentCoverage , currentPositionNormalized + halfCurrentCoverage ) ; }
@private
 Sets the camera's x position such that the current position line sits
 at the center of the renderable area.
@private Sets the camera ' s x position such that the current position line sits at the center of the renderable area .
// calculate half_screen in world coords // check whether at ends or at the center of the graph // calculate min and max x axis visible // if at endpoints, move the most possible to to that side. // move the camera with the same zoom but with the current position  // line in the middle. 