diff --git a/app/spa/src/components/charts/LineChart.tsx b/app/spa/src/components/charts/LineChart.tsx index c5861da04..74489ae15 100644 --- a/app/spa/src/components/charts/LineChart.tsx +++ b/app/spa/src/components/charts/LineChart.tsx @@ -3,7 +3,7 @@ import { LegendAnchor, LegendDirection } from "@nivo/legends" import { Box } from "@mui/material" export const normalizeCfdData = (data: Serie[]): Serie[] => - data.map((step, stepIndex) => ({ + data?.map((step, stepIndex) => ({ ...step, data: step.data?.map((dot, index) => { const previousY: number = @@ -15,7 +15,7 @@ export const normalizeCfdData = (data: Serie[]): Serie[] => y: newY, } }), - })) + })) || [] export type LineChartProps = { data: Serie[] diff --git a/app/spa/src/pages/Projects/Statistics.tsx b/app/spa/src/pages/Projects/Statistics.tsx index 670c81933..a5cca6729 100644 --- a/app/spa/src/pages/Projects/Statistics.tsx +++ b/app/spa/src/pages/Projects/Statistics.tsx @@ -64,15 +64,15 @@ const Statistics = () => { const leadTimeAmplitudeVariationDataGraph = [ { id: "Amplitude Total do Lead Time", - data: totalLeadTimeMonthRange!, + data: totalLeadTimeMonthRange || [], }, { id: "Lead Time menor", - data: shorterLeadTimeMonth!, + data: shorterLeadTimeMonth || [], }, { id: "Lead Time maior", - data: longerLeadTimeMonth!, + data: longerLeadTimeMonth || [], }, ] @@ -106,15 +106,15 @@ const Statistics = () => { const leadTimeAmplitudeHistogramDataGraph = [ { id: "Amplitude Total", - data: amplitudeTotalHistogram!, + data: amplitudeTotalHistogram || [], }, { id: "Bin Min", - data: amplitudeBinMinHistogram!, + data: amplitudeBinMinHistogram || [], }, { id: "Bin Max", - data: amplitudeBinMaxHistogram!, + data: amplitudeBinMaxHistogram || [], }, ] @@ -148,15 +148,15 @@ const Statistics = () => { const leadTimeAmplitudeInterquartileDataGraph = [ { id: "Amplitude Total", - data: amplitudeTotalInterquartile!, + data: amplitudeTotalInterquartile || [], }, { id: "Percentil 25", - data: amplitudePercentile25Interquartile!, + data: amplitudePercentile25Interquartile || [], }, { id: "Percentil 75", - data: amplitudePercentile75Interquartile!, + data: amplitudePercentile75Interquartile || [], }, ]