private void smoothValues(XYDataItem[] plotArray, int smoothLevel) {

        double[] tempArray = new double[plotArray.length];
        for (int i = 0; i < tempArray.length; i++) {
            tempArray[i] = plotArray[i].getYValue();

        }

        for (int i = 0; i < tempArray.length; i++) {
            double futureSmooth = tempArray[i];
            double pastSmooth = tempArray[i];
            for (int j = 0; j < smoothLevel; j++) {

                if(i+j+1 < tempArray.length){
                    futureSmooth = futureSmooth + ((tempArray[i + j + 1] -futureSmooth) * Math.pow(0.8f, j + 1));
                }
                if(i-j-1 >= 0){
                    pastSmooth = pastSmooth + ((tempArray[i - j - 1] - pastSmooth ) * Math.pow(0.8f, j + 1));
                }

            }
            plotArray[i].setY((futureSmooth+pastSmooth)/2);

        }

    }