/**
* author Jia Xiaoping
* author Alex Rudniy
* Ovals vizualization
*/
import java.awt.*;

public class VOvalDisplay implements SortDisplay {
  public int getArraySize(Dimension d) {
    return d.width / 14; 
  }
  public void display(int a[], Graphics g, Dimension d) {
    g.setColor(Color.white);
    g.fillRect(0, 0, d.width, d.height);
    double f = d.height / (double) a.length;    
    double cf = 255.0 / (double) a.length;
    int x = d.width - 14;
  
   for (int i = a.length; --i >= 0; x -= 14) {
     g.setColor(new Color((int)(i % 255), (int)(i*10 % 255), (int)(i*100 % 255)));
     g.fillOval(x, d.height - (int)(a[i] * f), 14, (int)(a[i] * f));
   }
  }   
}