 			{
 				//trace( "calculateRegression() " + xColumn.toString() );
 				Rstring = "fit <- lm(y~x)\n"
-					+"intercept <- coefficients(fit)[1]\n"
-					+"slope <- coefficients(fit)[2]\n"
-					+"rSquared <- summary(fit)$r.squared\n";			
-				dataXY = ColumnUtils.joinColumns([xColumn, yColumn], Number, false, filteredKeySet.keys);
-				
-			
-				// sends a request to Rserve to calculate the slope and intercept of a regression line fitted to xColumn and yColumn 
-				token = rService.runScript(null,["x","y"],[dataXY[1],dataXY[2]],["intercept","slope","rSquared"],Rstring,"",false,false,false);
-				addAsyncResponder(token, handleLinearRegressionResult, handleLinearRegressionFault, ++requestID);
-			}
-			
+					+"coef <- coefficients(fit)\n" +
+						"+ ";
+			}
+				
 			if (currentTrendline.value == POLYNOMIAL)
 			{
-				// ToDo Add rSquared
 				Rstring = "fit <- lm(y ~ poly(x, " + polynomialDegree.value.toString() + ", raw = TRUE))\n"
-					+"coef <- coefficients(fit)\n"			
-				dataXY = ColumnUtils.joinColumns([xColumn, yColumn], Number, false, filteredKeySet.keys);
-				
-				// sends a request to Rserve to calculate the coefficients of the regression polynomial fitted to xColumn and yColumn 
-				token = rService.runScript(null, ["x","y"], [dataXY[1], dataXY[2]], ["coef"], Rstring, "", false, false, false);
-				addAsyncResponder(token, handleLinearRegressionResult, handleLinearRegressionFault, ++requestID);
+					+"coef <- coefficients(fit)\n";			
 			}
 			
 			if (currentTrendline.value == LOGARITHMIC)
 			{
-				
-			}
+				Rstring = "fit <- lm( y ~ log(x) )\n" 
+					+"coef <- coefficients(fit)\n";
+			}
+			
 			
 			if (currentTrendline.value == EXPONENTIAL)
 			{
-				
+				Rstring = "fit <- lm( log(y) ~ x )\n" 
+					+"coef <- coefficients(fit)\n";
+						
 			}
 			
 			if (currentTrendline.value == POWER)
 			{
-				
-			}
+				Rstring = "fit <- lm( log(y) ~ x )\n" 
+					+"coef <- coefficients(fit)\n";
+			}
+			
+			dataXY = ColumnUtils.joinColumns([xColumn, yColumn], Number, false, filteredKeySet.keys);
+			
+			// sends a request to Rserve to calculate the coefficients of the regression lograrithmic function to xColumn and yColumn
+			token = rService.runScript(null, ["x","y"], [dataXY[1], dataXY[2]], ["coef"], Rstring, "", false, false, false);
+			addAsyncResponder(token, handleLinearRegressionResult, handleLinearRegressionFault, ++requestID);
 
 		}
 		

				if (currentTrendline.value == POLYNOMIAL)
				{
					coefficients = ((RresultArray[0] as RResult).value as Array != coefficients) ? (RresultArray[0] as RResult).value as Array : null;
					
					// Preprocess coefficients ==> It might return NaN in higher degree
					for (var i:int = 0; i < coefficients.length; i++)
					{

							drawCommand.push(1);
							flag = false;
						}
//						else if (tempPoint.y > screenBounds.getYMax() || tempPoint.y < screenBounds.getYMin())
//							drawCommand.push(1);
						else drawCommand.push(2);
					}

					g.lineStyle(1);
					g.drawPath(drawCommand, points);					
					
