/** * Constructs a view of bars for a sampled function x2(x1). * @param s1 the sampling of x1 coordinates. * @param x2 array of x2 values. */ public BarsView(Sampling s1, float[] x2) { set(s1,x2); }
/** * Constructs a view of bars for x2.length data sets. * @param x2 array of values containing x2.length separate sets. */ public BarsView(float[][] x2) { set(null,x2); }
/** * Constructs a view of bars with multiple plot segments. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. */ public BarsView(float[][] x1, float[][] x2) { set(x1,x2); }
/** * Constructs a view of bars with a single plot segment. * The lengths of the specified arrays x1 and x2 must be equal. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. */ public BarsView(float[] x1, float[] x2) { set(x1,x2); }
/** * Constructs a view of bars with specified x2 quantities. * The corresponding coordinates x1 are assumed to be 0, 1, 2, .... * @param x2 array of x2 coordinates. */ public BarsView(float[] x2) { float[] x1 = rampfloat(0.0f,1.0f,x2.length); set(x1,x2); }
/** * Sets (x1,x2) coordinates for a sampled function x2(x1). * @param s1 the sampling of x1 coordinates. * @param x2 array of x2 coordinates. */ public void set(Sampling s1, float[] x2) { Check.argument(s1.getCount()==x2.length,"s1 count equals x2 length"); int n1 = x2.length; float[] x1 = new float[n1]; for (int i1=0; i1<n1; ++i1) x1[i1] = (float)s1.getValue(i1); set(x1,x2); }
/** * Constructs a view of bars with multiple plot segments. * @param s1 the sampling of x1 coordinates. * @param x2 array of x2 values, containing x2.length plot segments. */ public BarsView(Sampling s1, float[][] x2) { Check.argument(s1.getCount()==x2[0].length,"s1 count equals x2 length"); int n1 = x2[0].length; int n2 = x2.length; float[][] x1 = new float[n2][n1]; for (int i2=0; i2<n2; ++i2) for (int i1=0; i1<n1; ++i1) x1[i2][i1] = (float)s1.getValue(i1); set(x1,x2); }