Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Commit

Permalink
add data manipulation example
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Apr 24, 2019
1 parent 93eb1de commit d0ac0dd
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<!--<LineUp v-bind:data="data" />-->
<LineUp v-bind:data="data" defaultRanking="true" style="height: 800px" @highlightChanged="highlightChanged" v-bind:highlight="highlight">
<LineUp v-bind:data="data" />
<!--<LineUp v-bind:data="data" defaultRanking="true" style="height: 800px" @highlightChanged="highlightChanged" v-bind:highlight="highlight">
<LineUpStringColumnDesc column="d" label="Label" v-bind:width="100" />
<LineUpCategoricalColumnDesc column="cat" v-bind:categories="cats" color="green" />
<LineUpCategoricalColumnDesc column="cat2" v-bind:categories="cats" color="blue" />
Expand All @@ -9,7 +9,7 @@
<LineUpSupportColumn type="*" />
<LineUpColumn column="*" />
</LineUpRanking>
</LineUp>
</LineUp>-->
</template>

<script lang="ts">
Expand All @@ -20,7 +20,7 @@ import {LINEUP_COMPONENTS} from './components';
components: LINEUP_COMPONENTS,
})
export default class App extends Vue {
public readonly data = [] as any[];
public data = [] as any[];
public readonly cats = ['c1', 'c2', 'c3'];
Expand All @@ -39,6 +39,24 @@ export default class App extends Vue {
}
}
public mounted() {
const that = this; // this vs that since classes are just a intermediate proxy
setTimeout(() => {
const cats = this.cats;
const data = [];
for (let i = 0; i < 1000; ++i) {
data.push({
a: Math.random() * 10,
d: 'Row ' + i,
cat: cats[Math.floor(Math.random() * 3)],
cat2: cats[Math.floor(Math.random() * 3)],
});
}
that.data = data;
// console.log('updated data');
}, 5000);
}
public highlightChanged(highlight: number) {
this.highlight = highlight;
}
Expand Down

0 comments on commit d0ac0dd

Please sign in to comment.