mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
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.
74 lines
1.7 KiB
74 lines
1.7 KiB
<template>
|
|
<v-card>
|
|
<v-card-title v-text="title" />
|
|
<v-divider />
|
|
<v-tabs show-arrows>
|
|
<v-tab
|
|
v-for="(value, user) in chartJSFormat"
|
|
:key="user"
|
|
class="text-capitalize"
|
|
>
|
|
{{ user }}
|
|
</v-tab>
|
|
<v-tab-item
|
|
v-for="(value, user) in chartJSFormat"
|
|
:key="user"
|
|
>
|
|
<v-card-text>
|
|
<bar-chart
|
|
:chart-data="value"
|
|
/>
|
|
</v-card-text>
|
|
</v-tab-item>
|
|
</v-tabs>
|
|
</v-card>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import Vue, { PropType } from 'vue'
|
|
import BarChart from '@/components/metrics/ChartBar.vue'
|
|
import { Distribution } from '~/domain/models/metrics/metrics'
|
|
|
|
export default Vue.extend({
|
|
components: {
|
|
BarChart
|
|
},
|
|
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
required: true,
|
|
default: 'Distribution'
|
|
},
|
|
distribution: {
|
|
type: Object as PropType<Distribution>,
|
|
required: true
|
|
},
|
|
colorMapping: {
|
|
type: Object,
|
|
default: () => {},
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
chartJSFormat(): any {
|
|
const data: {[user: string]: {labels: string[], datasets: any[]}} = {}
|
|
for (const user in this.distribution) {
|
|
const labels = Object.keys(this.distribution[user])
|
|
labels.sort()
|
|
const counts = labels.map((label) => this.distribution[user][label])
|
|
const colors = labels.map((label) => label in this.colorMapping ? this.colorMapping[label] : '#00d1b2')
|
|
data[user] = {
|
|
labels,
|
|
datasets: [{
|
|
title: this.title,
|
|
backgroundColor: colors,
|
|
data: counts
|
|
}]
|
|
}
|
|
}
|
|
return data
|
|
}
|
|
}
|
|
})
|
|
</script>
|