You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
729 B

  1. <template>
  2. <label-distribution
  3. title="Category Distribution"
  4. :distribution="distribution"
  5. :color-mapping="colorMapping"
  6. />
  7. </template>
  8. <script lang="ts">
  9. import Vue from 'vue'
  10. import LabelDistribution from './LabelDistribution.vue'
  11. export default Vue.extend({
  12. components: {
  13. LabelDistribution
  14. },
  15. data() {
  16. return {
  17. distribution: {},
  18. colorMapping: {},
  19. }
  20. },
  21. async created() {
  22. this.distribution = await this.$services.metrics.fetchCategoryDistribution(this.$route.params.id)
  23. const labels = await this.$services.categoryType.list(this.$route.params.id)
  24. this.colorMapping = Object.fromEntries(labels.map((label) => [label.text, label.backgroundColor]))
  25. }
  26. })
  27. </script>