Skip to content

Commit

Permalink
Perspective
Browse files Browse the repository at this point in the history
  • Loading branch information
sv2 committed Jul 21, 2020
1 parent 4077585 commit 1f31364
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 46 deletions.
Binary file added public/data/superstore.arrow
Binary file not shown.
43 changes: 4 additions & 39 deletions src/components/perspective/DbPerspective.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* DbPerspective * Perspective viewer: https://perspective.finos.org/ */
<template>
<perspective-viewer ref="pv" class="perspective-viewer-vaporwave" :columns="['Sales', 'Profit']" />
<perspective-viewer ref="pv" class="perspective-viewer-material-dark" :columns="['Sales', 'Profit']" />
</template>
<script>
import '@finos/perspective-viewer';
Expand All @@ -27,35 +27,8 @@ export default {
default: 0
},
data: {
type: Array,
default: () => []
},
autoDraw: Boolean,
barWidth: {
type: Number,
default: 8
},
growDuration: {
type: Number,
default: 0.5
},
gradient: {
type: Array,
default: () => ['#6fa8dc', '#42b983']
},
max: {
type: Number,
default: -Infinity
},
min: {
type: Number,
default: Infinity
},
height: Number,
width: Number,
padding: {
type: Number,
default: 8
type: Object,
default: null
}
},
watch: {
Expand All @@ -69,20 +42,12 @@ export default {
}
},
mounted() {
window.addEventListener('resize', this.handleResize);
this.initSize();
// TEMP
let p = this.$refs.pv;
p.load(this.testData);
p.load(this.data);
let a = 1;
},
methods: {
initSize() {
this.$nextTick(() => {
this.lineHeight = this.height ? this.height : this.$refs.chart.clientHeight;
this.lineWidth = this.width ? this.width : this.$refs.chart.clientWidth - 10;
});
},
handleResize(/*event*/) {
this.$nextTick(() => {
// TODO Something wrong with this -10 ... Reconsider
Expand Down
16 changes: 10 additions & 6 deletions src/demo/views/Perspective.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default {
mixins: [demodashboard],
data() {
return {
isDark: false,
dbdata: new DbData(),
// Declare Dashboard Layout. Add widgets to your dashboard, specifying how many columns and rows
// each widget takes. Dashblocks provides 16-columns CSS Grid layout.
Expand All @@ -37,14 +36,19 @@ export default {
ready: false
};
},
mounted() {
this.$store.dispatch('setDashboardSpec', { spec: JSON.stringify(this.dbspec, null, '\t') });
this.initialize();
async mounted() {
await this.$store.dispatch('setDashboardSpec', { spec: JSON.stringify(this.dbspec, null, '\t') });
await this.initialize();
this.ready = true;
},
methods: {
initialize: function() {
// TODO
initialize: async function() {
// Fetch data from Arrow file
const data = await fetch('data/superstore.arrow');
const dataBuffer = await data.arrayBuffer();
this.dbdata.setWData('wP', {
data: Object.freeze(dataBuffer)
});
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/demo/views/Playground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
ready: false
};
},
mounted() {
async mounted() {
this.$store.dispatch('setDashboardSpec', { spec: JSON.stringify(this.dbspec, null, '\t') });
this.initialize();
this.ready = true;
Expand Down

0 comments on commit 1f31364

Please sign in to comment.