mirror of https://github.com/rusefi/RomRaider.git
Added scale limits to colorize with warnings for values that exceed limits
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@166 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
4718e8169b
commit
f566192a7a
|
@ -467,21 +467,42 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
public void colorize() {
|
||||
if (compareType == COMPARE_OFF) {
|
||||
if (!isStatic && !isAxis) {
|
||||
double high = -999999999;
|
||||
double low = 999999999;
|
||||
|
||||
double high = Double.MIN_VALUE;
|
||||
double low = Double.MAX_VALUE;
|
||||
|
||||
if (getScale().getMax() != 0 || getScale().getMin() != 0) {
|
||||
|
||||
// set min and max values if they are set in scale
|
||||
high = getScale().getMax();
|
||||
low = getScale().getMin();
|
||||
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
if (data[i].getBinValue() > high) {
|
||||
high = data[i].getBinValue();
|
||||
}
|
||||
if (data[i].getBinValue() < low) {
|
||||
low = data[i].getBinValue();
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
|
||||
if (Double.parseDouble(data[i].getText()) > high) {
|
||||
high = Double.parseDouble(data[i].getText());
|
||||
}
|
||||
if (Double.parseDouble(data[i].getText()) < low) {
|
||||
low = Double.parseDouble(data[i].getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
double scale = (data[i].getBinValue() - low) / (high - low);
|
||||
data[i].setColor(getScaledColor(scale));
|
||||
|
||||
if (Double.parseDouble(data[i].getText()) > high ||
|
||||
Double.parseDouble(data[i].getText()) < low) {
|
||||
|
||||
// value exceeds limit
|
||||
data[i].setColor(getRom().getContainer().getSettings().getWarningColor());
|
||||
|
||||
} else {
|
||||
// limits not set, scale based on table values
|
||||
double scale = (Double.parseDouble(data[i].getText()) - low) / (high - low);
|
||||
data[i].setColor(getScaledColor(scale));
|
||||
}
|
||||
}
|
||||
} else { // is static/axis
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
|
@ -494,7 +515,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
|
||||
} else { // comparing is on
|
||||
if (!isStatic) {
|
||||
double high = -999999999;
|
||||
double high = Double.MIN_VALUE;
|
||||
|
||||
// determine ratios
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
|
|
|
@ -158,28 +158,51 @@ public class Table3D extends Table {
|
|||
public void colorize() {
|
||||
if (compareType == COMPARE_OFF) {
|
||||
if (!isStatic && !isAxis) {
|
||||
double high = -999999999;
|
||||
double low = 999999999;
|
||||
for (DataCell[] column : data) {
|
||||
for (DataCell cell : column) {
|
||||
if (cell.getBinValue() > high) {
|
||||
high = cell.getBinValue();
|
||||
}
|
||||
if (cell.getBinValue() < low) {
|
||||
low = cell.getBinValue();
|
||||
|
||||
double high = Double.MIN_VALUE;
|
||||
double low = Double.MAX_VALUE;
|
||||
|
||||
if (getScale().getMax() != 0 || getScale().getMin() != 0) {
|
||||
|
||||
// set min and max values if they are set in scale
|
||||
high = getScale().getMax();
|
||||
low = getScale().getMin();
|
||||
|
||||
} else {
|
||||
// min/max not set in scale
|
||||
for (DataCell[] column : data) {
|
||||
for (DataCell cell : column) {
|
||||
if (Double.parseDouble(cell.getText()) > high) {
|
||||
high = Double.parseDouble(cell.getText());
|
||||
}
|
||||
if (Double.parseDouble(cell.getText()) < low) {
|
||||
low = Double.parseDouble(cell.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (DataCell[] column : data) {
|
||||
for (DataCell cell : column) {
|
||||
double scale = Math.abs((cell.getBinValue() - low) / (high - low));
|
||||
cell.setColor(getScaledColor(scale));
|
||||
|
||||
if (Double.parseDouble(cell.getText()) > high ||
|
||||
Double.parseDouble(cell.getText()) < low) {
|
||||
|
||||
// value exceeds limit
|
||||
cell.setColor(getRom().getContainer().getSettings().getWarningColor());
|
||||
|
||||
} else {
|
||||
|
||||
double scale = Math.abs((Double.parseDouble(cell.getText()) - low) / (high - low));
|
||||
cell.setColor(getScaledColor(scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // comparing is on
|
||||
if (!isStatic) {
|
||||
double high = -999999999;
|
||||
double high = Double.MIN_VALUE;
|
||||
|
||||
// determine ratios
|
||||
for (DataCell[] column : data) {
|
||||
|
|
Loading…
Reference in New Issue