Skip to content

Conversation

@CyclingNinja
Copy link
Contributor

No description provided.

@CyclingNinja
Copy link
Contributor Author

@mariobuikhuizen hi there, @astrofrog mentioned you might be able to help us here.

I'm trying to create a template to apply to all state widgets (that need it) that adjusts the bounds of an axis.

its working, but its not populating with the initial values from the glue_state. I've used the

props: { glue_state: { type: Object, default: () => ({ x_min: 0, x_max: 1, y_min: 0, y_max: 1 }) } },

to ensure that glue_state.x_min isn't undefined and the whole thing fall over.

I'd really appreciate your thoughts/help

@mariobuikhuizen
Copy link
Collaborator

mariobuikhuizen commented Nov 20, 2025

Hi @CyclingNinja there are a few issues:

  1. the prop in glue_axes.vue needs to be named value if you set it as value with <glue-axes :value.sync="glue_state"/>
  2. Then you also need to use value in the HTML of glue_axes.vue, e.g: <glue-float-field label="ymax" :value.sync="value.y_max"/>
  3. The watch isn't needed, changes to glue_state are synced automatically
  4. In layer_scatter.vue the tag should start with a lowercase letter <Glue-axes/> should be <glue-axes/>

See: https://github.com/CyclingNinja/glue-jupyter/pull/1/files

@CyclingNinja
Copy link
Contributor Author

Hi @mariobuikhuizen thanks so much for you help, i'll pick this apart so my brain understands it and go forward from there, should be some more things to follow

@CyclingNinja CyclingNinja force-pushed the axes_template branch 2 times, most recently from f271f55 to 3f12181 Compare November 26, 2025 10:43
@CyclingNinja
Copy link
Contributor Author

Now at a point where its functioning in the scatter_viewer. If this acceptable, i'll roll it out to the other viewers

@CyclingNinja
Copy link
Contributor Author

@mariobuikhuizen could you take a look at the additions i've made.

I've tried to add some validation for text boxes on axes limit and a sensible precision implementation.

Also i'm trying to implement ticklabel adjustment in Bqplot, what I've done should be working if my interpretation of the docs is right, but it is not.

@mariobuikhuizen
Copy link
Collaborator

Hi @CyclingNinja, I think it would be better to do the precision part in glue_float_field.vue adding an optional precision prop.

note there is a stray : in glue_axes.vue making the template not render.

@mariobuikhuizen
Copy link
Collaborator

This should fix the Bqplot issue for the x-axis (the line you uncommented was wrong to begin with):

diff --git a/glue_jupyter/bqplot/common/viewer.py b/glue_jupyter/bqplot/common/viewer.py
index 1527083..527ac01 100644
--- a/glue_jupyter/bqplot/common/viewer.py
+++ b/glue_jupyter/bqplot/common/viewer.py
@@ -69,7 +69,7 @@ class BqplotBaseView(IPyWidgetView):
 
         self.state.add_callback('x_axislabel', self.update_x_axislabel)
         # self.state.add_callback('x_axislabel_weight', self.update_x_axislabel)
-        self.state.add_callback('x_axislabel_size', self.update_x_axislabel)
+        self.state.add_callback('x_ticklabel_size', self.update_x_ticksize)
 
         self.state.add_callback('y_axislabel', self.update_y_axislabel)
         # self.state.add_callback('y_axislabel_weight', self.update_y_axislabel)
@@ -97,7 +97,7 @@ class BqplotBaseView(IPyWidgetView):
         self.axis_y.label = self.state.y_axislabel
 
     def update_x_ticksize(self, *event):
-        self.axis_x.tick_style = {'font-size': self.state.x_ticklabel_size}
+        self.axis_x.tick_style = {'font-size': str(self.state.x_ticklabel_size) + "px"}
 
     def update_y_ticksize(self, *event):
         self.axis_y.tick_style = {'font-size': self.state.y_ticklabel_size}

@CyclingNinja
Copy link
Contributor Author

Ah thank you, it was the string and 'px' I was missing (trying a lot locally, didn't want to muddy the waters).

Also thanks for the precision point, I'll add that too. Is there a method for not having the 'up/down' integer arrows not appear when using it? its quite clunky when used in this context.

@mariobuikhuizen
Copy link
Collaborator

Is there a method for not having the 'up/down' integer arrows not appear when using it? its quite clunky when used in this context.

We could make this configurable via props:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants