Economia Acumulada:R${parseFloat(value).toLocaleString('pt-br',{currency: 'BRL', minimumFractionDigits: 2, maximumFractionDigits: 2})}
}
diff --git a/src/components/graph/cativoXLivreChart/index.tsx b/src/components/graph/cativoXLivreChart/index.tsx
index 087aeff..ebbc830 100644
--- a/src/components/graph/cativoXLivreChart/index.tsx
+++ b/src/components/graph/cativoXLivreChart/index.tsx
@@ -13,6 +13,7 @@ import { Chart } from 'react-chartjs-2';
import { CativoXLivreChartView } from './CativoXLivreChartView';
import ChartTitle from '../ChartTitle';
import pattern from 'patternomaly'
+import { config } from '../config';
ChartJS.register(
LinearScale,
@@ -76,62 +77,7 @@ export function CativoXLivreChart({ title, subtitle, chartData, label, dataset1,
const labels = label
- const options: any = {
- responsive: true,
- scales: {
- x: {
- grid: {
- display: false
- },
- ticks: {
- font: {
- size: !miniature? window.innerWidth/90 : window.innerWidth/110
- }
- },
- },
- y: {
- grid: {
- display: false
- },
- ticks: {
- font: {
- size: !miniature? window.innerWidth/90 : window.innerWidth/110
- }
- },
- },
- },
- plugins: {
- datalabels: {
- display: true,
- color: '#255488',
- // backgroundColor: '#255488',
- anchor: "end",
- offset: -20,
- align: "start",
- font: {
- weight: 'bold',
- size: !miniature? window.innerWidth/80 : window.innerWidth/105
- },
- formatter: (value, ctx) => {
- let sum = 0;
- const dataArr = ctx.chart.data.datasets[0].data;
- dataArr.map(data => {
- sum += data;
- });
- const result = `${(parseInt(value)).toLocaleString('pt-br')}`
-
- return value==null? null : result
- }
- },
- legend: {
- position: 'bottom' as const,
- },
- title: {
- display: true,
- text: '',
- },
- },
- };
+ const options: any = config(miniature)
const data: any = {
labels,
diff --git a/src/components/graph/costIndicatorChart/index.tsx b/src/components/graph/costIndicatorChart/index.tsx
index bb5d02b..a1c7ed8 100644
--- a/src/components/graph/costIndicatorChart/index.tsx
+++ b/src/components/graph/costIndicatorChart/index.tsx
@@ -15,7 +15,6 @@ import {
import { CostIndicatorChartView } from './CostIndicatorChartView';
import ChartTitle from '../ChartTitle';
-import { Stack } from '@mui/material';
import { config } from '../config';
ChartJS.register(
@@ -43,7 +42,8 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
const options: any = config(miniature)
- console.log(data1?.map(value => value))
+ console.log(data1)
+ console.log(data2)
const data = {
labels,
@@ -51,7 +51,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
{
label: '2021',
data: data1?.map(value => value),
- skipNull: true,
+ skipNull: data2?.map(value => value)?.includes(null),
borderRadius: 8,
datalabels: {
backgroundColor: 'white',
@@ -68,8 +68,8 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
},
{
label: '2022',
- data: data2?.map(value => value?.custo_unit),
- skipNull: true,
+ data: data2?.map(value => value),
+ skipNull: data1?.map(value => value)?.includes(null),
borderRadius: 8,
backgroundColor: (value, ctx) => {
if (value?.dad_estimado)
diff --git a/src/components/graph/grossAnualChart/GrossAnualChart.tsx b/src/components/graph/grossAnualChart/GrossAnualChart.tsx
index a2899ff..dcf360a 100644
--- a/src/components/graph/grossAnualChart/GrossAnualChart.tsx
+++ b/src/components/graph/grossAnualChart/GrossAnualChart.tsx
@@ -86,7 +86,7 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
align: "start",
font: {
weight: 'bold',
- size: !miniature? window.innerWidth/70 : window.innerWidth/90,
+ size: !miniature? window.innerWidth/80 : window.innerWidth/105,
},
color: (value) => {
return value.dataset.label==='Consolidada'? '#fff' : '#255488'
diff --git a/src/components/graph/grossMensalChart/GrossMensalChart.tsx b/src/components/graph/grossMensalChart/GrossMensalChart.tsx
index 31dc901..ca611be 100644
--- a/src/components/graph/grossMensalChart/GrossMensalChart.tsx
+++ b/src/components/graph/grossMensalChart/GrossMensalChart.tsx
@@ -17,6 +17,7 @@ import { draw, generate } from 'patternomaly'
import { GrossMensalChartView } from './GrossMensalChartView';
import ChartTitle from '../ChartTitle';
+import { config } from '../config';
// import { data } from './LineBarChart';
ChartJS.register(
@@ -58,71 +59,16 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle,
}
}, [data1])
- const options: any = {
- responsive: true,
- scales: {
- x: {
- grid: {
- display: false
- },
- ticks: {
- font: {
- size: !miniature? window.innerWidth/90 : window.innerWidth/110
- }
- },
- },
- y: {
- grid: {
- display: false
- },
- ticks: {
- font: {
- size: !miniature? window.innerWidth/90 : window.innerWidth/110
- }
- },
- },
- },
- plugins: {
- datalabels: {
- display: true,
- color: '#255488',
- formatter: (value, ctx) => {
- let sum = 0;
- const dataArr = ctx.chart.data.datasets[0].data;
- dataArr.map(data => {
- sum += data;
- });
- const percentage = data1[ctx.dataIndex]?.econ_percentual? (data1[ctx.dataIndex].econ_percentual*100).toFixed(0)+"%" : '';
- const result = `${spacement(parseInt(value+3).toLocaleString('pt-br'))}${parseInt(value)!=0? percentage : ''}\n${parseInt(value)!=0? parseInt(value).toLocaleString('pt-br') : ''}`
-
- return value==null? null : result
- },
- anchor: "end",
- offset: 0,
- align: "end",
- font: {
- weight: 'bold',
- size: !miniature? window.innerWidth/80 : window.innerWidth/120,
- }
- },
- legend: {
- position: 'bottom' as const,
-
- },
- title: {
- display: true,
- text: ''
- },
- },
- };
+ const options: any = config(miniature)
const data: any = {
- labels: data1.map(value => value.mes),
+ labels: label,
datasets: [
{
type: 'bar',
label: 'Consolidado',
data: data1.map(value => !value.dad_estimado? value?.economia_acumulada : null),
+ skipNull: true,
borderRadius: 8,
backgroundColor: '#255488',
stack: '0'
@@ -131,6 +77,7 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle,
type: 'bar',
label: 'Estimado',
data: data2.map(value => value.dad_estimado? value?.economia_acumulada : null),
+ skipNull: true,
borderRadius: 8,
backgroundColor: draw('diagonal-right-left', '#C2d5fb'),
stack: '0'
diff --git a/src/pages/dashboard/index.tsx b/src/pages/dashboard/index.tsx
index e622c77..8b78a6a 100644
--- a/src/pages/dashboard/index.tsx
+++ b/src/pages/dashboard/index.tsx
@@ -105,9 +105,9 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal