Client - update chart style

This commit is contained in:
Sam 2021-09-21 18:01:36 +02:00
parent 7dc45cb254
commit 16df55f4d8

View File

@ -5,7 +5,13 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Chart, ChartData, ChartOptions, registerables } from 'chart.js' import {
Chart,
ChartData,
ChartOptions,
LayoutItem,
registerables,
} from 'chart.js'
import ChartDataLabels from 'chartjs-plugin-datalabels' import ChartDataLabels from 'chartjs-plugin-datalabels'
import { ComputedRef, PropType, computed, defineComponent } from 'vue' import { ComputedRef, PropType, computed, defineComponent } from 'vue'
import { BarChart, useBarChart } from 'vue-chart-3' import { BarChart, useBarChart } from 'vue-chart-3'
@ -54,6 +60,7 @@
const options = computed<ChartOptions<'bar'>>(() => ({ const options = computed<ChartOptions<'bar'>>(() => ({
responsive: true, responsive: true,
maintainAspectRatio: true, maintainAspectRatio: true,
animation: false,
layout: { layout: {
padding: { padding: {
top: 22, top: 22,
@ -72,10 +79,14 @@
drawOnChartArea: false, drawOnChartArea: false,
}, },
ticks: { ticks: {
maxTicksLimit: 6,
callback: function (value) { callback: function (value) {
return formatTooltipValue(props.displayedData, +value, false) return formatTooltipValue(props.displayedData, +value, false)
}, },
}, },
afterFit: function (scale: LayoutItem) {
scale.width = 60
},
}, },
}, },
plugins: { plugins: {