Search in sources :

Example 1 with Rasters

use of com.twosigma.beakerx.chart.xychart.plotitem.Rasters in project beakerx by twosigma.

the class PlotTest method addListOfPlotObjects_hasAllPlotObjects.

@Test
public void addListOfPlotObjects_hasAllPlotObjects() {
    // given
    Rasters rasters = new Rasters();
    List<Number> value = Collections.singletonList(1);
    rasters.setY(value);
    rasters.setWidth(value);
    rasters.setHeight(value);
    // when
    plot.add(Arrays.asList(line, new ConstantLine(), new ConstantBand(), rasters, new Text()));
    // then
    assertThat(plot.getGraphics().size()).isEqualTo(1);
    assertThat(plot.getConstantLines().size()).isEqualTo(1);
    assertThat(plot.getConstantBands().size()).isEqualTo(1);
    assertThat(plot.getRasters().size()).isEqualTo(1);
    assertThat(plot.getTexts().size()).isEqualTo(1);
}
Also used : Rasters(com.twosigma.beakerx.chart.xychart.plotitem.Rasters) ConstantBand(com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand) Text(com.twosigma.beakerx.chart.xychart.plotitem.Text) ConstantLine(com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine) Test(org.junit.Test)

Example 2 with Rasters

use of com.twosigma.beakerx.chart.xychart.plotitem.Rasters in project beakerx by twosigma.

the class PlotTest method leftShiftForRasters_plotHasRastersListSizeIsOne.

@Test
public void leftShiftForRasters_plotHasRastersListSizeIsOne() {
    // given
    Rasters raster = new Rasters();
    List<Number> value = Collections.singletonList(1);
    raster.setY(value);
    raster.setWidth(value);
    raster.setHeight(value);
    // when
    plot.add(raster);
    // then
    assertThat(plot.getRasters().size()).isEqualTo(1);
}
Also used : Rasters(com.twosigma.beakerx.chart.xychart.plotitem.Rasters) Test(org.junit.Test)

Example 3 with Rasters

use of com.twosigma.beakerx.chart.xychart.plotitem.Rasters in project beakerx by twosigma.

the class ChartToJson method serializeRasters.

public static Map<Object, Object> serializeRasters(List<Rasters> rasters) {
    List result = new ArrayList();
    for (Rasters item : rasters) {
        result.add(toJson(item));
    }
    Map<Object, Object> value = new LinkedHashMap<>();
    value.put(XYChartSerializer.RASTERS, toJsonList(result));
    return value;
}
Also used : ArrayList(java.util.ArrayList) Rasters(com.twosigma.beakerx.chart.xychart.plotitem.Rasters) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap)

Example 4 with Rasters

use of com.twosigma.beakerx.chart.xychart.plotitem.Rasters in project beakerx by twosigma.

the class RastersSerializerTest method setUp.

@Before
public void setUp() throws Exception {
    rasters = new Rasters() {
    };
    List<Number> value = Collections.singletonList(1);
    rasters.setY(value);
    rasters.setWidth(value);
    rasters.setHeight(value);
    rasters.setOpacity(Arrays.asList(1, 1));
}
Also used : Rasters(com.twosigma.beakerx.chart.xychart.plotitem.Rasters) Before(org.junit.Before)

Example 5 with Rasters

use of com.twosigma.beakerx.chart.xychart.plotitem.Rasters in project beakerx by twosigma.

the class XYChartTest method shouldSendCommMsgWhenAddRastersByLeftShift.

@Test
public void shouldSendCommMsgWhenAddRastersByLeftShift() throws Exception {
    // given
    XYChart xyChart = createWidget();
    Rasters raster = new Rasters();
    List<Number> value = Collections.singletonList(1);
    raster.setY(value);
    raster.setWidth(value);
    raster.setHeight(value);
    // when
    xyChart.leftShift(raster);
    // then
    List valueAsArray = getValueAsArray(RASTERS);
    Map actual = (Map) valueAsArray.get(0);
    assertThat(actual.get(RastersSerializer.TYPE)).isEqualTo(Rasters.class.getSimpleName());
}
Also used : Rasters(com.twosigma.beakerx.chart.xychart.plotitem.Rasters) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) AbstractChartTest(com.twosigma.beakerx.chart.AbstractChartTest) Test(org.junit.Test)

Aggregations

Rasters (com.twosigma.beakerx.chart.xychart.plotitem.Rasters)5 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 AbstractChartTest (com.twosigma.beakerx.chart.AbstractChartTest)1 ConstantBand (com.twosigma.beakerx.chart.xychart.plotitem.ConstantBand)1 ConstantLine (com.twosigma.beakerx.chart.xychart.plotitem.ConstantLine)1 Text (com.twosigma.beakerx.chart.xychart.plotitem.Text)1 Map (java.util.Map)1 Before (org.junit.Before)1