int calcY(double value, double min, double max, double avg, double sd, double scale, int height)
	{
		double scaledValue;

		if (config.getSparklineGraphMode() == SparklineGraphMode.AVG_SD)
			scaledValue = (value - (avg - sd)) * scale;
		else
			scaledValue = (value - min) * scale;
		scaledValue = Math.max(scaledValue, 0.0);
		scaledValue = Math.min(scaledValue, height - 1.0);

		return (height - 1) - (int)scaledValue;
	}