diff --git a/src/components/BottomTableComponent.js b/src/components/BottomTableComponent.js index 3622f8cceace2c61f1c8d106785780ef415747a3..783c0eedc15622366fdc842d2ebc8cdd1885a074 100644 --- a/src/components/BottomTableComponent.js +++ b/src/components/BottomTableComponent.js @@ -108,7 +108,7 @@ function BottomTableComponent(props) { const evadido = tableData.reduce((sum, item) => sum + item.evadido, 0) const trancado = tableData.reduce((sum, item) => sum + item.trancado, 0) const concluinte = tableData.reduce((sum, item) => sum + item.concluinte, 0) - const taxaEvasao = ((evadido/(cursando+concluinte+evadido+trancado))*100).toFixed(2) + const taxaEvasao = ((cursando + concluinte + evadido + trancado) > 0) ? ((evadido/(cursando+concluinte+evadido+trancado))*100).toFixed(2) : 0 const totalObjectSituation = { cursando: cursando, diff --git a/src/components/Charts/BarChartComponent.js b/src/components/Charts/BarChartComponent.js index c950eec7293a6c9f73fb7afd5e30ccc21dc24af7..3cd292b3d1c8e99be4e0342a093ebd7b99c884c2 100644 --- a/src/components/Charts/BarChartComponent.js +++ b/src/components/Charts/BarChartComponent.js @@ -35,7 +35,7 @@ function BarChartComponent(props) { // const { title, data, education } = props; const { title, years, chartLocation, dimension_data, dims, loading, filtersLocation, filtersEducation, disciplines, contrastSet, horizontalChart } = props; - + // const [yearsString, setYearsString] = useState(""); const [selectedFilters, setSelectedFilters] = useState([]); const [isOpen, setIsOpen] = useState(false); const [noDataComponentToggle, setNoDataComponentToggle] = useState(false); @@ -207,7 +207,6 @@ function BarChartComponent(props) { formattedFilters + ', ' + mappedFilters[idx][jdx] } } - setSelectedFilters(formattedFilters) }, [filtersEducation]) @@ -430,7 +429,7 @@ function BarChartComponent(props) { } for (i = 0; i < size; i++) { if (location.pathname === routes.adequacao_disciplina) { - newSeries[i].data[i] = ((suitable[i] / total[i]) * 100).toFixed(1) + newSeries[i].data[i] = total[i] !== 0 ? ((suitable[i] / total[i]) * 100).toFixed(1) : 0 } else { newSeries[i].data[i] = total[i] - suitable[i] } @@ -463,6 +462,15 @@ function BarChartComponent(props) { // eslint-disable-next-line react-hooks/exhaustive-deps }, [loading, filtersLocation, contrastSet]); + function generateSubtitle() { + let data = props.data; + let tempString = `${chartLocation} - ` + tempString = tempString.concat(`${data[0].year} a ${data[data.length - 1].year}`) + + return tempString; + } + + return ( <> { loading ? @@ -476,9 +484,10 @@ function BarChartComponent(props) { : <div className={`bar-chart-container ${contrastSet ? "high-contrast-bar-chart" : ""}`}> { - years[0] === years[1] ? - <h4 className="bar-chart-subtitle">{`${chartLocation} - ${years[0]}`}</h4> : - <h4 className="bar-chart-subtitle">{`${chartLocation} - ${years[0]} a ${years[1]}`}</h4> + // years[0] === years[1] ? + // <h4 className="bar-chart-subtitle">{`${chartLocation} - ${years[0]}`}</h4> : + // <h4 className="bar-chart-subtitle">{`${chartLocation} - ${years[0]} a ${years[1]}`}</h4> + <h4 className="bar-chart-subtitle">{ generateSubtitle() }</h4> } { selectedFilters !== '' && diff --git a/src/components/Map/LegendComponent.js b/src/components/Map/LegendComponent.js index 831ab2d20aed25e167dc4d08da68c37df6c04028..548c320c947282948622dfd0900d0cf90dafacb2 100644 --- a/src/components/Map/LegendComponent.js +++ b/src/components/Map/LegendComponent.js @@ -51,6 +51,7 @@ class LegendComponent extends MapControl { componentDidMount() { this.legend = L.control({ position: "bottomright" }); + this.legend.update = () => { let title = '<h4 class="legend-title">' if (this.props.title) diff --git a/src/components/Map/MapComponent.js b/src/components/Map/MapComponent.js index b8570323940bec04cd9f6e1f727c55a3a08e5538..091f35e0eb11388ef170dc4bf5b237d4e57e9fa5 100644 --- a/src/components/Map/MapComponent.js +++ b/src/components/Map/MapComponent.js @@ -421,7 +421,7 @@ function MapComponent(props) { titleValue = finishedDataObj.length !== 0 ? finishedDataObj[0].total.toLocaleString('pt-BR') : '0' } else if (path[4] === 'situacao_ingressantes') { const maxYearDataObj = mapTitleData.filter(item => item.year === titleYear) - percentEvaded = maxYearDataObj.length !== 0 ? maxYearDataObj[0].taxa_evasao.toFixed(1) : 0 + percentEvaded = maxYearDataObj.length !== 0 ? maxYearDataObj[0]?.taxa_evasao?.toFixed(1) : 0 if (percentEvaded === '0.0') percentEvaded = 0 } else if (path[4] === 'situacao_matriculas') { const maxYearDataObj = mapTitleData.filter(item => item.year === titleYear) @@ -462,6 +462,8 @@ function MapComponent(props) { case 'concluintes_licenciatura': return titleLocation + ' tem ' + titleValue + ' concluintes em cursos de licenciatura, ' + titleYear case 'situacao_ingressantes': + if (percentEvaded === undefined) + percentEvaded = 0; return titleLocation + ' tem ' + percentEvaded + '% de evasão em cursos de licenciatura, ' + titleYear case 'situacao_matriculas': return titleLocation + ' tem ' + maxYearCoursing + ' matrÃculas cursando, ' + maxYearEvaded + ' evadidos, ' +