fixing bar position on charts(coastIndicator, cativoxlivre)

This commit is contained in:
joseCorte-exe 2022-08-12 11:09:15 -03:00
parent dfdbf1ab16
commit d792f468da
3 changed files with 8 additions and 9 deletions

View File

@ -156,9 +156,9 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
if (!value.dad_estimado) if (!value.dad_estimado)
return parseInt(value.custo_cativo) return parseInt(value.custo_cativo)
}), }),
skipNull: true,
borderRadius: 8, borderRadius: 8,
backgroundColor: '#C2D5FB', backgroundColor: '#C2D5FB',
stack: 'cativo'
}, },
{ {
type: 'bar' as const, type: 'bar' as const,
@ -167,9 +167,9 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
if (!value.dad_estimado) if (!value.dad_estimado)
return parseInt(value.custo_livre) return parseInt(value.custo_livre)
}), }),
skipNull: true,
borderRadius: 8, borderRadius: 8,
backgroundColor: '#255488', backgroundColor: '#255488',
stack: 'livre'
}, },
{ {
type: 'bar', type: 'bar',
@ -178,9 +178,9 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
if (value.dad_estimado) if (value.dad_estimado)
return parseInt(value.custo_cativo) return parseInt(value.custo_cativo)
}), }),
skipNull: true,
borderRadius: 8, borderRadius: 8,
backgroundColor: pattern.draw('diagonal', '#C2D5FB'), backgroundColor: pattern.draw('diagonal', '#C2D5FB'),
stack: 'cativo'
}, },
{ {
type: 'bar', type: 'bar',
@ -189,9 +189,9 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
if (value.dad_estimado) if (value.dad_estimado)
return parseInt(value.custo_livre) return parseInt(value.custo_livre)
}), }),
skipNull: true,
borderRadius: 8, borderRadius: 8,
backgroundColor: pattern.draw('diagonal', '#255488'), backgroundColor: pattern.draw('diagonal', '#255488'),
stack: 'livre'
} }
], ],
} }

View File

@ -15,6 +15,7 @@ import {
import { CostIndicatorChartView } from './CostIndicatorChartView'; import { CostIndicatorChartView } from './CostIndicatorChartView';
import ChartTitle from '../ChartTitle'; import ChartTitle from '../ChartTitle';
import { Stack } from '@mui/material';
ChartJS.register( ChartJS.register(
CategoryScale, CategoryScale,
@ -43,7 +44,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
responsive: true, responsive: true,
scales: { scales: {
x: { x: {
// stacked: false, stacked: false,
grid: { grid: {
display: false display: false
}, },
@ -104,6 +105,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
label: '2021', label: '2021',
data: data1?.map(value => value.custo_unit>0? value.custo_unit : null), data: data1?.map(value => value.custo_unit>0? value.custo_unit : null),
borderRadius: 8, borderRadius: 8,
skipNull: true,
datalabels: { datalabels: {
backgroundColor: 'white', backgroundColor: 'white',
borderRadius: 8, borderRadius: 8,
@ -116,11 +118,11 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
else else
return '#C2d5fb' return '#C2d5fb'
}, },
stack: '0'
}, },
{ {
label: '2022', label: '2022',
data: data2?.map(value => value.custo_unit>0? value.custo_unit : null), data: data2?.map(value => value.custo_unit>0? value.custo_unit : null),
skipNull: true,
borderRadius: 8, borderRadius: 8,
backgroundColor: (value, ctx) => { backgroundColor: (value, ctx) => {
if (value.dad_estimado) if (value.dad_estimado)
@ -128,7 +130,6 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
else else
return '#255488' return '#255488'
}, },
stack: '0'
} }
], ],
} }

View File

@ -1,6 +1,4 @@
import { ReactJSXElement } from '@emotion/react/types/jsx-namespace';
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import Modal from '@mui/material/Modal'; import Modal from '@mui/material/Modal';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import * as React from 'react'; import * as React from 'react';