feat: coast indicator chart
This commit is contained in:
parent
682181d130
commit
bd306e856d
@ -33,9 +33,10 @@ interface ChartInterface {
|
||||
single?: any
|
||||
label: any,
|
||||
miniature?: boolean | undefined
|
||||
years?: string[]
|
||||
}
|
||||
|
||||
export default function CostIndicatorChart({ title, data1, data2, label, subtitle, miniature }: ChartInterface) {
|
||||
export default function CostIndicatorChart({ title, data1, data2, label, subtitle, miniature, years }: ChartInterface) {
|
||||
|
||||
const labels = label;
|
||||
|
||||
@ -47,7 +48,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: new Date().getFullYear() - 1,
|
||||
label: years[0],
|
||||
data: data1?.map(value => value),
|
||||
skipNull: data2?.map(value => value)?.includes(null),
|
||||
borderRadius: 8,
|
||||
@ -65,7 +66,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
|
||||
},
|
||||
},
|
||||
{
|
||||
label: new Date().getFullYear(),
|
||||
label: years[1],
|
||||
data: data2?.map(value => value),
|
||||
skipNull: data1?.map(value => value)?.includes(null),
|
||||
borderRadius: 8,
|
||||
|
||||
@ -140,6 +140,7 @@ export default function Dashboard({ grossAnualGraph, grossAnualYears, grossMensa
|
||||
<CostIndicatorChart title='' subtitle=''
|
||||
data1={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes(costIndicator[0].mes.slice(0, 4))).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)}
|
||||
data2={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes(costIndicator[costIndicator.length - 1].mes.slice(0, 4))).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)}
|
||||
years={[costIndicator[0].mes.slice(0, 4), costIndicator[costIndicator.length - 1].mes.slice(0, 4)]}
|
||||
label={months}
|
||||
miniature
|
||||
/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user