public void paintComponent(Graphics g){
        if(histData == null || histData.length == 0)
        {
            return;
        }
        Graphics2D g2 = (Graphics2D)g;
        RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2.setRenderingHints(rh);
        g2.setFont(textFont);
        int h = this.getHeight();
        int w = this.getWidth();
        g2.clearRect(0, 0, w, h);
        int b = 4;
        int yoff = 10;
        int bottomLine = h - b - g2.getFontMetrics().getHeight();
        int tackHeight = 5;
        int ib = 1;
        int binWidth = (w - (2*b) - ((histData.length-1)*ib)) / histData.length;
        int binHeight = bottomLine - yoff;
        double pixPerUnit = (double)(binHeight)/(double)maxScore;
        int x = b;
        g2.setColor(barColour);
        barBacks = new Rectangle2D[histData.length];
        x = b;
        for(int i=0;i<histData.length;i++)
        {
            barBacks[i] = new Rectangle2D.Double(x,yoff,binWidth,binHeight);
            x += binWidth + ib;
        }
        g2.setColor(barBackColour);
        for(Rectangle2D r : barBacks)
        {
            g2.fill(r);
        }
        x = b+ib;
        
        int bh =0;
        for(int[] i : histData)
        {
            bh = (int)(i[1] * pixPerUnit);
            g2.setColor(barColour);
            g2.fillRect(x, yoff + (binHeight - bh), binWidth, bh);
            g2.setColor(Color.black);
            g2.drawLine(x-ib, bottomLine-tackHeight, x-ib, bottomLine);
            x += binWidth + ib;
        }
        g2.drawLine(x-ib, bottomLine-tackHeight, x-ib, bottomLine);
        g2.setColor(Color.BLACK);
        {
            g2.drawLine(b, bottomLine, x-ib, bottomLine);
        }
        if(barInfo != -1 && barBacks != null && barInfo < barBacks.length)
        {
            Rectangle2D bar = barBacks[barInfo];
            int xt = (int)bar.getCenterX();
            int yt = (int)bar.getCenterY();
            String text = "bin: " + histData[barInfo][0] + "\ncount: " + histData[barInfo][1];
            CTB.draw(g2, xt, yt, this.getWidth(), this.getHeight(), text);
        }
    }