Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metamine visualization tool: #259 combine timeouts #260

Merged
merged 5 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/src/modules/metamine/metamaterial-vegalite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const baseSpec = {
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
width: 'container',
hconcat: [
{
selection: {
Expand Down
23 changes: 13 additions & 10 deletions app/src/pages/metamine/visualization/metamaterial-plot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import VegaLite from '@/components/explorer/VegaLiteWrapper.vue'
import spinner from '@/components/Spinner'
import { buildCsvSpec } from '@/modules/vega-chart'
import embed from 'vega-embed'
Expand All @@ -8,11 +7,11 @@ import { METAMATERIAL_QUERY } from '@/modules/gql/metamaterial-gql'
export default {
name: 'Mockup',
components: {
VegaLite,
spinner
},
data: () => ({
loading: false,
timeout: null,
spec: null,
baseSpec: baseSpec,
error: { status: false, message: null },
Expand Down Expand Up @@ -64,19 +63,23 @@ export default {
} finally {
this.loading = false
}
},
/**
* Pause to allow event to register
*/
changeAxes () {
this.loading = true
clearTimeout(this.timeout)
this.timeout = setTimeout(async () => await this.patchVegaSpec(), 500)
}
},
watch:
{
async xAxis () {
this.loading = true
// Pause to allow event to register
setTimeout(async () => await this.patchVegaSpec(), 100)
xAxis () {
this.changeAxes()
},
async yAxis () {
this.loading = true
// Pause to allow event to register
setTimeout(async () => await this.patchVegaSpec(), 100)
yAxis () {
this.changeAxes()
}
},
apollo: {
Expand Down