org.diirt.datasource.extra.WaterfallPlot Maven / Gradle / Ivy
/**
* Copyright (C) 2010-14 diirt developers. See COPYRIGHT.TXT
* All rights reserved. Use is subject to license terms. See LICENSE.TXT
*/
package org.diirt.datasource.extra;
import java.util.ArrayList;
import java.util.List;
import org.diirt.datasource.ReadFunction;
import org.diirt.vtype.VDouble;
import org.diirt.datasource.expression.DesiredRateExpression;
import org.diirt.datasource.expression.DesiredRateExpressionImpl;
import org.diirt.vtype.VDoubleArray;
import org.diirt.vtype.VImage;
import org.diirt.vtype.VNumber;
import org.diirt.vtype.VNumberArray;
import org.diirt.datasource.expression.DesiredRateExpressionList;
/**
* A waterfall plot.
*
* @author carcassi
*/
public class WaterfallPlot extends DesiredRateExpressionImpl {
WaterfallPlot(DesiredRateExpression extends List extends VNumberArray>> expression, String name) {
super(expression, new WaterfallPlotFunction(new DoubleArrayTimeCacheFromVDoubleArray(expression.getFunction()), WaterfallPlotParameters.defaults().internalCopy()), name);
}
WaterfallPlot(DesiredRateExpressionList> expressions, String name) {
super(expressions, new WaterfallPlotFunction(new DoubleArrayTimeCacheFromVDoubles(getFunctions(expressions)), WaterfallPlotParameters.defaults().internalCopy()), name);
}
private static List>> getFunctions(DesiredRateExpressionList> exp) {
List>> functions = new ArrayList>>();
for (DesiredRateExpression> desiredRateExpression : exp.getDesiredRateExpressions()) {
functions.add(desiredRateExpression.getFunction());
}
return functions;
}
private volatile WaterfallPlotParameters parameters = WaterfallPlotParameters.defaults();
WaterfallPlotFunction getPlotter() {
return (WaterfallPlotFunction) getFunction();
}
/**
* Changes parameters of the waterfall plot.
*
* @param newParameters parameters to change
* @return this
*/
public WaterfallPlot with(WaterfallPlotParameters... newParameters) {
parameters = new WaterfallPlotParameters(parameters, newParameters);
WaterfallPlotParameters.InternalCopy copy = parameters.internalCopy();
getPlotter().setParameters(copy);
return this;
}
/**
* Returns the full set of parameters currently being used.
*
* @return the current parameters
*/
public WaterfallPlotParameters getParameters() {
return parameters;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy