public void paintComponent(Graphics gfx) {
        super.paintComponent(gfx);
        Graphics2D g = (Graphics2D) gfx;
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
        g.setFont(font);
        
        //g.setColor(Color.gray);
        //g.drawRect (0,0,getWidth(), getHeight());
        
        //Joining all the points into lines
        for(int i = 0; i < (items.length - 1); i++){
            lines[i] = new Line2D.Float(p[i], p[i+1]);
        }
        
        //g.setPaint(Color.blue);     
        //Draw all the lines
        for(int i = 0; i < (items.length - 1); i++){
            g.draw(lines[i]);
        }

        Shape[] s;
        s = new Shape[items.length];
        String temp;
        g.setColor(Color.DARK_GRAY);
        for(int i = 0; i < items.length; i++){
            temp = String.valueOf(weights[i]);
            g.setFont(new Font ("Arial", Font.BOLD, 6));
            if (getHeight() > 20){
            	g.drawString(temp.substring(0,3), (p[i].x + 5), p[i].y < getHeight() - BOTTOM - 3 ? p[i].y + 5 : p[i].y);
            }
            s[i] = p[i].getShape();
        }
        
        g.setColor(color);      
        //g.fill(s0);  g.fill(s1);
        for(int i = 0; i < items.length; i++){
            g.fill(s[i]);
        }
        g.setColor(Color.black);    
        // g.draw(s0);  g.draw(s1);
        //for(int i = 0; i < items.length; i++){
        //    g.draw(s[i]);
        //}
        //Draw the Line axis
        g.drawLine(5, 0, 5, getHeight()-getBottom()); //y-axis
        g.drawLine(5, getHeight()-getBottom(), getWidth() - 5, getHeight()-getBottom()); //x-axis
        
        g.setFont(font);
        //Draw the static labels    
        if (getHeight() > MIN_HEIGHT - 5){
        	String utility_upper_bound = new String("1");
        	g.drawString(utility_upper_bound, 1, 5);
        	String utility_lower_bound = new String("0");
        	g.drawString(utility_lower_bound, 1, getHeight()-getBottom());
        }
        
        ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 
				  RenderingHints.VALUE_TEXT_ANTIALIAS_ON);  
    	
        if (getHeight() > MIN_HEIGHT - 8){
	        for(int i = 0; i < items.length; i++){
	        	DecimalFormat df = acell.obj.decimalFormat;    
	        	String num = df.format(items[i]);
	        	g.drawString(num, ((int)(((items[i]-items[0])/((items[(items.length)-1])-items[0]))*(getWidth()-15)))+5 - (num.length()*2), getHeight()-1);
	        }
        }
    }