Skip to content

Open source personal finance application

fix (Chart): fix highlight selector

ilkome5dcecb22424c
diff --git a/components/chart/StatChartLines.vue b/components/chart/StatChartLines.vue
index 770d570c..14986da7 100644
--- a/components/chart/StatChartLines.vue
+++ b/components/chart/StatChartLines.vue
@@ -69,7 +69,6 @@ export default {
const nEvent = chart.pointer.normalize(event)
const value = chart.series[0].searchPoint(nEvent, true) || chart.series[0].searchPoint(nEvent, false) || chart.series[1].searchPoint(nEvent, true)
-
if (value) {
if (store.state.filter.period === 'all')
store.dispatch('filter/setPeriod', 'year')
@@ -89,16 +88,18 @@ export default {
if (filterPeriodNameAllReplacedToYear.value === 'week') format = 'D MMM'
if (filterPeriodNameAllReplacedToYear.value === 'month') format = 'MMM'
if (filterPeriodNameAllReplacedToYear.value === 'year') format = 'YYYY'
- const name = $day(date).format(format)
-
+ const name = $day(date).startOf(filterPeriodNameAllReplacedToYear.value).format(format)
const index = chart.xAxis && chart?.xAxis[0].categories.indexOf(name)
- chart.xAxis[0].update({
- plotBands: [{
- color: 'var(--c-bg-7)',
- from: index + 0.5,
- to: index - 0.5
- }]
- })
+
+ if (index !== -1) {
+ chart.xAxis[0].update({
+ plotBands: [{
+ color: 'var(--c-bg-7)',
+ from: index + 0.5,
+ to: index - 0.5
+ }]
+ })
+ }
}, { immediate: true })
return {
@@ -234,13 +235,13 @@ export default {
yAxis: {
...chartOptions.yAxis,
plotLines: [{
- opacity: 0.3,
+ opacity: 0.5,
color: 'var(--c-expenses-opacity)',
value: data.averageExpenses,
width: '1',
zIndex: 1
}, {
- opacity: 0.3,
+ opacity: 0.5,
color: 'var(--c-incomes-opacity)',
value: data.averageIncomes,
width: '1',
diff --git a/components/stat/StatSummaryPc.vue b/components/stat/StatSummaryPc.vue
deleted file mode 100644
index 20742309..00000000
--- a/components/stat/StatSummaryPc.vue
+++ /dev/null
@@ -1,73 +0,0 @@
-<script>
-import { computed, useContext } from '@nuxtjs/composition-api'
-
-export default {
- setup () {
- const { store } = useContext()
-
- const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
- const statAverage = computed(() => store.getters['stat/statAverage'])
-
- return {
- statCurrentPeriod,
- statAverage
- }
- }
-}
-</script>
-
-<template lang="pug">
-.baseBox(v-if="statAverage.incomes !== 0 && statAverage.expenses !== 0 && $store.state.filter.period !== 'all'")
- .baseBox__title {{ $t('money.total') }}
- .boxSummary2
- .boxSummary2__item
- Amount(
- :currency="$store.state.currencies.base"
- :type="(statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total) > 0 ? 1 : 0"
- :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total"
- size="xl"
- vertical="left"
- )
- StatSummaryRowItemView(
- :type="(statAverage.incomes - statAverage.expenses) > 0 ? 1 : 0"
- :amount="statAverage.incomes - statAverage.expenses"
- :title="$t('money.averageTotal')"
- )
-</template>
-
-<style lang="stylus" scoped>
-@import '~assets/stylus/variables'
-
-.baseBox
- overflow hidden
- padding $m5 $m7
- background var(--c-bg-3)
- border-top 1px solid var(--c-bg-2)
-
- +media(700px)
- padding $m5 54px
-
- &__title
- z-index 9
- display flex
- align-items center
- padding $m6 $m6
- color var(--c-font-3)
- font-size 10px
- letter-spacing 1px
- font-weight 500
- text-transform uppercase
-
-// ------------------------------------
-.boxSummary2
- z-index 9
- display flex
- align-items center
- justify-content flex-start
- margin-bottom $m3
- padding 0 $m5
- padding-bottom $m5
-
- &__item
- padding-right $m9
-</style>
diff --git a/components/stat/cats/PeriodCatsChart.vue b/components/stat/cats/PeriodCatsChart.vue
index 17bc734b..4dd55242 100644
--- a/components/stat/cats/PeriodCatsChart.vue
+++ b/components/stat/cats/PeriodCatsChart.vue
@@ -81,14 +81,6 @@ export default {
position relative
width 100%
- @media $media-laptop
- opacity .7
- anim-all(100)
-
- &:hover
- @media $media-laptop
- opacity 1
-
&._incomes
@media $media-laptop
border-bottom 2px solid rgba(44, 173, 34, .5)
diff --git a/components/stat/chartOptions.js b/components/stat/chartOptions.js
index 9484be77..bb3f1a52 100644
--- a/components/stat/chartOptions.js
+++ b/components/stat/chartOptions.js
@@ -37,11 +37,12 @@ export default {
groupPadding: 0.2,
pointPadding: 0.1,
borderWidth: 0,
- maxPointWidth: 10
+ maxPointWidth: 10,
+ borderRadius: 3
},
spline: {
- lineWidth: 2,
+ lineWidth: 3,
states: {
hover: {
lineWidth: 2
@@ -71,9 +72,9 @@ export default {
},
marker: {
- radius: 2,
+ radius: 3,
fillColor: 'var(--c-bg-4)',
- lineWidth: 2,
+ lineWidth: 3,
lineColor: 'var(--c-incomes-1)',
symbol: 'circle'
},
@@ -105,6 +106,7 @@ export default {
lineColor: 'var(--c-bg-7)',
tickColor: 'var(--c-bg-7)',
tickmarkPlacement: 'on',
+ crosshair: true,
labels: {
padding: 15,
rotation: false,
@@ -115,10 +117,6 @@ export default {
fontFamily: 'var(--font-secondary)',
textTransform: 'uppercase'
}
- },
-
- crosshair: {
- enabled: true
}
},
@@ -145,8 +143,12 @@ export default {
backgroundColor: 'var(--c-bg-3)',
borderColor: 'var(--c-bg-7)',
borderRadius: 8,
- padding: 12,
+ padding: 0,
shadow: false,
+ useHTML: true,
+ headerFormat: '',
+ pointFormat: '',
+ footerFormat: '',
style: {
color: 'var(--c-font-2)',
fontSize: '12px',