Skip to content

Commit

Permalink
feat(sankey): Sankey learned "only show changes" and can be embedded …
Browse files Browse the repository at this point in the history
…in dashboards

Chart type "sankey" now works, simply specify the csv file.
  • Loading branch information
billyc committed Dec 19, 2021
1 parent 6e51010 commit a96c190
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 61 deletions.
8 changes: 6 additions & 2 deletions src/charts/allCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import scatter from './scatter.vue'
// all other dashboard viz components:
import flowmap from './flowmap.vue'
import links from './links.vue'
import sankey from './sankey.vue'
import map from './map-polygons.vue'

// export the charts here - be sure to put plotly charts separately!
// ----- EXPORT CHARTS HERE ---------------------------------------------------

export const plotlyCharts = { area, bar, bubble, heatmap, line, pie, scatter }
// export all plotly charts here - be sure to put plotly charts separately!
export const plotlyCharts = { area, bar, bubble, heatmap, line, pie, sankey, scatter }

// export all remaining charts here:
export default Object.assign({ flowmap, links, map }, plotlyCharts)

// ----- HELPER FUNCTIONS -----------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/charts/links.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default class VueComponent extends Vue {
@Prop({ required: true }) config!: any
private mounted() {
console.log(this.fileSystemConfig)
console.log('subfolder', this.subfolder)
console.log('config', this.config)
// console.log(this.fileSystemConfig)
// console.log('subfolder', this.subfolder)
// console.log('config', this.config)
this.$emit('isLoaded')
}
}
Expand Down
52 changes: 52 additions & 0 deletions src/charts/sankey.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template lang="pug">
sankey-diagram.deck-map(
:root="fileSystemConfig.slug"
:subfolder="subfolder"
:config="config"
:thumbnail="false"
:dimensions="dimensions"
)

</template>

<script lang="ts">
import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
import { FileSystemConfig } from '@/Globals'
import SankeyDiagram from '@/plugins/sankey/SankeyDiagram.vue'
@Component({ components: { SankeyDiagram } })
export default class VueComponent extends Vue {
@Prop({ required: true }) fileSystemConfig!: FileSystemConfig
@Prop({ required: true }) subfolder!: string
@Prop({ required: true }) files!: string[]
@Prop({ required: true }) config!: any
@Prop() cardId!: string
private dimensions: { width: number; height: number } = { width: 0, height: 0 }
private mounted() {
this.$emit('dimension-resizer', { id: this.cardId, resizer: this.changeDimensions })
this.$emit('isLoaded')
}
/** Our dashboard system tells us procedurally when we have a new dimension */
private changeDimensions(dimensions: { width: number; height: number }) {
this.dimensions = dimensions
}
}
</script>

<style scoped lang="scss">
@import '@/styles.scss';
.deck-map {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
}
</style>
Loading

0 comments on commit a96c190

Please sign in to comment.