Search in sources :

Example 1 with ThreeColorHeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.

the class ThreeColorHeatmapHighlighterSerializerTest method serializeThreeColorHeatmapHighlighter_resultJsonHasType.

@Test
public void serializeThreeColorHeatmapHighlighter_resultJsonHasType() throws IOException {
    // given
    ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW) {
    };
    // when
    JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("type")).isTrue();
    Assertions.assertThat(actualObj.get("type").asText()).isEqualTo("ThreeColorHeatmapHighlighter");
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 2 with ThreeColorHeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.

the class ThreeColorHeatmapHighlighterSerializerTest method serializeMidColor_resultJsonHasMidColor.

@Test
public void serializeMidColor_resultJsonHasMidColor() throws IOException {
    // given
    ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW, 1, 5, 10, Color.BLACK, Color.GREEN, Color.BLUE);
    // when
    JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("midColor")).isTrue();
    Assertions.assertThat(actualObj.get("midColor").get("rgb").asInt()).isEqualTo(Color.GREEN.getRGB());
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 3 with ThreeColorHeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.

the class ThreeColorHeatmapHighlighterSerializerTest method serializeMidValue_resultJsonHasMidValue.

@Test
public void serializeMidValue_resultJsonHasMidValue() throws IOException {
    // given
    ThreeColorHeatmapHighlighter heatmapHighlighter = new ThreeColorHeatmapHighlighter("a", HighlightStyle.FULL_ROW, 1, 5, 10);
    // when
    JsonNode actualObj = serializeHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("midVal")).isTrue();
    Assertions.assertThat(actualObj.get("midVal").asInt()).isEqualTo(5);
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 4 with ThreeColorHeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenRemoveAllCellHighlighters.

@Test
public void shouldSendCommMsgWhenRemoveAllCellHighlighters() throws Exception {
    // given;
    TableDisplayCellHighlighter uniqueEntriesHighlighter = TableDisplayCellHighlighter.getUniqueEntriesHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
    TableDisplayCellHighlighter heatmapHighlighter = TableDisplayCellHighlighter.getHeatmapHighlighter(COL_1, 0, 8, Color.ORANGE, Color.PINK);
    ThreeColorHeatmapHighlighter colorHeatmapHighlighter = new ThreeColorHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.SINGLE_COLUMN, 4, 6, 8, new Color(247, 106, 106), new Color(239, 218, 82), new Color(100, 189, 122));
    tableDisplay.addCellHighlighter(uniqueEntriesHighlighter);
    tableDisplay.addCellHighlighter(heatmapHighlighter);
    tableDisplay.addCellHighlighter(colorHeatmapHighlighter);
    kernel.clearMessages();
    // when
    tableDisplay.removeAllCellHighlighters();
    // then
    assertThat(tableDisplay.getCellHighlighters()).isEmpty();
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    assertThat(actual).isEmpty();
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) Color(com.twosigma.beakerx.chart.Color) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 5 with ThreeColorHeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenAddThreeColorHighlighterForColumnChange.

@Test
public void shouldSendCommMsgWhenAddThreeColorHighlighterForColumnChange() throws Exception {
    // given;
    ThreeColorHeatmapHighlighter highlighter = new ThreeColorHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.SINGLE_COLUMN, 4, 6, 8, new Color(247, 106, 106), new Color(239, 218, 82), new Color(100, 189, 122));
    // when
    tableDisplay.addCellHighlighter(highlighter);
    // then
    assertThat(tableDisplay.getCellHighlighters().get(0)).isEqualTo(highlighter);
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    Map column = (Map) actual.get(0);
    assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.TYPE)).isEqualTo(ThreeColorHeatmapHighlighter.class.getSimpleName());
    assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.STYLE)).isEqualTo(TableDisplayCellHighlighter.SINGLE_COLUMN.toString());
    assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.MID_VAL)).isEqualTo(6);
    assertThat(column.get(ThreeColorHeatmapHighlighterSerializer.MID_COLOR)).isNotNull();
}
Also used : ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) Color(com.twosigma.beakerx.chart.Color) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Aggregations

KernelTest (com.twosigma.beakerx.KernelTest)5 ThreeColorHeatmapHighlighter (com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter)5 Test (org.junit.Test)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 Color (com.twosigma.beakerx.chart.Color)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 TableDisplayCellHighlighter (com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1