public void paintComponent(Graphics g) {	
		super.paintComponent (g);

		if (acList == null) {
			return;
		}
    	left = 0;
    	right = this.getWidth();
    	delta = (right - left - inset*2) / numIntervals;   	

        // Background.
	    Dimension D = this.getSize ();
	    g.setColor (Color.white);
	    g.fillRect (0,0, D.width, D.height);
	    g.setColor (Color.black);

	    //description
	    g.setColor(Color.RED);
	    g.fillRect (inset, 10, 5, 5);
        g.drawString("expected number", inset + 10, 15);
        g.setColor(Color.BLUE);
	    g.fillRect (inset, 20, 5, 5);
        g.drawString("expected number", inset + 10, 25);
	    
        // Axes, bounding box.
	    //line bottom
        g.drawLine (inset-5,D.height-inset, D.width-inset, D.height-inset);
        g.drawString("days", D.width-inset, D.height-inset);
        //line left
        g.drawLine (inset-5,inset, inset-5,D.height-inset);
        g.drawString("students number", inset-5,inset-10);
        //line right
        //g.drawLine (D.width-inset,inset, D.width-inset,D.height-inset);
        //line top
        //g.drawLine (inset-5,inset, D.width-inset, inset);


        // X-ticks and labels.
        int i = 0;
        int maxY = 0;
        for (AttdCnt ac: acList) {
        	int xTick = i*delta;
        	int p1x = inset + xTick;
        	int p1y = D.height - inset - 5;
        	int p2x = p1x;
        	int p2y = p1y + 10;
            g.drawLine (p1x, p1y, p2x, p2y);  
            String dayStr = (new SimpleDateFormat("MM/dd/yy")).format(ac.getDate());
            g.drawString (dayStr, p2x, p2y+10);
            i++;
            //find max cnt
            if (ac.getExpectedNumbers() > maxY) {
            	maxY = ac.getExpectedNumbers();
            }
        }

        // Y-ticks
        // We'll make only 10 ticks.
        int numYTicks = 10;
        if (maxY < numYTicks) {
        	numYTicks = maxY;
        }
        else {
        	int times = maxY/numYTicks;
        	if ((maxY % numYTicks) > 0) {
        		maxY = numYTicks * (times + 1);
        	}
        }
        int yDelta = maxY / numYTicks;
        int yDeltaHeight = (D.height-2*inset) / numYTicks;
        for (i=0; i<=numYTicks; i++) {
        	int yTick = (i) * (int) (yDeltaHeight);
        	int p1x = inset - 5;
        	int p1y = D.height - yTick - inset;
        	int p2x = p1x + 10;
        	int p2y = p1y;
            g.drawLine (p1x, p1y, p2x, p2y);
            g.drawString (Integer.toString(i * yDelta), p1x - 15, p1y);
        }

        // Finally, draw the histogram.
        i = 0;
        for (AttdCnt ac: acList) {
        	int num = ac.getAttdNumbers();
        	int numExpect = ac.getExpectedNumbers();
        	double heightTimes = (double)ac.getAttdNumbers()/(double)yDelta;
        	int barHeight = (int) (yDeltaHeight * heightTimes);
        	int x = delta * i + inset;
        	int y = D.height - inset - barHeight;
        	int yExpect = D.height - inset - numExpect/yDelta*yDeltaHeight;
        	int barWidth = 10;
        	i++;
        	g.setColor(Color.RED);
        	g.fillRect (x, yExpect, barWidth, numExpect/yDelta*yDeltaHeight);
            g.setColor (Color.blue);
            g.fillRect (x+barWidth, y, barWidth, barHeight);
            g.drawString(Integer.toString(num), x+barWidth*2, y);
        }        
	}