/*
* @(#)BarChart.java 0.0.3 99/08/06
*
* Copyright (c) 1999 by Willie Wheeler. All rights reserved.
*/
package stats;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
/**
* @version 0.0.3 08/06/99
* @author Willie Wheeler
*/
public class BarChart extends Chart {
public static final String AUTO_SCALE_PROPERTY = "autoScale";
public static final String NUM_RANGE_GROUPS_PROPERTY = "numRangeGroups";
protected boolean autoScale;
protected int numRangeGroups;
public BarChart(ContingencyTableModel model) {
super(model);
this.autoScale = false;
this.numRangeGroups = 4;
updateUI();
}
public BarChart(ContingencyTableModel model, int[] independentIndices) {
super(model, independentIndices);
this.autoScale = false;
this.numRangeGroups = 4;
updateUI();
}
public BarChart(ContingencyTableModel model,
int[] independentIndices,
int valueColumnIndex) {
super(model, independentIndices, valueColumnIndex);
this.autoScale = false;
this.numRangeGroups = 4;
updateUI();
}
public BarChart(ContingencyTableModel model,
int[] independentIndices,
int valueColumnIndex,
int[] condition) {
super(model, independentIndices, valueColumnIndex, condition);
this.autoScale = false;
this.numRangeGroups = 4;
updateUI();
}
public void updateUI() { setUI(UIManager.getUI(this)); }
public String getUIClassID() { return "stats.plaf.BarChartUI"; }
public void setAutoScale(boolean autoScale) {
boolean oldAutoScale = this.autoScale;
this.autoScale = autoScale;
repaint();
firePropertyChange(AUTO_SCALE_PROPERTY, oldAutoScale, this.autoScale);
}
public boolean getAutoScale() { return autoScale; }
/**
* Sets the number of range groups to display. For instance, passing
* 4 causes quartiles to be displayed, and passing 10
* causes deciles to be displayed. Passing 0 disables the
* display of range groups.
*
* @param numRangeGroups number of range groups
*/
public void setNumRangeGroups(int numRangeGroups) {
int oldNumRangeGroups = this.numRangeGroups;
this.numRangeGroups = numRangeGroups;
repaint();
firePropertyChange(NUM_RANGE_GROUPS_PROPERTY,
oldNumRangeGroups, this.numRangeGroups);
}
public int getNumRangeGroups() { return numRangeGroups; }
}