use of com.twosigma.beakerx.chart.xychart.SimpleTimePlot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializeTimePlotTypeOfCombinedPlot_resultJsonHasTimePlotType.
@Test
public void serializeTimePlotTypeOfCombinedPlot_resultJsonHasTimePlotType() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.add(new SimpleTimePlot(createDataForSimpleTimePlot(), Arrays.asList("m3", "time")));
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("plot_type")).isTrue();
Assertions.assertThat(actualObj.get("plot_type").asText()).isEqualTo("TimePlot");
}
use of com.twosigma.beakerx.chart.xychart.SimpleTimePlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseSimpleTimePlotScript_returnSimpleTimePlotObjectWithData.
@Test
public void parseSimpleTimePlotScript_returnSimpleTimePlotObjectWithData() {
// when
Object result = parseClassFromScript("def rates = (1..10).collect{[\"y1\": 1 + it, \"y10\": 2 + it, \"time\" : 633733200000 + 10000*it]}\n" + "new SimpleTimePlot(rates, [\"y1\", \"y10\"],\n" + " yLabel: \"Price\", \n" + " displayNames: [\"1 Year\", \"10 Year\"])");
// then
Assertions.assertThat(result instanceof SimpleTimePlot).isTrue();
SimpleTimePlot simpleTimePlot = (SimpleTimePlot) result;
Assertions.assertThat(simpleTimePlot.getData()).isNotEmpty();
}
use of com.twosigma.beakerx.chart.xychart.SimpleTimePlot in project beakerx by twosigma.
the class DisplayOutputContainerTest method display_shouldDisplayOutputContainerWithTabLayout.
@Test
public void display_shouldDisplayOutputContainerWithTabLayout() throws Exception {
// given
List<Map<String, Object>> values = ResourceLoaderTest.readAsList("tableRowsTest.csv");
OutputContainer oc = new OutputContainer();
SimpleTimePlot simpleTimePlot = new SimpleTimePlot(values, Arrays.asList("m3", "y1"));
oc.setLayoutManager(new TabbedOutputContainerLayoutManager());
oc.addItem(simpleTimePlot, "Scatter with History");
// when
oc.display();
// then
verifyTabLayout(kernel.getPublishedMessages());
}
Aggregations