Skip to content

Commit b8d13bc

Browse files
committed
fix: chart and tooltip for values of null
For example for `proposal efficiency` or `sync efficiency` values can also be `null`. In the chart there should not be a value (instead of `0`) and in tooltip there shouldn't be `percentage calculation`. See: BEDS-1548
1 parent d60e318 commit b8d13bc

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

frontend/.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"BcTooltip",
1616
"DashboardChartSummary",
1717
"DashboardChartSummaryFilter",
18+
"DashboardChartSummaryTooltip",
1819
"DashboardGroupManagementModal",
1920
"DashboardSlotViz",
2021
"DashboardTableClDeposits",

frontend/components/dashboard/chart/DashboardChartRewards.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const elSeriesGroupTotal = computed(() => {
180180
{ value },
181181
{
182182
sourceCurrency: elCurrency,
183-
value: group.data[index],
183+
value: group.data[index] ?? 0,
184184
},
185185
],
186186
})
@@ -279,7 +279,7 @@ const getGroupInfo = (series: ChartSeries<number, string>[], currentIndex: numbe
279279
return {
280280
id,
281281
name: groups.value.find(group => group.id === id)?.name ?? '',
282-
value: data[currentIndex] === '0'
282+
value: data[currentIndex] === '0' || data[currentIndex] === null
283283
? '-'
284284
: formatAmount(data[currentIndex], {
285285
hasCurrencyDisplay: true,
@@ -292,7 +292,7 @@ const getGroupInfo = (series: ChartSeries<number, string>[], currentIndex: numbe
292292
return {
293293
id,
294294
name: groups.value.find(group => group.id === id)?.name ?? '',
295-
value: data[currentIndex] === '0'
295+
value: data[currentIndex] === '0' || data[currentIndex] === null
296296
? '-'
297297
: formatAmount(data[currentIndex], {
298298
hasCurrencyDisplay: true,

frontend/components/dashboard/chart/DashboardChartSummary.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ const loadData = async () => {
208208
name = getGroupLabel($t, element.id, groups.value, allGroups)
209209
}
210210
211-
const data = element.data.map(datapoint => datapoint !== undefined ? datapoint * 100 : undefined)
211+
const data = element.data.map(datapoint => datapoint === null
212+
? null
213+
: datapoint * 100,
214+
)
212215
213216
const newObj: SeriesOption = {
214217
connectNulls: false,

frontend/components/dashboard/chart/DashboardChartSummaryTooltip.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ defineProps<Props>()
4646
<div class="name">
4747
{{ entry.name }}:
4848
</div>
49+
<span v-if="typeof entry.efficiency !== 'number'">
50+
-
51+
</span>
4952
<BaseFormatPercent
53+
v-else
5054
class="efficiency"
5155
:value="entry.efficiency / 100"
5256
/>

0 commit comments

Comments
 (0)