@Override
    public void paint(Graphics g) {
        double xscl = (double) getWidth() / array.length;
        double yscl = (double) getHeight() / MAXVAR;
        g.setColor(Color.BLACK);
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(Color.WHITE);
        g.drawString(title, 0, 10);
        
        for (int i = 0; i < array.length; i++) {
            
            if (PARTIAL_BARS) {
                g.setColor(BAR_COLOR);
                g.fillRect((int)(i * xscl), (int)(getHeight() - array[i] * yscl), Math.max((int)xscl, 2) - 1, ((int) Math.max(1, array[i] * yscl)));

                if (colarray[i] != null)
                    g.setColor(colarray[i]);
                else
                    g.setColor(ELEMENT_COLOR);

                g.fillRect((int)(i * xscl), (int)(getHeight() - array[i] * yscl), Math.max((int)xscl, 2) - 1, (int) yscl);
            } else {
                if (colarray[i] != null)
                    g.setColor(colarray[i]);
                else
                    g.setColor(ELEMENT_COLOR);

                g.fillRect((int)(i * xscl), (int)(getHeight() - array[i] * yscl), Math.max((int)xscl, 2) - 1, BARS ? ((int) Math.max(1, array[i] * yscl)) : (int) yscl);
            }
        }
    }