import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.*; public class histogramPoints extends allDataPoints { private aCanvas canvas; private ArrayList rects; /*When created it takes the canvas so it can call methods if needed, the data *and a string, the default category. It then runs setDataPoints so that the *graph will show the default cateogry. It sends it the ratingsInCat function *because this will return the number of resaurants in each category in an array *of ints*/ public histogramPoints(aCanvas c,allData d,int s,allAxis axis,infoArea i) { super(d,s,axis,i); canvas=c; setDataPoints(category); rects=new ArrayList();//Used later for click detection } /*Draws the data, spacing is the horizonal spacing, unit height is each interval *in pixels, then it randomly assigns colors to each bar and creates a filled *rectangle to be the bars for each part of the graph*/ void drawData(Graphics g) { int spacing=axis.getHSpacing(); int unitHeight=axis.getVSpacing(); Graphics2D g2d = (Graphics2D)g; g.setColor(color); //get the labels so we can have them pop up in a message dialog if the user clicks String[]labels=data.getCatLabels(category); System.out.println("Yar"+data.getCatLabels(category).length); Rectangle rects[]=new Rectangle[data.getCatLabels(category).length]; System.out.println(rects.length); for (int x=1;x