use of eu.fthevenet.binjr.data.workspace.UnitPrefixes in project selenium_java by sergueik.
the class JrdsSeriesBindingFactory method of.
/**
* Creates a new instance of the {@link TimeSeriesBinding} class with the following parameters
*
* @param parentName the name of the parent tree node.
* @param legend the legend for the timeseries
* @param graphdesc the graph description from JRDS
* @param path the id of the JRDS graph
* @param adapter the {@link JrdsDataAdapter} for the binding.
* @return a JRDS series binding
*/
public TimeSeriesBinding<Double> of(String parentName, String legend, Graphdesc graphdesc, String path, DataAdapter<Double, CsvDecoder<Double>> adapter) {
final String label;
final UnitPrefixes prefix;
final ChartType graphType;
final String unitName;
label = isNullOrEmpty(graphdesc.name) ? (isNullOrEmpty(graphdesc.graphName) ? "???" : graphdesc.graphName) : graphdesc.name;
graphType = ChartType.STACKED;
prefix = findPrefix(graphdesc);
unitName = graphdesc.verticalLabel;
return new TimeSeriesBinding<>(label, path, null, legend, prefix, graphType, unitName, parentName + "/" + legend, adapter);
}
use of eu.fthevenet.binjr.data.workspace.UnitPrefixes in project selenium_java by sergueik.
the class JrdsSeriesBindingFactory method of.
/**
* Creates a new instance of the {@link TimeSeriesBinding} class with the following parameters
*
* @param parentName the name of the parent tree node.
* @param graphdesc the graph description from JRDS
* @param idx the index of the series in the graphdesc
* @param path the id of the JRDS graph
* @param adapter the {@link JrdsDataAdapter} for the binding.
* @return a JRDS series binding
*/
public TimeSeriesBinding<Double> of(String parentName, Graphdesc graphdesc, int idx, String path, DataAdapter<Double, CsvDecoder<Double>> adapter) {
final String label;
final Color color;
final String legend;
final UnitPrefixes prefix;
final ChartType graphType;
final String unitName;
Graphdesc.SeriesDesc desc = graphdesc.seriesDescList.get(idx);
label = isNullOrEmpty(desc.name) ? (isNullOrEmpty(desc.dsName) ? (isNullOrEmpty(desc.legend) ? "???" : desc.legend) : desc.dsName) : desc.name;
Color c = null;
try {
if (!isNullOrEmpty(desc.color)) {
c = Color.web(desc.color);
}
} catch (IllegalArgumentException e) {
logger.warn("Invalid color string for binding " + label);
}
color = c;
legend = isNullOrEmpty(desc.legend) ? (isNullOrEmpty(desc.name) ? (isNullOrEmpty(desc.dsName) ? "???" : desc.dsName) : desc.name) : desc.legend;
switch(desc.graphType.toLowerCase()) {
case "area":
graphType = ChartType.AREA;
break;
case "stacked":
graphType = ChartType.STACKED;
break;
case "line":
graphType = ChartType.LINE;
break;
case "none":
default:
graphType = ChartType.STACKED;
break;
}
prefix = findPrefix(graphdesc);
unitName = graphdesc.verticalLabel;
return new TimeSeriesBinding<>(label, path, color, legend, prefix, graphType, unitName, parentName + "/" + legend, adapter);
}
Aggregations