@Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if(histograma == null) {
            return;
        }
        // Valor maximo do histograma
        int max = histograma.getMaxValue();
        Graphics2D g2d = (Graphics2D) g.create();
        // Tamanho do histograma sem as borads
        Dimension histoSize = getSize();
        histoSize.width -= INSETS.left + INSETS.right;
        histoSize.height -= INSETS.top + INSETS.bottom;
        // Tamanho do gr[afico sem as borads
        Dimension chartSize = histoSize.getSize();
        chartSize.width -= CHART_INSETS.right;
        chartSize.height -= CHART_INSETS.top + CHART_INSETS.bottom;
        // Escala
        float scaleY = (float)chartSize.height / (float)max;
        float scaleX = (float)chartSize.width / (float)256;
        // Posicao do grafico
        g.setFont(FONT);
        // Desenha a grade
        for(int i = 0; i < 6; i++) {
            int x1 = CHART_INSETS.left;
            int x2 = CHART_INSETS.left + chartSize.width;
            int y = chartSize.height - (int) ((float)chartSize.height / 6f * (float)i) + CHART_INSETS.top;
            g2d.setColor(COLOR_RULER);
            g2d.drawLine(x1, y, x2, y);
        }
    
        int gap = 2;
        
        g2d.setColor(COLOR_BARS);
        int[] data = histograma.getData();
        for (int i = 0; i < data.length; i++) {
            int width = (int)scaleX - gap;
            int height = (int) (data[i] * scaleY);
            int x = i * (width + gap) + CHART_INSETS.left;
            int y = chartSize.height - height - 15;
            g2d.fillRect(x, y, width, height);
            
            if( i % 15 == 0) {
                g2d.setColor(COLOR_RULER);
                g2d.drawLine(x, CHART_INSETS.top + chartSize.height - 10, x, CHART_INSETS.top + chartSize.height - 5);
                g2d.setColor(COLOR_AXIS);
                g2d.drawString(String.valueOf(i), x, CHART_INSETS.top + chartSize.height);
                g2d.setColor(COLOR_BARS);
            }
            
        }

        g2d.dispose();
    }