public class Gradient extends ChartObject{ //public variables //private variables private float yVal; private color m_color; //distributional information private TDistribution tdist; private float popSize; private double Sn; /****************************************** Getters ******************************************/ public color getColor(){ return m_color; }//end getColor public float getAlpha(float y){ double yA = (Math.abs(y-yVal))/(Sn*(1.0)/sqrt(popSize)); double p = 2*(1-tdist.cumulativeProbability(yA)); return min(255, map((float)p, 0.0, 0.05, 0.0, 255.0)); }//end getAlpha public float getMean(){ return yVal; } public String getLabel(){ if(m_label!=null){ return m_label; } else{ return ""; } } public float getStdDev(){ return (float)Sn; } /****************************************** Private Methods ******************************************/ private void calcMargin(float margin,int n){ tdist = new TDistribution((float)n-1); double A = tdist.inverseCumulativeProbability(0.975); Sn = margin*Math.sqrt(n)/A; }//end calcMargin /****************************************** Constructors ******************************************/ public Gradient(float value,color barColor,float margin,int n){ yVal = value; m_color = barColor; popSize = n; calcMargin(margin,n); }//end Bar public Gradient(float value,color barColor,float margin,int n,String label){ yVal = value; m_color = barColor; popSize = n; calcMargin(margin,n); m_label = label; x_tick = true; tickSize = DEFAULT_TICK_SIZE; }//end Bar /****************************************** Draw Method ******************************************/ public void draw(int curX,int barWidth,float startY,float endY,float dataMin,float dataMax){ float dataY; float h = startY-endY; noStroke(); for(int y=0;y