double domainMinScreenX = (domainMin/domainGlobalMax)*width; double domainMaxScreenX = (domainMax/domainGlobalMax)*width;
double domainMinScreenX = ((domainMin-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; double domainMaxScreenX = ((domainMax-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width;
	public void paintComponent(Graphics og)    {		super.paintComponent(og);		Graphics2D g = (Graphics2D) og;		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,				RenderingHints.VALUE_ANTIALIAS_ON);        double width = getWidth();        double height = getHeight();        g.setColor(FILLCOLOUR);        g.fillRect(1, 1, (int) width-1, (int) height-1);        g.setColor(BORDERCOLOUR);        g.setStroke(STROKE2);        g.drawRect(0, 0, (int) width-1, (int) height-1);        		g.drawImage(histogramImage.getImage(), 0, 0, (int) width-1,                     (int) height-1, null);				double codomainMin = model.getCodomainStart();		double codomainMax = model.getCodomainEnd();		double domainGlobalMax = model.getGlobalMax();		double domainMin = model.getWindowStart();		double domainMax = model.getWindowEnd();		double domainMinScreenX = (domainMin/domainGlobalMax)*width;		double domainMaxScreenX = (domainMax/domainGlobalMax)*width;		double codomainMinScreenY = ((255-codomainMin)/255.0f)*height;		double codomainMaxScreenY = ((255-codomainMax)/255.0f)*height;		double domainRangeScreen = domainMaxScreenX-domainMinScreenX;		double codomainRangeScreen = codomainMinScreenY-codomainMaxScreenY;		g.setColor(GREYCOLOUR);				g.fillRect(0, 0, (int) domainMinScreenX+1, (int) height);		g.fillRect((int) domainMaxScreenX-1, 0, (int) width, (int) height);		g.fillRect(0, 0, (int) domainMinScreenX, (int) height);		g.fillRect((int) domainMaxScreenX, 0, (int) width, (int) height);		g.fillRect(0, 0, (int) width, (int) codomainMaxScreenY);		g.fillRect(0, (int) codomainMinScreenY, (int) width, (int) height);				String family = model.getFamily();		double coeff = model.getCurveCoefficient();			double a = 0;		if (family.equals(RendererModel.LINEAR)) 			a = codomainRangeScreen/domainRangeScreen;		else if (family.equals(RendererModel.POLYNOMIAL)) 			a = codomainRangeScreen/Math.pow(domainRangeScreen,	coeff);		else if (family.equals(RendererModel.EXPONENTIAL)) 			a = codomainRangeScreen/Math.exp(Math.pow(domainRangeScreen,					coeff));		else if (family.equals(RendererModel.LOGARITHMIC)) {            if (domainRangeScreen <= 1) domainRangeScreen = 1;            a = codomainRangeScreen/Math.log(domainRangeScreen);        }				double b = codomainMinScreenY;		double currentX = domainMinScreenX-1;		double currentY = b;		double oldX, oldY;				g.setColor(model.getChannelColor(model.getSelectedChannel()));		g.setStroke(STROKE1_5);				for (double x = 1; x < domainRangeScreen; x += 1) {				oldX = currentX;				oldY = currentY;				currentX = x+domainMinScreenX-1;         		if (family.equals(RendererModel.LINEAR)) 					currentY = b-a*x;				else if (family.equals(RendererModel.EXPONENTIAL)) 					currentY = b-a*Math.exp(Math.pow(x,	coeff));				else if (family.equals(RendererModel.POLYNOMIAL)) 					currentY = b-a*Math.pow(x, coeff);				else if (family.equals(RendererModel.LOGARITHMIC)) 					currentY = b-a*Math.log(x);				g.drawLine((int) oldX, (int) oldY, (int) currentX,						(int) currentY);		}			}