Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,26 @@ export const MultilineUtilizationItem = memo<MultilineUtilizationItemProps>(
}, [maxDate, updateEndDate]);

const mapTranslatedData = (originalData: DataPoint[][]) => {
if (!originalData || originalData.length === 0 || originalData[0].length === 0)
return originalData;
if (!originalData || originalData.length === 0) return originalData;
const translatedData = [];

for (const query of originalData) {
const currData = [];
const desc = query[0].description;
for (const item of query) {
if (desc === 'in') {
currData.push({ ...item, description: t('in') });
} else if (desc === 'out') {
currData.push({ ...item, description: t('out') });
} else {
currData.push(item);
if (!query || query.length === 0) {
translatedData.push(query);
} else {
const currData = [];
const desc = query[0].description;
for (const item of query) {
if (desc === 'in') {
currData.push({ ...item, description: t('in') });
} else if (desc === 'out') {
currData.push({ ...item, description: t('out') });
} else {
currData.push(item);
}
}
translatedData.push(currData);
}
translatedData.push(currData);
}
return translatedData;
};
Expand Down
8 changes: 4 additions & 4 deletions frontend/public/components/graphs/area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export const AreaChart: FC<AreaChartProps> = ({
const container = useMemo(() => {
if (multiLine) {
const legendData = processedData.map((d) => ({
childName: d[0].description,
name: d[0].description,
symbol: d[0].symbol,
childName: d[0]?.description,
name: d[0]?.description,
symbol: d[0]?.symbol,
}));
return (
<CursorVoronoiContainer
Expand All @@ -127,7 +127,7 @@ export const AreaChart: FC<AreaChartProps> = ({
stack={showAllTooltip}
legendData={legendData}
getLabel={getLabel}
formatDate={(d) => formatDate(d[0].x)}
formatDate={(d) => formatDate(d[0]?.x)}
mainDataName={mainDataName}
/>
}
Expand Down