correcoes
This commit is contained in:
parent
98e5bf4b5e
commit
7250acbe4e
@ -1,5 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
import { draw, generate } from 'patternomaly'
|
||||
|
||||
import { Bar, Line } from 'react-chartjs-2';
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
@ -54,9 +56,7 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
plugins: {
|
||||
datalabels: {
|
||||
display: true,
|
||||
color: (value, ctx) => {
|
||||
return value.dataset.label==='2021'? 'black' : 'white'
|
||||
},
|
||||
color: 'black',
|
||||
formatter: (value, ctx) => {
|
||||
let sum = 0;
|
||||
const dataArr = ctx.chart.data.datasets[0].data;
|
||||
@ -67,13 +67,10 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
|
||||
return value==null? null : result
|
||||
},
|
||||
anchor: "start",
|
||||
offset: 20,
|
||||
anchor: "end",
|
||||
align: "end",
|
||||
rotation: -90,
|
||||
font: {
|
||||
size: !miniature? 15 : 10,
|
||||
weight: !miniature? 800 : 100
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
@ -93,12 +90,16 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
{
|
||||
label: dataset1? dataset1 : '2021',
|
||||
data: data1.map(value => value.custo_unit),
|
||||
backgroundColor: '#C2D5FB',
|
||||
backgroundColor: (value, ctx) => {
|
||||
return data1[value.dataIndex]?.dad_estimado == false ? '#255488' : draw('diagonal-right-left', '#C2d5fb');
|
||||
},
|
||||
},
|
||||
{
|
||||
label: dataset2? dataset2 : '2022',
|
||||
data: data2.map(value => value.custo_unit),
|
||||
backgroundColor: '#255488',
|
||||
backgroundColor: (value, ctx) => {
|
||||
return data2[value.dataIndex]?.dad_estimado == false ? '#255488' : draw('diagonal-right-left', '#C2d5fb');
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
import { Bar, Line } from 'react-chartjs-2';
|
||||
import {
|
||||
@ -11,9 +11,9 @@ import {
|
||||
Legend
|
||||
} from 'chart.js'
|
||||
|
||||
import faker from 'faker'
|
||||
import { draw, generate } from 'patternomaly'
|
||||
|
||||
import { ChartView } from './ChartView';
|
||||
import RenderIf from '../../utils/renderIf';
|
||||
import ChartTitle from './ChartTitle';
|
||||
// import { data } from './LineBarChart';
|
||||
|
||||
@ -92,14 +92,17 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
||||
{
|
||||
label: dataset1? dataset1 : '2021',
|
||||
data: data1.map(value => value.economia_acumulada? value.economia_acumulada : 0),
|
||||
backgroundColor: '#255488',
|
||||
backgroundColor: (value, ctx) => {
|
||||
return data2[value.dataIndex]?.dad_estimado == false ? '#255488' : draw('diagonal-right-left', '#C2d5fb');
|
||||
},
|
||||
},
|
||||
data2?
|
||||
{
|
||||
label: dataset2? dataset2 : '2022',
|
||||
data: data2.map(value => value.economia_acumulada? value.economia_acumulada : 0),
|
||||
backgroundColor: '#C2D5FB',
|
||||
} : null
|
||||
backgroundColor: (value, ctx) => {
|
||||
return data2[value.dataIndex]?.dad_estimado == false ? '#255488' : draw('diagonal-right-left', '#C2d5fb');
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ export function SingleBar({ title, subtitle, dataProps, label, dataset, barLabel
|
||||
return parseFloat(value.economia_acumulada).toFixed(2)
|
||||
}),
|
||||
backgroundColor: (value, ctx) => {
|
||||
return dataProps[value.dataIndex]?.dad_estimado == false ? '#255488' : '#C2d5fb'
|
||||
return dataProps[value.dataIndex]?.dad_estimado == false ? '#255488' : draw('diagonal-right-left', '#C2d5fb');
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@ export default class MyDocument extends Document {
|
||||
return (
|
||||
<Html>
|
||||
<Head>
|
||||
|
||||
<meta charSet="UTF-8"/>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"/>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin='true' />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap" rel="stylesheet"/>
|
||||
|
||||
@ -61,27 +61,27 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal
|
||||
</Link>
|
||||
|
||||
<section className='dashboard'>
|
||||
<GraphCard title='Economia Bruta Anual' subtitle='Economia Bruta Estimada e Acumulada Anual - (Valores em R$ mil)'>
|
||||
<GraphCard title='Economia Bruta Anual' subtitle='Economia Bruta Estimada e Acumulada Anual - Valores em R$ mil'>
|
||||
<SingleBar title='' subtitle=''
|
||||
dataset='Consolidada'
|
||||
dataProps={grossAnualGraph}
|
||||
label={grossAnualYears} barLabel miniature/>
|
||||
</GraphCard>
|
||||
|
||||
<GraphCard title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada Mensal - (Valores em R$)' singleBar>
|
||||
<GraphCard title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada Mensal - Valores em R$ mil' singleBar>
|
||||
<Chart2 title='' subtitle=''
|
||||
data1={grossMensalGraph.filter((value, index) => value.mes.slice(3, 8).includes('2021'))}
|
||||
data2={grossMensalGraph.filter((value, index) => value.mes.slice(3, 8).includes('2022'))}
|
||||
label={months} miniature/>
|
||||
</GraphCard>
|
||||
|
||||
<GraphCard title='Cativo x Livre Mensal' subtitle='Comparativo de Custo Estimado - (Valores em R$/MWh)' singleBar>
|
||||
<GraphCard title='Cativo x Livre Mensal' subtitle='Comparativo de Custo Estimado - Valores em R$ mil' singleBar>
|
||||
<LineBarChart2 data1={acumulatedGraph} data2={acumulatedGraph} data3={acumulatedGraph}
|
||||
label={ConsumoEstimado.label} dataset1='Custo' dataset2='Cativo' dataset3='Livre'
|
||||
title='' subtitle='' barLabel hashurado miniature/>
|
||||
</GraphCard>
|
||||
|
||||
<GraphCard title='Indicador de Custo' subtitle='Valores em R$/ MWh'>
|
||||
<GraphCard title='Indicador de Custo' subtitle='Indicador de Custo - Valores em R$/MWh'>
|
||||
<Chart title='' subtitle=''
|
||||
data1={costIndicator.filter((value, index) => value.mes.slice(4, 8).includes('2021'))}
|
||||
// data1={graphData}
|
||||
|
||||
@ -130,13 +130,13 @@ export default function pld({tableData, userName, clientMonth}: pldInterface) {
|
||||
|
||||
function handleColorNorte(value, region) {
|
||||
if (value <= tableData.result[1].norte_min)
|
||||
return 'green'
|
||||
return ''
|
||||
else if (value >= tableData.result[0][`${region}_max`])
|
||||
return 'red'
|
||||
return ''
|
||||
else if (tableData.result[0][`${region}_max`] - value > tableData.result[0][`${region}_max`]/2)
|
||||
return 'dullGreen'
|
||||
return ''
|
||||
else if (tableData.result[1][`${region}_min`] - value <= tableData.result[1][`${region}_min`])
|
||||
return 'dullRed'
|
||||
return ''
|
||||
}
|
||||
|
||||
function downloadCSVFile(csv, filename) {
|
||||
|
||||
@ -147,7 +147,12 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
tableDataState.map((value, index) => {
|
||||
tableDataState.sort((a, b) => {
|
||||
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
||||
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
||||
|
||||
return 0
|
||||
}).map((value, index) => {
|
||||
return <>
|
||||
<tr>
|
||||
<td key={index} className='tg-gceh'>{value.mes}</td>
|
||||
|
||||
@ -56,12 +56,15 @@ export const TableView = styled.div`
|
||||
word-break:normal;
|
||||
}
|
||||
.tg .tg-8oo6{
|
||||
color:#464a53;
|
||||
font-size:13px;
|
||||
font-size:14px;
|
||||
text-align:center;
|
||||
vertical-align:top;
|
||||
padding: 10px 18px;
|
||||
text-align: center;
|
||||
|
||||
color: white;
|
||||
|
||||
background-color: #254F7F;
|
||||
}
|
||||
.tg .tg-uulg{
|
||||
background-color:#efefef;
|
||||
|
||||
@ -39,11 +39,15 @@ export const PldTableView = styled.main`
|
||||
word-break:normal;
|
||||
}
|
||||
.tg .tg-8oo6{
|
||||
font-size:13px;
|
||||
font-size:20px;
|
||||
text-align:center;
|
||||
vertical-align:top;
|
||||
padding: 10px 18px;
|
||||
text-align: center;
|
||||
|
||||
color: white;
|
||||
|
||||
background-color: #254F7F;
|
||||
}
|
||||
.tg .tg-uulg{
|
||||
background-color:#efefef;
|
||||
|
||||
@ -4008,6 +4008,7 @@ path-type@^4.0.0:
|
||||
patternomaly@^1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/patternomaly/-/patternomaly-1.3.2.tgz#70b8db17d7318ab1471cc43f94011bb866c54d09"
|
||||
integrity sha512-70UhA5+ZrnNgdfDBKXIGbMHpP+naTzfx9vPT4KwIdhtWWs0x6FWZRJQMXXhV2jcK0mxl28FA/2LPAKArNG058Q==
|
||||
|
||||
pdfjs-dist@^2.7.570:
|
||||
version "2.14.305"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user