Client - style fix on charts

This commit is contained in:
Sam 2023-11-12 11:58:57 +01:00
parent e4d4ffb3e8
commit 90269af04f
2 changed files with 35 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="chart"> <div class="bar-chart" :class="{ minimal: !fullStats }">
<Bar :data="chartData" :options="options" class="bar-chart" /> <Bar :data="chartData" :options="options" />
</div> </div>
</template> </template>
@ -41,7 +41,7 @@
})) }))
const options = computed<ChartOptions<'bar'>>(() => ({ const options = computed<ChartOptions<'bar'>>(() => ({
responsive: true, responsive: true,
maintainAspectRatio: true, maintainAspectRatio: false,
animation: false, animation: false,
layout: { layout: {
padding: { padding: {
@ -198,3 +198,20 @@
: 'km' : 'km'
} }
</script> </script>
<style lang="scss" scoped>
@import '~@/scss/vars.scss';
.bar-chart {
min-height: 400px;
&.minimal {
min-height: 300px;
}
@media screen and (max-width: $small-limit) {
&.minimal {
min-height: 290px;
}
}
}
</style>

View File

@ -24,13 +24,14 @@
</label> </label>
</div> </div>
<div id="chart-legend" /> <div id="chart-legend" />
<Line <div class="line-chart">
class="line-chart" <Line
:data="chartData" :data="chartData"
:options="options" :options="options"
:plugins="plugins" :plugins="plugins"
@mouseleave="emitEmptyCoordinates" @mouseleave="emitEmptyCoordinates"
/> />
</div>
<div class="chart-info"> <div class="chart-info">
<div class="no-data-cleaning"> <div class="no-data-cleaning">
{{ $t('workouts.NO_DATA_CLEANING') }} {{ $t('workouts.NO_DATA_CLEANING') }}
@ -107,7 +108,7 @@
) )
const options = computed<ChartOptions<'line'>>(() => ({ const options = computed<ChartOptions<'line'>>(() => ({
responsive: true, responsive: true,
maintainAspectRatio: true, maintainAspectRatio: false,
animation: false, animation: false,
layout: { layout: {
padding: { padding: {
@ -278,6 +279,9 @@
} }
} }
} }
.line-chart {
min-height: 400px;
}
} }
@media screen and (max-width: $small-limit) { @media screen and (max-width: $small-limit) {
@ -293,6 +297,9 @@
padding: 0 $default-padding * 2; padding: 0 $default-padding * 2;
} }
} }
.line-chart {
min-height: 338px;
}
} }
} }
} }