Skip to content

Commit

Permalink
Merge pull request #80 from Carifio24/initial-gaps-update
Browse files Browse the repository at this point in the history
Initialize histogram viewer config with correct gaps
  • Loading branch information
Carifio24 authored Jul 15, 2024
2 parents 26a3617 + 1482833 commit cd51f67
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions glue_plotly/viewers/histogram/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def __init__(self, *args, **kwargs):
self.state.add_callback('gap_fraction', self._gaps_changed)
self._update_axes()

def _gap_from_state(self):
return self.state.gap_fraction if self.state.gaps else 0

def _create_layout_config(self):
config = base_layout_config(self, barmode="overlay", bargap=0,
config = base_layout_config(self, barmode="overlay",
bargap=self._gap_from_state(),
width=1000, height=600,
**self.LAYOUT_SETTINGS)
x_axis = base_rectilinear_axis(self.state, 'x')
Expand All @@ -55,8 +59,7 @@ def _update_axes(self, *args):
self.state.y_axislabel = 'Number'

def _gaps_changed(self, *args):
gap = self.state.gap_fraction if self.state.gaps else 0
self.figure.layout.update(bargap=gap)
self.figure.layout.update(bargap=self._gap_from_state())

def _roi_to_subset_state(self, roi):
return roi_to_subset_state(roi, x_att=self.state.x_att)
Expand Down

0 comments on commit cd51f67

Please sign in to comment.