Ejemplo n.º 1
0
    def test_plot_invisible_with_no_data(self, small_df, populated_config):
        ds = DataSource(small_df)
        hw = HistogramWidget(ds, 0, 0, 1.0, 400)
        ds.brushed_indices = []

        assert not hw.figure_widget.data[1].visible

        ds.brushed_indices = [0]
        assert hw.figure_widget.data[1].visible
    def test_brush_indices_change(self, small_df, populated_config):
        ds = DataSource(small_df, None)
        bp = BoxPlotWidget(ds, 0, 0, 1.0, 400)
        bp.build()
        ds.brushed_indices = [1, 2, 3]

        assert bp.figure_widget.data[0].selectedpoints == ds.brushed_indices
Ejemplo n.º 3
0
    def test_brush_indices_change(self, small_df, populated_config):
        ds = DataSource(small_df, None)
        hw = HistogramWidget(ds, 0, 0, 1.0, 400)
        hw.build()
        ds.brushed_indices = [1, 2, 3]

        assert hw.figure_widget.data[1].selectedpoints == ds.brushed_indices
        assert hw.figure_widget.data[0].visible
    def test_on_selection_constraint_ranges_reset(self, small_df,
                                                  populated_config):
        ds = DataSource(small_df, None)
        ps = ParallelCoordinatesWidget(ds, 0, 0, 1.0, 400)

        dimensions = ps.figure_widget.data[0].dimensions
        assert len(dimensions) != 0
        dimensions = fill_sample_constraint_range(dimensions, "a", [2, 5])
        ps._on_selection_helper(None, dimensions)

        ds.brushed_indices = [1, 2]
        assert ps.constraint_ranges == {}
    def test_on_selection_helper_no_ranges_deselect(self, small_df,
                                                    populated_config):
        ds = DataSource(small_df, None)
        ps = ParallelCoordinatesWidget(ds, 0, 0, 1.0, 400)
        ds.brushed_indices = [1, 2]

        old_dimensions = deepcopy(
            ps.figure_widget.data[0].dimensions)  # no constraint ranges
        dimensions = ps.figure_widget.data[0].dimensions
        dimensions = fill_sample_constraint_range(dimensions, "a", [2, 5])
        ps._on_selection_helper(None, dimensions)
        assert len(ds) != 0
        ps._on_selection_helper(None, old_dimensions)  # trigger deselect

        assert len(ds.brushed_indices) == ds.len
    def test_brush_indices_change(self, small_df, populated_config):
        ds = DataSource(small_df, None)
        ps = ParallelCoordinatesWidget(ds, 0, 0, 1.0, 400)

        dimensions = ps.figure_widget.data[0].dimensions
        assert len(dimensions) != 0
        dimensions = fill_sample_constraint_range(dimensions, "a", [1.5, 5])
        ps.figure_widget.data[0].dimensions = dimensions

        ps.change_initiated = False

        ds.brushed_indices = [1, 2, 3]

        assert sum(list(ps.figure_widget.data[0].line.color)) == 3
        dimensions = ps.figure_widget.data[0].dimensions
        for dimension in dimensions:
            if dimension.label == "a":
                assert dimension["constraintrange"] is None
                break
 def test_on_deselection(self, small_df, populated_config):
     ds = DataSource(small_df, None)
     ds.brushed_indices = [0]
     bp = BoxPlotWidget(ds, 0, 0, 1.0, 400)
     bp.on_deselection(None, None)
     assert len(ds.brushed_indices) == len(small_df)
Ejemplo n.º 8
0
 def test_on_deselection(self, small_df, populated_config):
     ds = DataSource(small_df, None)
     ds.brushed_indices = [0]
     hw = HistogramWidget(ds, 0, 0, 1.0, 400)
     hw.on_deselection(None, None)
     assert len(ds.brushed_indices) == len(small_df)
Ejemplo n.º 9
0
    def test_brush_indices_change(self, small_df, populated_config):
        ds = DataSource(small_df, None)
        pc = ParallelCategoriesWidget(ds, 0, 0, 1.0, 400)
        ds.brushed_indices = [1, 2, 3]

        assert sum(list(pc.figure_widget.data[0].line.color)) == 3