public void addDataToSeries(double dataX, double dataY, double rate){
        
        this.dataY = dataY;
        this.dataX = dataX;
        
        series.getData().add(new LineChart.Data(this.dataX, this.dataY));
      
        if (dataX > (xUpperBound-rate*4) && Math.ceil(dataX) != xUpperBound) {
            switch(switchInt){
                case 1: xLowerBound+=rate;
                        xUpperBound+=rate;
                        xAxis.setLowerBound(xLowerBound);
                        xAxis.setUpperBound(xUpperBound); 
                        break;
                case 2: if(dataX > yUpperBound){  
                            xUpperBound += rate;
                            xAxis.setUpperBound(Math.floor(yUpperBound));
                        }       
                        break;
            }
        }
        
        if(dataY > (yUpperBound-rate*4) && Math.ceil(dataY) != yUpperBound || dataY < (yUpperBound) && Math.floor(dataY) != yLowerBound){
            switch(switchInt){
                case 1: if(Math.ceil(dataY) > yUpperBound){
                            yUpperBound = Math.ceil(dataY);
                        }
                        
                        yAxis.setUpperBound(yUpperBound);
                        yAxis.setLowerBound(yLowerBound);
                        break;
                    
                case 2: if(dataY > yUpperBound){  
                            yUpperBound += rate;
                            yAxis.setUpperBound(Math.floor(yUpperBound));
                        }       
                        break;
            }
        }
    }