+analytics update
This commit is contained in:
@@ -27,6 +27,7 @@ const dataTableCategories = ref([]);
|
||||
const tableColumns = ref([]);
|
||||
const chartData = ref(null)
|
||||
const selectedCategory = ref()
|
||||
const formatter = ref(new Intl.NumberFormat('ru-RU', {style: 'currency', currency: 'RUB', minimumFractionDigits: 0}))
|
||||
|
||||
|
||||
const preparedChartData = computed(() => {
|
||||
@@ -67,9 +68,9 @@ const chartOptions = {
|
||||
},
|
||||
datalabels: {
|
||||
formatter: function (value) {
|
||||
return value + " ₽";
|
||||
return formatter.value.format(value);
|
||||
},
|
||||
color: 'blue',
|
||||
|
||||
align: 'top',
|
||||
offset: 2,
|
||||
labels: {
|
||||
@@ -132,19 +133,19 @@ const prepareTableData = (categories) => {
|
||||
return categories.map((category) => {
|
||||
// Начинаем со строки, где есть поле с именем категории
|
||||
const row = {category: category.categoryIcon + " " + category.categoryName};
|
||||
const formatter = new Intl.NumberFormat('ru-RU', {style: 'currency', currency: 'RUB', minimumFractionDigits: 0});
|
||||
|
||||
// Для каждой даты проверяем, есть ли в monthlySums соответствующая запись
|
||||
allDates.forEach((dateStr) => {
|
||||
const found = category.monthlySums.find((m) => m.date === dateStr);
|
||||
if (found.difference != 0) {
|
||||
if (found.difference > 0) {
|
||||
row[dateStr] = found ? formatter.format(found.total) + "<p class='text-green-600 text-sm'> (+ " + found.difference + "%)</p>" : 0;
|
||||
row[dateStr] = found ? formatter.value.format(found.total) + "<p class='text-green-600 text-sm'> (+ " + found.difference + "%)</p>" : 0;
|
||||
} else {
|
||||
row[dateStr] = found ? formatter.format(found.total) + "<p class='text-red-500 text-sm'> (" + found.difference + "%)</p>" : 0;
|
||||
row[dateStr] = found ? formatter.value.format(found.total) + "<p class='text-red-500 text-sm'> (" + found.difference + "%)</p>" : 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
row[dateStr] = found ? formatter.format(found.total) : 0;
|
||||
row[dateStr] = found ? formatter.value.format(found.total) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user