protected int mixColors(int col0, int col1, float f) { int a = (int)PApplet.map(f, 0, 1, col0 >> 24 & 0xFF, col1 >> 24 & 0xFF); int r = (int)PApplet.map(f, 0, 1, col0 >> 16 & 0xFF, col1 >> 16 & 0xFF); int g = (int)PApplet.map(f, 0, 1, col0 >> 8 & 0xFF, col1 >> 8 & 0xFF); int b = (int)PApplet.map(f, 0, 1, col0 & 0xFF, col1 & 0xFF); return (a << 24) | (r << 16) | (g << 8) | b; }
public void scale(float x0, float y0, float w0, float h0) { x = PApplet.map(x, 0, 1, x0, x0 + w0); y = PApplet.map(y, 0, 1, y0, y0 + h0); w = PApplet.map(w, 0, 1, 0, w0); h = PApplet.map(h, 0, 1, 0, h0); if (x < x0) { h -= x0 - x; x = x0; } if (x0 + w0 < x + w) w = x0 + w0 - x; if (y < y0) { h -= y0 - y; y = y0; } if (y0 + h0 < y + h) h = y0 + h0 - y; }
protected void initSelHandles() { float x0 = rightm; float x1 = x0 + width - leftm - rightm; float y0 = topm - 10; float y1 = y0 + height - bottomm - topm; float selx1 = PApplet.map(selRangeRight, 0, 1, x0, x1); selRightHandle = new SelectionHandle(selx1, y1 + handleY, handlew, handleh, SelectionHandle.RIGHT); }
public float itemPosition(int idx, float maxd) { int tot = colLabels.getTotItemsCount() - 1; float x1 = PApplet.map(idx, 0, tot, 0, maxd); return x1; } public float resize(float news) {
public float itemPosition(int idx, float maxd) { int tot = rowBrowser.getChildrenCount() - 1; float x1 = PApplet.map(idx, 0, tot, 0, maxd); return x1; } public float resize(float news) {
public float itemPosition(int idx, float maxd) { int tot = rowBrowser.getTotItemsCount() - 1; float y1 = PApplet.map(idx, 0, tot, 0, maxd); return y1; } public float resize(float news) {
public float initPosition(float maxd) { int tot = rowBrowser.getChildrenCount() - 1; int idx = rowBrowser.current; float x0 = PApplet.map(idx, 0, tot, 0, maxd); return x0; } private void goTo(int idx) {
float y() { return PApplet.map(y.get(), 1, 0, topm + softPointY, height - bottomm - softPointY * 2); } }
float x() { return PApplet.map(x.get(), 0, 1, rightm + softPointX, width - leftm - softPointX); }
public String getLabelX(double valx, double valy) { // We need to find which bin the value valx falls into, with the bin width // representing the probability of the bin float x0 = 0; for (int bx = 0; bx < binCountX; bx++) { float dx = marginalDensity[bx]; if (x0 <= valx && valx <= x0 + dx) { float val0 = binSizeX * bx; float val1 = binSizeX * (bx + 1); float val = PApplet.map((float)(valx - x0) / dx, 0, 1, val0, val1); return varx.formatValue(val, ranges); } x0 += dx; } return ""; }
public float initPosition(float maxd) { int tot = colLabels.getTotItemsCount() - 1; int idx = colLabels.getFirstItemIndex(); float x0 = PApplet.map(idx, 0, tot, 0, maxd); return x0; } };
public float initPosition(float maxd) { int tot = rowBrowser.getTotItemsCount() - 1; int idx = rowBrowser.getFirstItemIndex(); float y0 = PApplet.map(idx, 0, tot, 0, maxd); return y0; } };
public float press(float pos, float maxd) { float x1 = PApplet.constrain(pos, 0, maxd); int tot = rowBrowser.getChildrenCount() - 1; int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot)); goTo(idx); return x1; } public int pressSlider(float pos, float size) {
public float press(float pos, float maxd) { float x1 = PApplet.constrain(pos, 0, maxd); int tot = colLabels.getTotItemsCount() - 1; int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot)); mira.browser.openColumn(idx); return x1; } public int pressSlider(float pos, float size) {
public float drag(float newp, float maxd) { float x1 = PApplet.constrain(newp, 0, maxd); int tot = rowBrowser.getChildrenCount() - 1; int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot)); goTo(idx); return x1; } public void stopDrag() {
public float drag(float newp, float maxd) { float x1 = PApplet.constrain(newp, 0, maxd); int tot = colLabels.getTotItemsCount() - 1; int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot)); mira.browser.openColumn(idx); return x1; } public void stopDrag() {
public float press(float pos, float maxd) { float y1 = PApplet.constrain(pos, 0, maxd); int tot = rowBrowser.getTotItemsCount() - 1; int n = PApplet.round(PApplet.map(y1, 0, maxd, 0, tot - 1)); RowScroller scroller = rowBrowser.getScroller(); scroller.jumpTo(n); return y1; } public int pressSlider(float pos, float size) {
protected void drawEikosogram(PGraphics pg) { pg.noStroke(); float x0 = 0; for (int bx = 0; bx < binCountX; bx++) { float dx = pg.width * marginalDensity[bx]; float y0 = pg.height; for (int by = 0; by < binCountY; by++) { float pxy = logY ? logDensity[bx][by] : density[bx][by]; float dy = pg.width * pg.height * pxy / dx; float f = PApplet.map(by, 0, binCountY - 1, 1, 0); pg.fill(mixColors(WHITE, COLOR, f)); pg.rect(x0, y0, dx, -dy); y0 -= dy; } x0 += dx; } }
public float drag(float newp, float maxd) { float y1 = PApplet.constrain(newp, 0, maxd); int tot = rowBrowser.getTotItemsCount() - 1; int n = PApplet.round(PApplet.map(y1, 0, maxd, 0, tot)); RowScroller scroller = rowBrowser.getScroller(); scroller.jumpTo(n); return y1; } public void stopDrag() {
public void draw() { noStroke(); fill(color(172, 210, 237), 240); rect(0, padding, width - padding, height - 2 * padding); float w = PApplet.map(data.sortProgress(), 0, 1, 0, width - padding); noStroke(); fill(color(39, 141, 210)); rect(0, padding, w, sortOptH); }