Skip to content

Commit

Permalink
Add vetor scaling options
Browse files Browse the repository at this point in the history
  • Loading branch information
CyclingNinja committed Sep 20, 2024
1 parent 583d19d commit c24f34c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions glue_jupyter/bqplot/scatter/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def _update_data(self):
vy = ensure_numerical(self.layer[self.state.vy_att].ravel())

size = 50

# if self.vector_mark.
scale = 1

length = np.sqrt(vx**2 + vy**2)
Expand Down
2 changes: 2 additions & 0 deletions glue_jupyter/common/state_widgets/layer_profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
</div>
</div>
</template>
<script setup>
</script>
14 changes: 14 additions & 0 deletions glue_jupyter/common/state_widgets/layer_scatter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from enum import member

import ipyvuetify as v
import traitlets

Expand Down Expand Up @@ -51,6 +53,9 @@ class ScatterLayerStateWidget(v.VuetifyTemplate):
vy_att_items = traitlets.List().tag(sync=True)
vy_att_selected = traitlets.Int(allow_none=True).tag(sync=True)

vector_origin_items = traitlets.List().tag(sync=True)


def __init__(self, layer_state):
super().__init__()

Expand Down Expand Up @@ -94,3 +99,12 @@ def vue_set_colormap(self, data):
cmap = member[1]
break
self.layer_state.cmap = cmap

def vue_set_vector_origin(self, data):
origin = 'tail'
vector_origins = ['tail', 'middle', 'bottom']
for an_origin in vector_origins:
if data == an_origin:
origin = an_origin
break
self.layer_state.vector_origin = origin
12 changes: 2 additions & 10 deletions glue_jupyter/common/state_widgets/layer_scatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@
<v-select label="vy" :items="vy_att_items" v-model="vy_att_selected" hide-details />
</div>
<div>
<v-select label="origin" :items=vector_origin />
<v-select label="vector origin" :items="vector_origin_items" :value="glue_state.vector_origin" @change="set_vector_origin" hide-details/>
</div>
<div>
<v-subheader class="pl-0 slider-label">vector size</v-subheader>
<glue-throttled-slider wait="300" min="0" max="100" step="1" :value.sync="glue_state.vector_scaling"
<glue-throttled-slider wait="300" min="0" max="1" step="0.01" :value.sync="glue_state.vector_scaling"
hide-details />
</div>
</template>
Expand All @@ -114,11 +114,3 @@
margin-top: 6px;
}
</style>

<script>
export default {
data: () => ({
vector_origin: ['tail', 'middle', 'tip']
}),
}
</script>

0 comments on commit c24f34c

Please sign in to comment.