Open source personal finance application
refactor charts
ilkomefd882d015ff2
diff --git a/components/dashboard/Dashboard.vue b/components/dashboard/Dashboard.vueindex 76a8a5f1..9a33e010 100644--- a/components/dashboard/Dashboard.vue+++ b/components/dashboard/Dashboard.vue@@ -89,7 +89,7 @@ export default {transition(name="animation-tab").dashboard__tab(v-if="$store.state.dashboard.activeTab === 'balance'")- StatChartDonut(v-if="$store.getters['trns/hasTrns']")+ StatChartBalance(v-if="$store.getters['trns/hasTrns']")StatPctransition(name="animation-tab")diff --git a/components/layout/LayoutMobile.vue b/components/layout/LayoutMobile.vueindex d28e55b2..68264cff 100644--- a/components/layout/LayoutMobile.vue+++ b/components/layout/LayoutMobile.vue@@ -4,11 +4,6 @@ export default {data () {return {- isShowModalMenu: false,- isScrollInited: false,- key: 0,- headerBlockHeight: 0,- period: 'daily',isShowPeriodsNames: false,periodsNames: [{@@ -276,11 +271,10 @@ export default {v-if="filterPeriod !== 'all'"v-show="activeTabViewName !== 'history' && activeTabViewName !== 'chart'")- StatChartDonut2(+ StatChartLines(v-if="filterPeriod !== 'all'":isShowIncomes="activeTabViewName === 'incomes' || activeTabViewName === 'chart'":isShowExpenses="activeTabViewName === 'expenses' || activeTabViewName === 'chart'"- :key="activeTabViewName + period + filterPeriod + $store.state.chart.periods[filterPeriod].showedPeriods + this.$store.state.filter.categoryId + this.$store.state.filter.walletId")//- ChartMenu2@@ -299,11 +293,10 @@ export default {v-show="activeTabViewName !== 'history'")//- ChartMenu2- StatChartDonut2(+ StatChartLines(v-if="filterPeriod !== 'all'":isShowIncomes="activeTabViewName === 'incomes' || activeTabViewName === 'chart'":isShowExpenses="activeTabViewName === 'expenses' || activeTabViewName === 'chart'"- :key="activeTabViewName + period + filterPeriod + $store.state.chart.periods[filterPeriod].showedPeriods + this.$store.state.filter.categoryId + this.$store.state.filter.walletId").boxFlew2diff --git a/components/stat/StatChartDonut.vue b/components/stat/StatChartBalance.vuesimilarity index 99%rename from components/stat/StatChartDonut.vuerename to components/stat/StatChartBalance.vueindex 57fee7c2..6f2ba1f7 100644--- a/components/stat/StatChartDonut.vue+++ b/components/stat/StatChartBalance.vue@@ -3,6 +3,8 @@ import { Chart } from 'highcharts-vue'import chartOptions from '~/components/stat/chartOptions'export default {+ name: 'StatChartBalance',+components: {Chart},diff --git a/components/stat/StatChartDonut2.vue b/components/stat/StatChartDonut2.vuedeleted file mode 100644index 45445fd6..00000000--- a/components/stat/StatChartDonut2.vue+++ /dev/null@@ -1,333 +0,0 @@-<script>-import { Chart } from 'highcharts-vue'-import chartOptions from '~/components/stat/chartOptions'--export default {- name: 'StatChartDonut2',-- components: {- Chart- },-- props: {- isShowIncomes: {- type: Boolean,- default: true- },- isShowExpenses: {- type: Boolean,- default: true- }- },-- data () {- const vm = this- return {- average: 0,- date: this.$day().valueOf(),- periodName: 'month',- visiblePeriodMenu: false,- dateStart: null,- dateEnd: null,- chartOptions: {- ...chartOptions,- tooltip: false,- chart: {- events: {- click (e) {- const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true)- vm.$store.dispatch('filter/setDate', parseInt(value.date))- }- }- }- }- }- },-- computed: {- activeTab () {- return this.$store.state.dashboard.activeTab === 'balance'- }- },-- watch: {- activeTab (isShow) {- if (isShow) {- // this.chartOptions.chart.redraw()- }- }- },-- mounted () {- const data = this.generateData(this.$store.state.filter.period)- const handlePerioSelect = date => this.$store.dispatch('filter/setDate', parseInt(date))- this.chartOptions.series = data.series- this.chartOptions.plotOptions.series = {- cursor: 'pointer',- point: {- events: {- click () {- handlePerioSelect(this.date)- }- }- }- }-- this.chartOptions = {- ...this.chartOptions,- xAxis: {- categories: data.categories,- labels: {- padding: 15,- rotation: false- }- },-- yAxis: {- plotLines: [{- opacity: 0.3,- color: 'var(--c-expenses-opacity)',- value: data.averageExpenses, // Insert your average here- width: '1',- zIndex: 1- }, {- opacity: 0.3,- color: 'var(--c-incomes-opacity)',- value: data.averageIncomes, // Insert your average here- width: '1',- zIndex: 1- }]- },-- chart: {- tooltip: false,- backgroundColor: 'transparent',- with: '100%',- height: '200',- spacing: [5, 0, 0, 0],- type: 'column',- zoomType: 'x',- panning: true,- panKey: 'shift'- }- }- },-- methods: {- changePeriod (name) {- if (this.periodName !== name) {- this.periodName = name- const data = this.generateData(this.periodName, this.chartOptions.series)- this.chartOptions.series = data.series- this.chartOptions.xAxis.categories = data.categories- }- },-- formatAmount (amount) {- const fixed = this.$store.state.currencies.base === 'RUB' ? 0 : 2- return Number(`${amount.toFixed(fixed)}`).toLocaleString('ru-RU')- },-- generateData (periodName, oldSeries) {- const trns = this.$store.state.trns.items- // const allTrnsIds = Object.keys(trns)-- // diff periods from oldest trn and today- const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)- let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1- periodsToShow = this.$store.state.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : this.$store.state.chart.periods[periodName].showedPeriods-- // get balance for first period- // const dateStart = this.$day().endOf(periodName).subtract(periodsToShow, periodName).valueOf()- // const trnsIdsBeforeDate = allTrnsIds.filter(id => trns[id].date < dateStart)- // const totalStart = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIdsBeforeDate, true)-- const categories = []- const incomesData = []- const expensesData = []- const totalData = []-- for (let index = 0; index < periodsToShow; index++) {- // count balance- // const balanceDateStart = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- // const balanceTrnsIds = allTrnsIds.filter(id => trns[id].date > dateStart && trns[id].date < balanceDateStart)- // const balanceTotal = this.$store.getters['trns/getTotalOfTrnsIds'](balanceTrnsIds, true)-- // count total period- const periodDate = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- const trnsIds = this.$store.getters['trns/getTrns']({ date: periodDate, periodName })- const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)-- let format = 'MM'- if (periodName === 'day') { format = 'D.MM' }- if (periodName === 'week') { format = 'D MMM' }- if (periodName === 'month') { format = 'MMM' }- if (periodName === 'year') { format = 'YYYY' }- const name = this.$day().startOf(periodName).subtract(index, periodName).format(format)-- // return- incomesData.unshift({- date: periodDate,- y: Number(`${periodTotal.incomes.toFixed()}`)- })- expensesData.unshift({- date: periodDate,- y: Number(`${periodTotal.expenses.toFixed()}`)- })- // totalData.unshift({- // date: periodDate,- // y: Number(`${(totalStart.total + balanceTotal.total).toFixed()}`)- // })- totalData.unshift({- date: periodDate,- y: Number(`${(periodTotal.total).toFixed()}`)- })- categories.unshift(name)- }-- let periods = 0- let periodsTotalIncomes = 0- for (const iterator of incomesData) {- if (iterator.y !== 0) {- periods = periods + 1- periodsTotalIncomes = periodsTotalIncomes + iterator.y- }- }- let periodsExpenses = 0- let periodsTotalExpenses = 0- for (const iterator of expensesData) {- if (iterator.y !== 0) {- periodsExpenses = periodsExpenses + 1- periodsTotalExpenses = periodsTotalExpenses + iterator.y- }- }-- return {- series: [{- zIndex: 3,- visible: periodsTotalIncomes > 0 && this.isShowIncomes,- type: 'line',- name: this.$t('money.incomes'),- color: 'var(--c-incomes-1)',- data: incomesData,- marker: {- radius: 3,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: 'var(--c-incomes-1)',- symbol: 'circle'- },-- dataLabels: {- enabled: true,- allowOverlap: false,- shadow: false,- color: 'var(--c-font-3)',- backgroundColor: 'var(--c-bg-15)',- align: 'center',- borderRadius: 3,- padding: 3,- y: -8,- style: {- textOutline: 'var(--c-bg-1)',- color: 'var(--c-bg-7)',- fontSize: '10px',- fontFamily: 'var(--font-secondary)',- fontWeight: 400,- textTransform: 'uppercase'- }- }- }, {- zIndex: 2,- visible: periodsTotalExpenses > 0 && this.isShowExpenses,- type: 'line',- name: this.$t('money.expenses'),- color: 'var(--c-expenses-1)',- data: expensesData,- marker: {- radius: 3,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: 'var(--c-expenses-1)',- symbol: 'circle'- },- dataLabels: {- enabled: true,- allowOverlap: false,- shadow: false,- color: 'var(--c-font-3)',- backgroundColor: 'var(--c-bg-15)',- align: 'center',- borderRadius: 3,- padding: 3,- y: -8,- style: {- textOutline: 'var(--c-bg-1)',- color: 'var(--c-bg-7)',- fontSize: '10px',- fontFamily: 'var(--font-secondary)',- fontWeight: 400,- textTransform: 'uppercase'- }- }- }, {- zIndex: 1,- visible: false,- type: 'areaspline',- name: this.$t('money.total'),- color: '#c1c1c1',- data: totalData,- marker: {- radius: 3,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: '#c1c1c1',- symbol: 'circle'- },- dataLabels: {- enabled: true,- allowOverlap: false,- shadow: false,- color: 'var(--c-font-3)',- backgroundColor: 'var(--c-bg-15)',- align: 'center',- borderRadius: 3,- padding: 3,- y: -8,- style: {- textOutline: 'var(--c-bg-1)',- color: 'var(--c-bg-7)',- fontSize: '10px',- fontFamily: 'var(--font-secondary)',- fontWeight: 400,- textTransform: 'uppercase'- }- }- }],- categories,- averageIncomes: periodsTotalIncomes / periods,- averageExpenses: periodsTotalExpenses / periodsExpenses- }- }- }-}-</script>--<template lang="pug">-.chart- Chart(:options="chartOptions")-</template>--<style lang="stylus" scoped>-@import "~assets/stylus/variables/animations"-@import "~assets/stylus/variables/margins"-@import "~assets/stylus/variables/fonts"-@import "~assets/stylus/variables/media"--$background = var(--c-bg-4)-$border = var(--c-bg-1)--.chart- z-index 3- position relative-</style>diff --git a/components/stat/StatChartDonut3.vue b/components/stat/StatChartDonut3.vuedeleted file mode 100644index 7a23b1cb..00000000--- a/components/stat/StatChartDonut3.vue+++ /dev/null@@ -1,311 +0,0 @@-<script>-import { Chart } from 'highcharts-vue'-import chartOptions from '~/components/stat/chartOptions'--export default {- name: 'StatChartDonut3',-- components: {- Chart- },-- props: {- categoryId: {- type: String,- required: true- },- color: {- type: String,- required: true- },- type: {- type: Number,- default: 3- }- },-- data () {- const vm = this- return {- average: 0,- date: this.$day().valueOf(),- periodName: 'month',- visiblePeriodMenu: false,- dateStart: null,- dateEnd: null,- chartOptions: {- ...chartOptions,- legend: false,- tooltip: false,- chart: {- events: {- click (e) {- const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true)- vm.$store.dispatch('filter/setDate', parseInt(value.date))- }- }- }- }- }- },-- computed: {- activeTab () {- return this.$store.state.dashboard.activeTab === 'balance'- }- },-- watch: {- activeTab (isShow) {- if (isShow) {- // this.chartOptions.chart.redraw()- }- }- },-- mounted () {- const data = this.generateData(this.$store.state.filter.period)- const handlePerioSelect = date => this.$store.dispatch('filter/setDate', parseInt(date))- this.chartOptions.series = data.series- this.chartOptions.plotOptions.series = {- cursor: 'pointer',- point: {- events: {- click () {- handlePerioSelect(this.date)- }- }- }- }-- this.chartOptions = {- ...this.chartOptions,- xAxis: {- categories: data.categories,-- // plotLines: [{- // color: 'var(--c-bg-9)',- // dashStyle: 'solid', // Style of the plot line. Default to solid- // value: 2, // Value of where the line will appear- // width: 6, // Width of the line- // zIndex: 1- // }]- },-- yAxis: {- plotLines: [{- opacity: 0.3,- color: 'var(--c-expenses-opacity)',- value: data.averageExpenses, // Insert your average here- width: '1',- zIndex: 1- }, {- opacity: 0.3,- color: 'var(--c-incomes-opacity)',- value: data.averageIncomes, // Insert your average here- width: '1',- zIndex: 1- }]- },-- chart: {- tooltip: false,- backgroundColor: 'transparent',- with: '100%',- height: '200',- spacing: [5, 0, 0, 15],- type: 'column',- zoomType: 'x',- panning: true,- panKey: 'shift'- }- }- },-- methods: {- changePeriod (name) {- if (this.periodName !== name) {- this.periodName = name- const data = this.generateData(this.periodName, this.chartOptions.series)- this.chartOptions.series = data.series- this.chartOptions.xAxis.categories = data.categories- }- },-- formatAmount (amount) {- const fixed = this.$store.state.currencies.base === 'RUB' ? 0 : 2- return Number(`${amount.toFixed(fixed)}`).toLocaleString('ru-RU')- },-- generateData (periodName, oldSeries) {- const trns = this.$store.state.trns.items- // const allTrnsIds = Object.keys(trns)-- // diff periods from oldest trn and today- const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)- let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1- periodsToShow = this.$store.state.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : this.$store.state.chart.periods[periodName].showedPeriods- // get balance for first period- // const dateStart = this.$day().endOf(periodName).subtract(periodsToShow, periodName).valueOf()- // const trnsIdsBeforeDate = allTrnsIds.filter(id => trns[id].date < dateStart)- // const totalStart = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIdsBeforeDate, true)-- const categories = []- const incomesData = []- const expensesData = []- const totalData = []-- for (let index = 0; index < periodsToShow; index++) {- // count balance- // const balanceDateStart = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- // const balanceTrnsIds = allTrnsIds.filter(id => trns[id].date > dateStart && trns[id].date < balanceDateStart)- // const balanceTotal = this.$store.getters['trns/getTotalOfTrnsIds'](balanceTrnsIds, true)-- // count total period- const periodDate = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- const trnsIds = this.$store.getters['trns/getTrns']({ date: periodDate, periodName, categoryId: this.categoryId })- const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)-- let format = 'MM'- if (periodName === 'day') { format = 'D.MM' }- if (periodName === 'week') { format = 'D MMM' }- if (periodName === 'month') { format = 'MMM' }- if (periodName === 'year') { format = 'YYYY' }- const name = this.$day().startOf(periodName).subtract(index, periodName).format(format)-- // return- incomesData.unshift({- date: periodDate,- y: Number(`${periodTotal.incomes.toFixed()}`)- })- expensesData.unshift({- date: periodDate,- y: Number(`${periodTotal.expenses.toFixed()}`)- })- // totalData.unshift({- // date: periodDate,- // y: Number(`${(totalStart.total + balanceTotal.total).toFixed()}`)- // })- totalData.unshift({- date: periodDate,- y: Number(`${(periodTotal.total).toFixed()}`)- })- categories.unshift(name)- }-- let periods = 0- let periodsTotalIncomes = 0- for (const iterator of incomesData) {- if (iterator.y !== 0) {- periods = periods + 1- periodsTotalIncomes = periodsTotalIncomes + iterator.y- }- }- let periodsExpenses = 0- let periodsTotalExpenses = 0- for (const iterator of expensesData) {- if (iterator.y !== 0) {- periodsExpenses = periodsExpenses + 1- periodsTotalExpenses = periodsTotalExpenses + iterator.y- }- }-- return {- series: [{- // zIndex: 3,- visible: periodsTotalIncomes > 0 && this.type === 1,- type: 'bar',- name: this.$t('money.incomes'),- color: this.color,- borderWidth: 0,- data: incomesData,- animation: false,- marker: {- radius: 3,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: this.color,- symbol: 'circle'- },- dataLabels: {- enabled: true,- allowOverlap: false,- shadow: false,- color: 'var(--c-font-3)',- backgroundColor: 'var(--c-bg-15)',- align: 'center',- borderRadius: 3,- padding: 3,- y: -8,- style: {- textOutline: 'var(--c-bg-1)',- color: 'var(--c-bg-7)',- fontSize: '10px',- fontFamily: 'var(--font-secondary)',- fontWeight: 400,- textTransform: 'uppercase'- }- }- }, {- // zIndex: 2,- visible: periodsTotalExpenses > 0 && this.type === 0,- type: 'bar',- name: this.$t('money.expenses'),- color: this.color,- borderWidth: 0,- data: expensesData,- animation: false,- marker: {- radius: 3,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: this.color,- symbol: 'circle'- },- dataLabels: {- enabled: true,- allowOverlap: false,- shadow: false,- color: 'var(--c-font-3)',- borderColor: 'red',- align: 'center',- backgroundColor: 'var(--c-bg-15)',- borderRadius: 3,- padding: 3,- y: -8,- style: {- textOutline: 'var(--c-bg-1)',- fontSize: '10px',- fontFamily: 'var(--font-secondary)',- fontWeight: 400,- textTransform: 'uppercase'- }- }- }],- categories,- averageIncomes: periodsTotalIncomes / periods,- averageExpenses: periodsTotalExpenses / periodsExpenses- }- }- }-}-</script>--<template lang="pug">-.chart- Chart(:options="chartOptions")-</template>--<style lang="stylus" scoped>-@import "~assets/stylus/variables/animations"-@import "~assets/stylus/variables/margins"-@import "~assets/stylus/variables/fonts"-@import "~assets/stylus/variables/media"--$background = var(--c-bg-4)-$border = var(--c-bg-1)--.chart- z-index 3- position relative-</style>diff --git a/components/stat/StatChartDonut4.vue b/components/stat/StatChartDonut4.vuedeleted file mode 100644index 7bacf089..00000000--- a/components/stat/StatChartDonut4.vue+++ /dev/null@@ -1,336 +0,0 @@-<script>-import { Chart } from 'highcharts-vue'-import chartOptions from '~/components/stat/chartOptions'--export default {- name: 'StatChartDonut2',-- components: {- Chart- },-- props: {- isShowIncomes: {- type: Boolean,- default: true- },- isShowExpenses: {- type: Boolean,- default: true- }- },-- data () {- const vm = this- return {- average: 0,- date: this.$day().valueOf(),- periodName: 'month',- visiblePeriodMenu: false,- dateStart: null,- dateEnd: null,- chartOptions: {- ...chartOptions,- tooltip: false,- chart: {- events: {- click (e) {- const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true)- vm.$store.dispatch('filter/setDate', parseInt(value.date))- }- }- }- }- }- },-- computed: {- activeTab () {- return this.$store.state.dashboard.activeTab === 'balance'- }- },-- watch: {- activeTab (isShow) {- if (isShow) {- // this.chartOptions.chart.redraw()- }- }- },-- mounted () {- const data = this.generateData(this.$store.state.filter.period)- const handlePerioSelect = date => this.$store.dispatch('filter/setDate', parseInt(date))- this.chartOptions.series = data.series- this.chartOptions.plotOptions.series = {- cursor: 'pointer',- point: {- events: {- click () {- handlePerioSelect(this.date)- }- }- }- }-- this.chartOptions = {- ...this.chartOptions,- xAxis: {- categories: data.categories- // plotLines: [{- // color: 'var(--c-bg-9)',- // dashStyle: 'solid', // Style of the plot line. Default to solid- // value: 2, // Value of where the line will appear- // width: 6, // Width of the line- // zIndex: 1- // }]- },-- yAxis: {- plotLines: [{- opacity: 0.3,- color: 'var(--c-expenses-opacity)',- value: data.averageExpenses, // Insert your average here- width: '1',- zIndex: 1- }, {- opacity: 0.3,- color: 'var(--c-incomes-opacity)',- value: data.averageIncomes, // Insert your average here- width: '1',- zIndex: 1- }]- },-- chart: {- tooltip: false,- backgroundColor: 'transparent',- with: '100%',- height: '200',- spacing: [5, 0, 0, 0],- type: 'column',- zoomType: 'x',- panning: true,- panKey: 'shift'- }- }- },-- methods: {- changePeriod (name) {- if (this.periodName !== name) {- this.periodName = name- const data = this.generateData(this.periodName, this.chartOptions.series)- this.chartOptions.series = data.series- this.chartOptions.xAxis.categories = data.categories- }- },-- formatAmount (amount) {- const fixed = this.$store.state.currencies.base === 'RUB' ? 0 : 2- return Number(`${amount.toFixed(fixed)}`).toLocaleString('ru-RU')- },-- generateData (periodName, oldSeries) {- const trns = this.$store.state.trns.items- const categoriesItems = this.$store.state.categories.items- // const allTrnsIds = Object.keys(trns)-- // diff periods from oldest trn and today- const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)- let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1- periodsToShow = this.$store.state.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : this.$store.state.chart.periods[periodName].showedPeriods-- // get balance for first period- // const dateStart = this.$day().endOf(periodName).subtract(periodsToShow, periodName).valueOf()- // const trnsIdsBeforeDate = allTrnsIds.filter(id => trns[id].date < dateStart)- // const totalStart = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIdsBeforeDate, true)-- const categories = []- const incomesData = []- const expensesData = []- const totalData = []-- const series = []-- for (let index = 0; index < periodsToShow; index++) {- // count balance- // const balanceDateStart = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- // const balanceTrnsIds = allTrnsIds.filter(id => trns[id].date > dateStart && trns[id].date < balanceDateStart)- // const balanceTotal = this.$store.getters['trns/getTotalOfTrnsIds'](balanceTrnsIds, true)-- // count total period- const periodDate = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- const trnsIds = this.$store.getters['trns/getTrns']({ date: periodDate, periodName })- const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)-- const expensesTrnsIds = trnsIds.filter(trnId => trns[trnId].type === 0)- const cat = this.$store.getters['stat/getCategoriesIdsWithTrnsIds']({ trnsIds: expensesTrnsIds })-- for (const catId in cat) {- console.log(catId)- // // return- // series.unshift({- // name: 'h',- // data: {- // date: periodDate,- // y: Number(`${periodTotal.incomes.toFixed()}`)- // }- // })- // series.unshift({- // name: 'h2',- // data: {- // date: periodDate,- // y: Number(`${periodTotal.expenses.toFixed()}`)- // }- // })- // series.unshift({- // name: 'h3',- // data: {- // date: periodDate,- // y: Number(`${(periodTotal.total).toFixed()}`)- // }- // })-- }-- let format = 'MM'- if (periodName === 'day') { format = 'D.MM' }- if (periodName === 'week') { format = 'D.MM' }- if (periodName === 'month') { format = 'MMM' }- if (periodName === 'year') { format = 'YYYY' }- const name = this.$day(periodDate).format(format)-- categories.unshift(name)- }-- return {- series,- // series: [{- // zIndex: 3,- // visible: periodsTotalIncomes > 0 && this.isShowIncomes,- // type: 'line',- // name: this.$t('money.incomes'),- // color: 'var(--c-incomes-1)',- // data: incomesData,- // marker: {- // radius: 3,- // fillColor: 'var(--c-bg-4)',- // lineWidth: 2,- // lineColor: 'var(--c-incomes-1)',- // symbol: 'circle'- // },-- // dataLabels: {- // enabled: true,- // allowOverlap: false,- // shadow: false,- // color: 'var(--c-font-3)',- // backgroundColor: 'var(--c-bg-15)',- // align: 'center',- // borderRadius: 3,- // padding: 3,- // y: -8,- // style: {- // textOutline: 'var(--c-bg-1)',- // color: 'var(--c-bg-7)',- // fontSize: '10px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }- // }, {- // zIndex: 2,- // visible: periodsTotalExpenses > 0 && this.isShowExpenses,- // type: 'line',- // name: this.$t('money.expenses'),- // color: 'var(--c-expenses-1)',- // data: expensesData,- // marker: {- // radius: 3,- // fillColor: 'var(--c-bg-4)',- // lineWidth: 2,- // lineColor: 'var(--c-expenses-1)',- // symbol: 'circle'- // },- // dataLabels: {- // enabled: true,- // allowOverlap: false,- // shadow: false,- // color: 'var(--c-font-3)',- // backgroundColor: 'var(--c-bg-15)',- // align: 'center',- // borderRadius: 3,- // padding: 3,- // y: -8,- // style: {- // textOutline: 'var(--c-bg-1)',- // color: 'var(--c-bg-7)',- // fontSize: '10px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }- // }, {- // zIndex: 1,- // visible: false,- // type: 'areaspline',- // name: this.$t('money.total'),- // color: '#c1c1c1',- // data: totalData,- // marker: {- // radius: 3,- // fillColor: 'var(--c-bg-4)',- // lineWidth: 2,- // lineColor: '#c1c1c1',- // symbol: 'circle'- // },- // dataLabels: {- // enabled: true,- // allowOverlap: false,- // shadow: false,- // color: 'var(--c-font-3)',- // backgroundColor: 'var(--c-bg-15)',- // align: 'center',- // borderRadius: 3,- // padding: 3,- // y: -8,- // style: {- // textOutline: 'var(--c-bg-1)',- // color: 'var(--c-bg-7)',- // fontSize: '10px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }- // }],- categories,- averageIncomes: periodsTotalIncomes / periods,- averageExpenses: periodsTotalExpenses / periodsExpenses- }- }- }-}-</script>--<template lang="pug">-.chart- Chart(:options="chartOptions")-</template>--<style lang="stylus" scoped>-@import "~assets/stylus/variables/animations"-@import "~assets/stylus/variables/margins"-@import "~assets/stylus/variables/fonts"-@import "~assets/stylus/variables/media"--$background = var(--c-bg-4)-$border = var(--c-bg-1)--.chart- z-index 3- position relative-</style>diff --git a/components/stat/StatChartDonut5.vue b/components/stat/StatChartDonut5.vuedeleted file mode 100644index eb8cedcf..00000000--- a/components/stat/StatChartDonut5.vue+++ /dev/null@@ -1,332 +0,0 @@-<script>-import { Chart } from 'highcharts-vue'-import chartOptions from '~/components/stat/chartOptions'--export default {- name: 'StatChartDonut5',-- components: {- Chart- },-- props: {- categoryId: {- type: String,- required: true- },- color: {- type: String,- required: true- },- type: {- type: Number,- default: 3- },- averageIncomes: {- type: Number,- default: 0- },- averageExpenses: {- type: Number,- default: 0- }- },-- data () {- const vm = this- return {- date: this.$day().valueOf(),- periodName: 'month',- visiblePeriodMenu: false,- dateStart: null,- dateEnd: null,- chartOptions: {- ...chartOptions,- legend: false,- tooltip: false,- chart: {- events: {- click (e) {- // const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true) || this.series[2].searchPoint(e, true)- // vm.$store.dispatch('filter/setDate', parseInt(value.date))- }- }- }- }- }- },-- computed: {- activeTab () {- return this.$store.state.dashboard.activeTab === 'balance'- }- },-- watch: {- activeTab (isShow) {- if (isShow) {- // this.chartOptions.chart.redraw()- }- }- },-- mounted () {- const data = this.generateData(this.$store.state.filter.period)- const handlePerioSelect = date => this.$store.dispatch('filter/setDate', parseInt(date))- this.chartOptions.series = data.series- this.chartOptions.plotOptions.series = {- cursor: 'pointer',- point: {- events: {- click () {- // handlePerioSelect(this.date)- }- }- }- }-- this.chartOptions = {- ...this.chartOptions,- xAxis: {- categories: data.categories,- labels: false,- // labels: {- // style: {- // textOutline: 'var(--c-bg-1)',- // fontSize: '8px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }-- // plotLines: [{- // color: 'var(--c-bg-9)',- // dashStyle: 'solid', // Style of the plot line. Default to solid- // value: 2, // Value of where the line will appear- // width: 6, // Width of the line- // zIndex: 1- // }]- },-- yAxis: {- labels: false,- plotLines: [{- opacity: 0.3,- color: 'var(--c-expenses-opacity)',- value: this.averageExpenses, // Insert your average here- width: '1',- zIndex: 1- }, {- opacity: 0.3,- color: 'var(--c-incomes-opacity)',- value: this.averageIncomes, // Insert your average here- width: '1',- zIndex: 1- }]- },-- chart: {- tooltip: false,- legend: false,- backgroundColor: 'transparent',- with: '100%',- height: '36',- spacing: [0, 0, 5, 5],- type: 'column',- zoomType: 'x',- panning: true,- panKey: 'shift'- }- }- },-- methods: {- changePeriod (name) {- if (this.periodName !== name) {- this.periodName = name- const data = this.generateData(this.periodName, this.chartOptions.series)- this.chartOptions.series = data.series- this.chartOptions.xAxis.categories = data.categories- }- },-- formatAmount (amount) {- const fixed = this.$store.state.currencies.base === 'RUB' ? 0 : 2- return Number(`${amount.toFixed(fixed)}`).toLocaleString('ru-RU')- },-- generateData (periodName, oldSeries) {- const trns = this.$store.state.trns.items- // const allTrnsIds = Object.keys(trns)-- // diff periods from oldest trn and today- const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)- let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1- periodsToShow = this.$store.state.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : this.$store.state.chart.periods[periodName].showedPeriods- // get balance for first period- // const dateStart = this.$day().endOf(periodName).subtract(periodsToShow, periodName).valueOf()- // const trnsIdsBeforeDate = allTrnsIds.filter(id => trns[id].date < dateStart)- // const totalStart = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIdsBeforeDate, true)-- const categories = []- const incomesData = []- const expensesData = []- const totalData = []-- for (let index = 0; index < 4; index++) {- // count balance- // const balanceDateStart = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- // const balanceTrnsIds = allTrnsIds.filter(id => trns[id].date > dateStart && trns[id].date < balanceDateStart)- // const balanceTotal = this.$store.getters['trns/getTotalOfTrnsIds'](balanceTrnsIds, true)-- // count total period- const periodDate = this.$day().endOf(periodName).subtract(index, periodName).valueOf()- const trnsIds = this.$store.getters['trns/getTrns']({ date: periodDate, periodName, categoryId: this.categoryId })- const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)-- let format = 'MM'- if (periodName === 'day') { format = 'D.MM' }- if (periodName === 'week') { format = 'D MMM' }- if (periodName === 'month') { format = 'MMM' }- if (periodName === 'year') { format = 'YYYY' }- const name = this.$day().startOf(periodName).subtract(index, periodName).format(format)-- // return- incomesData.unshift({- date: periodDate,- y: Number(`${periodTotal.incomes.toFixed()}`)- })- expensesData.unshift({- date: periodDate,- y: Number(`${periodTotal.expenses.toFixed()}`)- })- // totalData.unshift({- // date: periodDate,- // y: Number(`${(totalStart.total + balanceTotal.total).toFixed()}`)- // })- totalData.unshift({- date: periodDate,- y: Number(`${(periodTotal.total).toFixed()}`)- })- categories.unshift(name)- }-- let periods = 0- let periodsTotalIncomes = 0- for (const iterator of incomesData) {- if (iterator.y !== 0) {- periods = periods + 1- periodsTotalIncomes = periodsTotalIncomes + iterator.y- }- }- let periodsExpenses = 0- let periodsTotalExpenses = 0- for (const iterator of expensesData) {- if (iterator.y !== 0) {- periodsExpenses = periodsExpenses + 1- periodsTotalExpenses = periodsTotalExpenses + iterator.y- }- }-- return {- series: [{- // zIndex: 3,- visible: periodsTotalIncomes > 0 && this.type === 1,- type: 'bar',- name: this.$t('money.incomes'),- color: this.color,- borderWidth: 0,- data: incomesData,- groupPadding: 0,- pointPadding: 0.2,- marker: {- radius: 2,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: this.color,- symbol: 'circle'- },- // dataLabels: {- // enabled: true,- // allowOverlap: false,- // shadow: false,- // color: 'var(--c-font-3)',- // backgroundColor: 'var(--c-bg-15)',- // align: 'center',- // borderRadius: 3,- // padding: 3,- // y: -8,- // style: {- // textOutline: 'var(--c-bg-1)',- // color: 'var(--c-bg-7)',- // fontSize: '10px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }- }, {- // zIndex: 2,- visible: periodsTotalExpenses > 0 && this.type === 0,- type: 'bar',- name: this.$t('money.expenses'),- color: this.color,- data: expensesData,- borderWidth: 0,- groupPadding: 0,- pointPadding: 0.2,- marker: {- radius: 2,- fillColor: 'var(--c-bg-4)',- lineWidth: 2,- lineColor: this.color,- symbol: 'circle'- },- // dataLabels: {- // enabled: true,- // allowOverlap: false,- // shadow: false,- // color: 'var(--c-font-3)',- // borderColor: 'red',- // align: 'center',- // backgroundColor: 'var(--c-bg-15)',- // borderRadius: 3,- // padding: 3,- // y: -8,- // style: {- // textOutline: 'var(--c-bg-1)',- // fontSize: '10px',- // fontFamily: 'var(--font-secondary)',- // fontWeight: 400,- // textTransform: 'uppercase'- // }- // }- }],- categories,- // averageIncomes: periodsTotalIncomes / periods,- // averageExpenses: periodsTotalExpenses / periodsExpenses- }- }- }-}-</script>--<template lang="pug">-.chart- Chart(:options="chartOptions")-</template>--<style lang="stylus" scoped>-@import "~assets/stylus/variables/animations"-@import "~assets/stylus/variables/margins"-@import "~assets/stylus/variables/fonts"-@import "~assets/stylus/variables/media"--$background = var(--c-bg-4)-$border = var(--c-bg-1)--.chart- z-index 3- position relative-</style>diff --git a/components/stat/StatChartLines.vue b/components/stat/StatChartLines.vuenew file mode 100644index 00000000..ade8be87--- /dev/null+++ b/components/stat/StatChartLines.vue@@ -0,0 +1,229 @@+<script>+import { Chart } from 'highcharts-vue'+import chartOptions from '~/components/stat/chartOptions'++export default {+ name: 'StatChartLines',++ components: {+ Chart+ },++ props: {+ isShowIncomes: {+ type: Boolean,+ default: true+ },++ isShowExpenses: {+ type: Boolean,+ default: true+ },++ chartColor: {+ type: String,+ default: null+ },++ chartType: {+ type: String,+ default: 'line'+ },++ categoryId: {+ type: String,+ default: null+ },++ amountType: {+ type: String,+ default: null+ }+ },++ computed: {+ chartData () {+ const periodName = this.$store.state.filter.period+ const trns = this.$store.state.trns.items+ const vm = this++ // diff periods from oldest trn and today+ const oldestTrnDate = this.$day(trns[this.$store.getters['trns/firstCreatedTrnId']].date).endOf(periodName)+ let periodsToShow = this.$day().endOf(periodName).diff(oldestTrnDate, periodName) + 1+ periodsToShow = this.$store.state.chart.periods[periodName].showedPeriods >= periodsToShow ? periodsToShow : this.$store.state.chart.periods[periodName].showedPeriods++ const categories = []+ const incomesData = []+ const expensesData = []+ const totalData = []++ for (let index = 0; index < periodsToShow; index++) {+ // count total period+ const periodDate = this.$day().endOf(periodName).subtract(index, periodName).valueOf()+ const trnsIds = this.$store.getters['trns/getTrns']({+ date: periodDate,+ periodName,+ categoryId: this.categoryId+ })+ const periodTotal = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)++ let format = 'MM'+ if (periodName === 'day') { format = 'D.MM' }+ if (periodName === 'week') { format = 'D MMM' }+ if (periodName === 'month') { format = 'MMM' }+ if (periodName === 'year') { format = 'YYYY' }+ const name = this.$day().startOf(periodName).subtract(index, periodName).format(format)++ // Incomes+ incomesData.unshift({+ date: periodDate,+ y: Number(`${periodTotal.incomes.toFixed()}`)+ })+ // Expenses+ expensesData.unshift({+ date: periodDate,+ y: Number(`${periodTotal.expenses.toFixed()}`)+ })+ // Total+ totalData.unshift({+ date: periodDate,+ y: Number(`${(periodTotal.total).toFixed()}`)+ })+ categories.unshift(name)+ }++ let periods = 0+ let periodsTotalIncomes = 0+ for (const iterator of incomesData) {+ if (iterator.y !== 0) {+ periods = periods + 1+ periodsTotalIncomes = periodsTotalIncomes + iterator.y+ }+ }+ let periodsExpenses = 0+ let periodsTotalExpenses = 0+ for (const iterator of expensesData) {+ if (iterator.y !== 0) {+ periodsExpenses = periodsExpenses + 1+ periodsTotalExpenses = periodsTotalExpenses + iterator.y+ }+ }++ const data = {+ series: [{+ zIndex: 3,+ visible: periodsTotalIncomes > 0 && this.isShowIncomes,+ type: this.chartType,+ name: this.$t('money.incomes'),+ color: this.chartColor || 'var(--c-incomes-1)',+ data: incomesData,+ marker: {+ lineColor: 'var(--c-incomes-1)'+ }+ }, {+ zIndex: 2,+ visible: periodsTotalExpenses > 0 && this.isShowExpenses,+ type: this.chartType,+ name: this.$t('money.expenses'),+ color: this.chartColor || 'var(--c-expenses-1)',+ data: expensesData,+ marker: {+ lineColor: 'var(--c-expenses-1)'+ }+ }, {+ zIndex: 1,+ visible: false,+ type: 'areaspline',+ name: this.$t('money.total'),+ color: '#c1c1c1',+ data: totalData,+ marker: {+ lineColor: '#c1c1c1'+ }+ }],+ categories,+ averageIncomes: periodsTotalIncomes / periods,+ averageExpenses: periodsTotalExpenses / periodsExpenses+ }++ return {+ ...chartOptions,+ series: data.series,++ xAxis: {+ ...chartOptions.xAxis,+ categories: data.categories+ // plotBands: [{+ // color: 'orange', // Color value+ // from: `${this.selectedIndex}.5`, // Start of the plot band+ // to: `${this.selectedIndex + 1}.5` // End of the plot band+ // }]+ },++ yAxis: {+ ...chartOptions.yAxis,+ plotLines: [{+ opacity: 0.3,+ color: 'var(--c-expenses-opacity)',+ value: data.averageExpenses,+ width: '1',+ zIndex: 1+ }, {+ opacity: 0.3,+ color: 'var(--c-incomes-opacity)',+ value: data.averageIncomes,+ width: '1',+ zIndex: 1+ }]+ },++ chart: {+ ...chartOptions.chart,+ height: '200',+ tooltip: false,++ events: {+ click (e) {+ const value = this.series[0].searchPoint(e, true) || this.series[1].searchPoint(e, true)+ vm.$store.dispatch('filter/setDate', parseInt(value.date))+ }+ }+ },++ plotOptions: {+ ...chartOptions.plotOptions,+ series: {+ ...chartOptions.plotOptions.series,+ cursor: 'pointer',+ point: {+ events: {+ click () {+ vm.$store.dispatch('filter/setDate', parseInt(this.date))+ }+ }+ }+ }+ },++ tooltip: false+ }+ }+ }+}+</script>++<template lang="pug">+.chart+ Chart(:options="chartData")+</template>++<style lang="stylus" scoped>+@import '~assets/stylus/variables/animations'+@import '~assets/stylus/variables/margins'+@import '~assets/stylus/variables/fonts'+@import '~assets/stylus/variables/media'++.chart+ z-index 3+ position relative+</style>diff --git a/components/stat/StatItemMobile.vue b/components/stat/StatItemMobile.vueindex 91cfd7dd..db45cb58 100644--- a/components/stat/StatItemMobile.vue+++ b/components/stat/StatItemMobile.vue@@ -120,12 +120,13 @@ export default {.statItem__inside(@click.stop="").statItem__chart- StatChartDonut3(+ StatChartLines(v-if="filterPeriod !== 'all'":categoryId="categoryId"- :color="category.color"- :type="type"- :key="filterPeriod + $store.state.chart.periods[filterPeriod].showedPeriods + this.$store.state.filter.categoryId + this.$store.state.filter.walletId"+ :chartColor="category.color"+ :isShowExpenses="type === 0"+ :isShowIncomes="type === 1"+ chartType="column").statItem__date@@ -168,7 +169,6 @@ export default {align-items centerjustify-content centerflex-flow column- margin-top -38pxmargin-bottom -10px.categoryIcon@@ -176,6 +176,7 @@ export default {display flexalign-items centerjustify-content center+ margin-top -38pxpadding-bottom 12px.statItem@@ -233,7 +234,7 @@ export default {&__chartheight 180pxmargin-bottom $m9- margin-left (- $m7)+ // margin-left (- $m7)&__graphoverflow hiddendiff --git a/components/stat/StatItemMobileExtra.vue b/components/stat/StatItemMobileExtra.vuedeleted file mode 100644index efdbfd47..00000000--- a/components/stat/StatItemMobileExtra.vue+++ /dev/null@@ -1,296 +0,0 @@-<script>-export default {- name: 'StatItemMobileExtra',-- props: {- category: {- type: Object,- required: true- },- categoryId: {- type: String,- required: true- },- currency: {- type: String,- required: true- },- total: {- type: Number,- required: true- },- biggest: {- type: Number,- required: true- },- type: {- type: Number,- required: true- }- },-- data () {- return {- showInside: false- }- },-- computed: {- trnsIds () {- return this.$store.getters['trns/getTrns']({- categoryId: this.categoryId,- type: this.type- })- },-- summary () {- return this.$store.getters['trns/getTotalOfTrnsIds'](this.trnsIds)- },-- showChildCategories () {- const childCategoriesIds = this.$store.getters['categories/getChildCategoriesIds'](this.categoryId)-- const childCatsIdsWithTrns = []- for (const childCategoryId of childCategoriesIds) {- const trnsIds = this.$store.getters['trns/getTrnsIdsByFilter']({- categoryId: childCategoryId,- type: this.type- })- if (trnsIds.length > 0) { childCatsIdsWithTrns.push(childCategoryId) }- }-- if (childCatsIdsWithTrns.length > 0) { return true }- return false- },-- styles () {- return {- width: `${Math.abs(this.total) / Math.abs(this.biggest) * 100}%`,- background: this.category.color- }- },-- filterPeriod () {- return this.$store.state.filter.period- },-- statCurrentPeriod () {- return this.$store.getters['stat/statCurrentPeriod']- }- },-- methods: {- toogleShowInside (categoryId) {- this.showInside = !this.showInside- }- }-}-</script>--<template lang="pug">-.statItem(@click="toogleShowInside(categoryId)")- .statItem__content- .statItem__graph: .statItem__graph__in(:style="styles")- .statItem__icon(@click.stop="() => $store.dispatch('filter/handleSetFilterCategory', categoryId)")- Icon(- :background="category.color"- :icon="category.icon"- )-- .statItem__name {{ category.name }}- .statItem__amount- Amount(- :currency="currency"- :value="total"- :type="type"- :isColorize="false"- isShowPrefix- )-- .statItem__chart2- StatChartDonut5(- v-if="filterPeriod !== 'all'"- :categoryId="categoryId"- :color="category.color"- :type="type"- :key="filterPeriod + $store.state.chart.periods[filterPeriod].showedPeriods + this.$store.state.filter.categoryId + this.$store.state.filter.walletId"- )-- Portal(- v-if="showInside"- to="modal"- )- ModalBottom(- center- @onClose="showInside = false"- )- template(slot="header")- .categoryWrap- .categoryIcon- Icon(- :icon="category.icon"- :background="category.color || $store.state.ui.defaultBgColor"- :round="true"- :big="true"- )- .modalBottom__header__title {{ category.name }}-- .statItem__inside(@click.stop="")- //- pre {{ summary }}-- .statItem__chart- StatChartDonut3(- v-if="filterPeriod !== 'all'"- :categoryId="categoryId"- :color="category.color"- :type="type"- :key="filterPeriod + $store.state.chart.periods[filterPeriod].showedPeriods + this.$store.state.filter.categoryId + this.$store.state.filter.walletId"- )-- .statItem__date- Date-- .statItem__summary- Amount(- :currency="currency"- :value="total"- :type="type"- size="xl"- vertical="center"- :isColorize="false"- isShowPrefix- )-- template(v-if="showChildCategories")- StatItemChildCats(- :categoryId="categoryId"- :type="type"- )-- template(v-else)- TrnsList(- :incomes="type === 1"- :expenses="type === 0"- :categoryId="categoryId"- )-</template>--<style lang="stylus" scoped>-@import '~assets/stylus/variables'--.categoryWrap- flex-grow 1- display flex- align-items center- justify-content center- flex-flow column- margin-top -38px- margin-bottom -10px--.categoryIcon- flex-grow 1- display flex- align-items center- justify-content center- padding-bottom 12px--.statItem- // overflow hidden- cursor pointer- position relative- display grid- grid-template-columns 1fr 80px- // height 42px- padding $m5 0- border-bottom 1px solid transparent-- &:first-child- padding-top 0-- &:last-child- padding-bottom 0-- &._active- margin-bottom $m9- border-bottom-color var(--c-bg-6)-- &:active- z-index 2- // margin -1px (- $m6)- // padding $m5 $m5- background var(--c-bg-5)-- &__chart2- // width 70px-- &__content- display grid- grid-template-columns minmax(10px, max-content) 1fr minmax(10px, max-content)- grid-template-rows repeat(2, minmax(10px, max-content))- grid-column-gap 20px- padding-right $m7-- &__inside- cursor default-- &__date- display flex- justify-content center- padding-top $m7- padding-bottom $m5- color var(--c-font-4)- text-align center-- &__summary- z-index 10- position sticky- top (- $m7)- padding 0- padding-bottom $m7- background var(--c-bg-4)-- &__chart- height 180px- margin-bottom $m9- margin-left (- $m7)-- &__graph- overflow hidden- grid-column 2 / -1- grid-row 2 / -1- align-self center- margin-top 10px- background var(--c-bg-8)- border-radius 2px-- &__in- height 4px- min-width 2px-- &__name- overflow hidden- align-self center- color var(--c-font-4)- font-size 14px- white-space nowrap- text-overflow ellipsis-- ^[0]._active &- color var(--c-font-2)- font-weight 500-- &__icon- width 32px- grid-column 1 / 2- grid-row 1 / -1-- &:active- opacity .8-- @media $media-laptop- &:hover- transform scale(1.3)-- &__amount- align-self center-</style>diff --git a/components/stat/chartOptions.js b/components/stat/chartOptions.jsindex 9579edce..9ee0e450 100644--- a/components/stat/chartOptions.js+++ b/components/stat/chartOptions.js@@ -7,14 +7,12 @@ export default {type: 'column',zoomType: 'x',panning: true,- panKey: 'shift',- events: {- click (e) {- // console.log(this.series[0].searchPoint(e, true))- }- }+ panKey: 'shift'},++ title: { text: null },credits: { enabled: false },+legend: {itemHiddenStyle: {fontWeight: 'normal',@@ -29,21 +27,13 @@ export default {color: 'var(--c-font-4)'}},+plotOptions: {- // series: {- // allowPointSelect: true,- // marker: {- // states: {- // select: {- // enabled: true- // }- // }- // }- // },areaspline: {fillOpacity: 0.3,borderWidth: 2},+column: {groupPadding: 0.2,pointPadding: 0.1,@@ -53,47 +43,55 @@ export default {borderRadiusTopRight: 5}},+spline: {lineWidth: 2,states: {hover: {lineWidth: 2}- },- marker: {- // enabled: false}- }- },- series: [],- title: { text: null },- tooltip: {- shared: true,- animation: true,- backgroundColor: 'var(--c-bg-3)',- borderColor: 'var(--c-bg-7)',- borderRadius: 8,- padding: 12,- shadow: false,- style: {- color: 'var(--c-font-2)',- fontSize: '10px'},- positioner (labelWidth, labelHeight, point) {- const leftHalf = point.plotX < (this.chart.plotWidth / 2)- const topHalf = point.plotY < (this.chart.plotHeight / 2)- return {- x: leftHalf ? this.chart.plotLeft + this.chart.plotWidth - labelWidth - 2 : this.chart.plotLeft,- y: topHalf ? this.chart.plotTop + this.chart.plotHeight - labelHeight : this.chart.plotTop++ series: {+ marker: {+ radius: 3,+ fillColor: 'var(--c-bg-4)',+ lineWidth: 2,+ lineColor: 'var(--c-incomes-1)',+ symbol: 'circle'+ },++ dataLabels: {+ enabled: true,+ allowOverlap: false,+ shadow: false,+ color: 'var(--c-font-3)',+ backgroundColor: 'var(--c-bg-15)',+ align: 'center',+ borderRadius: 3,+ padding: 3,+ y: -8,+ style: {+ textOutline: 'var(--c-bg-1)',+ color: 'var(--c-bg-7)',+ fontSize: '10px',+ fontFamily: 'var(--font-secondary)',+ fontWeight: 400,+ textTransform: 'uppercase'+ }}}},+xAxis: {categories: [],lineColor: 'var(--c-bg-7)',tickColor: 'var(--c-bg-7)',tickmarkPlacement: 'on',labels: {+ padding: 15,+ rotation: false,style: {cursor: 'pointer',color: 'var(--c-font-5)',@@ -102,15 +100,10 @@ export default {textTransform: 'uppercase'}},+crosshair: true- // color: 'green'- // }- // plotBands: [{- // color: 'orange', // Color value- // from: 3.5, // Start of the plot band- // to: 4.5 // End of the plot band- // }]},+yAxis: {cursor: 'pointer',alternateGridColor: '',@@ -124,10 +117,28 @@ export default {fontFamily: 'var(--font-secondary)',textTransform: 'uppercase'}+ }+ },++ tooltip: {+ shared: true,+ animation: true,+ backgroundColor: 'var(--c-bg-3)',+ borderColor: 'var(--c-bg-7)',+ borderRadius: 8,+ padding: 12,+ shadow: false,+ style: {+ color: 'var(--c-font-2)',+ fontSize: '10px'},- // opposite: true,- // labels: {- // align: 'left'- // }+ positioner (labelWidth, labelHeight, point) {+ const leftHalf = point.plotX < (this.chart.plotWidth / 2)+ const topHalf = point.plotY < (this.chart.plotHeight / 2)+ return {+ x: leftHalf ? this.chart.plotLeft + this.chart.plotWidth - labelWidth - 2 : this.chart.plotLeft,+ y: topHalf ? this.chart.plotTop + this.chart.plotHeight - labelHeight : this.chart.plotTop+ }+ }}}