title: Drawing a graphical histogram
body: <p>I am working on a project and I would like to display a single line histogram that looks like a bar graph except each line in the bar graph represents a pixel and its greyscale value.</p>
  
  <p>I have a array full of greyscale values, I just need to put them into this histogram and have it display the lines which will represent the values.. sort of like this</p>
  
  <pre><code>IMAGE             [minimize][maximize][close]
  
  
  
      picture                histogram
  
                            I
     (Loaded Picture)       I       I
                            I  I    I
                            I  I  I I  
  
  [open][save]
  </code></pre>
  
  <p>And below is the code loading the array... I just need to get some code that will use those greyscale values and represent them as bars like above.</p>
  
  <pre><code> public void showImage(File fileName) {
          Scanner scan;
          try {
              scan = new Scanner(fileName);
              typefile = scan.next();
              iname = scan.next();       
              width = scan.nextInt();
              height = scan.nextInt();
              maxshade = scan.nextInt();
              array = new int[width][height];
  
  
              for(int r = 0; r &lt; array.length; r++){
                  for(int c = 0; c &lt; array[r].length; c++){
                      array[r][c] = scan.nextInt();                       
  
  
  
  
              imageArray = array;         
              repaint();                  
  
  
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  
   }
  </code></pre>
  
  <p>I know I have to do something like...</p>
  
  <pre><code>     int hist[] = new int[256];
       for (int r = 0; r &lt; array.length; r++)
              for (int c = 0; c &lt; array[r].length; c++)
                  hist[array[r][c]]++;
  </code></pre>
  
  <p>But I don't know where to go from there or how to draw my graph.</p>