use of com.twosigma.beakerx.chart.Color in project beakerx by twosigma.
the class TableDisplayTest method shouldSendCommMsgWhenAddValueHighlighterForColumnChange.
@Test
public void shouldSendCommMsgWhenAddValueHighlighterForColumnChange() throws Exception {
// given;
ValueHighlighter highlighter = new ValueHighlighter(COL_1, Arrays.asList(new Color(247, 106, 106)));
// 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(ValueHighlighterSerializer.TYPE)).isEqualTo(ValueHighlighter.class.getSimpleName());
assertThat(column.get(ValueHighlighterSerializer.COL_NAME)).isEqualTo(COL_1);
assertThat(column.get(ValueHighlighterSerializer.COLORS)).isNotNull();
}
use of com.twosigma.beakerx.chart.Color 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();
}
use of com.twosigma.beakerx.chart.Color in project beakerx by twosigma.
the class TableDisplayClosureTest method addCellHighlighterClosure_shouldFormatCellColors.
@Test
public void addCellHighlighterClosure_shouldFormatCellColors() throws Exception {
// when
tableDisplay.addCellHighlighter(new ClosureTest() {
@Override
public Color call(Object row, Object col, Object tbl) {
return ((int) row % 2 == 0) ? Color.GREEN : Color.BLUE;
}
@Override
public int getMaximumNumberOfParameters() {
return 3;
}
});
// then
ValueHighlighter highlighter = (ValueHighlighter) tableDisplay.getCellHighlighters().get(0);
Assertions.assertThat(highlighter.getColors().get(0)).isEqualTo(Color.GREEN);
Assertions.assertThat(highlighter.getColors().get(1)).isEqualTo(Color.BLUE);
}
use of com.twosigma.beakerx.chart.Color in project beakerx by twosigma.
the class ColorUtilsTest method callInterpolateColorWithGreenBlueColorsAndFractionIsZero_returnBeakerColorWithGreenValue.
@Test
public void callInterpolateColorWithGreenBlueColorsAndFractionIsZero_returnBeakerColorWithGreenValue() {
// when
Color color = ColorUtils.interpolateColor(java.awt.Color.GREEN, java.awt.Color.BLUE, 0f);
// then
Assertions.assertThat(color).isEqualTo(Color.GREEN);
}
use of com.twosigma.beakerx.chart.Color in project beakerx by twosigma.
the class HistogramTest method setColorWithAwtColorParam_colorHasBeakerColorType.
@Test
public void setColorWithAwtColorParam_colorHasBeakerColorType() {
// given
histogram = createWidget();
// when
histogram.setColor(java.awt.Color.GREEN);
// then
assertThat(histogram.getColor() instanceof Color).isTrue();
LinkedHashMap model = getModelUpdate();
assertThat(model.size()).isEqualTo(1);
assertThat(model.get(COLOR)).isNotNull();
}
Aggregations