use of com.twosigma.beakerx.chart.xychart.plotitem.Line in project beakerx by twosigma.
the class SimpleTimePlot method reinitialize.
private void reinitialize() {
List<XYGraphics> graphics = getGraphics();
filter(graphics, new Predicate<XYGraphics>() {
public boolean test(XYGraphics graphic) {
return !(graphic instanceof Line || graphic instanceof Points);
}
});
List<Object> xs = new ArrayList<>();
List<List<Number>> yss = new ArrayList<>();
Set<String> dataColumnsNames = new HashSet<>();
if (data != null && columns != null) {
for (Map<String, Object> row : data) {
dataColumnsNames.addAll(row.keySet());
xs.add(getNumberForTimeColumn(row.get(timeColumn)));
for (int i = 0; i < columns.size(); i++) {
String column = columns.get(i);
if (i >= yss.size()) {
yss.add(new ArrayList<Number>());
}
yss.get(i).add(getNumberForTimeColumn(row.get(column)));
}
}
final HashSet<String> columnsWithoutData = getColumnsWithoutData(dataColumnsNames);
if (!columnsWithoutData.isEmpty()) {
throw new IllegalArgumentException(String.format("Chart data not found for columns: %s", columnsWithoutData));
}
List<Color> colors = getChartColors();
for (int i = 0; i < yss.size(); i++) {
List<Number> ys = yss.get(i);
if (displayLines) {
Line line = new Line();
line.setX(xs);
line.setY(ys);
if (displayNames != null && i < displayNames.size()) {
line.setDisplayName(displayNames.get(i));
} else {
line.setDisplayName(columns.get(i));
}
if (i < colors.size()) {
line.setColor(colors.get(i));
}
add(line);
}
if (displayPoints) {
Points points = new Points();
points.setX(xs);
points.setY(ys);
if (displayNames != null && i < displayNames.size()) {
points.setDisplayName(displayNames.get(i));
} else {
points.setDisplayName(columns.get(i));
}
if (i < colors.size()) {
points.setColor(colors.get(i));
}
add(points);
}
}
}
}
use of com.twosigma.beakerx.chart.xychart.plotitem.Line in project beakerx by twosigma.
the class XYGraphicsSerializerTest method initTestStubData.
@Before
public void initTestStubData() throws IOException {
sw = new StringWriter();
jgen = mapper.getJsonFactory().createJsonGenerator(sw);
line = new Line();
line.setX(Arrays.asList(1, 2, 3));
line.setY(Arrays.asList(1, 2, 3));
}
use of com.twosigma.beakerx.chart.xychart.plotitem.Line in project beakerx by twosigma.
the class LineSerializerTest method initTestStubData.
@Before
public void initTestStubData() throws IOException {
sw = new StringWriter();
jgen = mapper.getJsonFactory().createJsonGenerator(sw);
line = new Line();
line.setX(Arrays.asList(1, 2, 3));
line.setY(Arrays.asList(1, 2, 3));
}
use of com.twosigma.beakerx.chart.xychart.plotitem.Line in project beakerx by twosigma.
the class PlotTest method initStubData.
@Before
public void initStubData() {
plot = new Plot();
line = new Line();
line.setX(Arrays.asList(1, 2, 3));
line.setY(Arrays.asList(2, 3, 4));
area = new Area();
area.setX(Arrays.asList(1, 2, 3));
area.setY(Arrays.asList(2, 3, 4));
}
use of com.twosigma.beakerx.chart.xychart.plotitem.Line in project beakerx by twosigma.
the class NanoPlotTest method initStubData.
@Before
public void initStubData() {
BigInteger val1 = new BigInteger("12345678901234567891000");
BigInteger val2 = new BigInteger("12345678901234567892000");
points = new Points();
points.setX(Arrays.asList(val1, val2));
points.setY(Arrays.asList(2, 3));
line = new Line();
line.setX(Arrays.asList(val1, val1));
line.setY(Arrays.asList(2, 3));
}
Aggregations