))}
@@ -94,10 +64,47 @@ class MobileTableComponent extends Component {
}
MobileTableComponent.propTypes = {
- modelId: PropTypes.string.isRequired,
+ modelID: PropTypes.string.isRequired,
productName: PropTypes.string.isRequired,
modelName: PropTypes.string.isRequired,
tableKey: PropTypes.string.isRequired
};
export default MobileTableComponent;
+
+/**
+ * Makes life a little bit easier, and developers a little bit happier.
+ * (By translating the row data to column data for the Mobile component)
+ *
+ * @param {*} idKey - allows unique id to be generated
+ * @param {number} rowIndex - the index of the current row
+ * @param rows - the rowdata that will be accesed
+ * @returns the
element of the corresponding row
+ */
+function getRowDataHelper(idKey, rowIndex, rows) {
+ switch (rowIndex) {
+ case 0:
+ return
{'Global Warming'}
;
+ case 1:
+ return (
+
+ {'kg CO'}
+ 2
+ {' eq'}{' '}
+
+ );
+ case 2:
+ return
{rows.get('Total')}
;
+
+ case 3:
+ return
{rows.get('Materials')}
;
+ case 4:
+ return
{rows.get('Manufacturing and Transportation')}
;
+ case 5:
+ return
{rows.get('Operation')}
;
+ case 6:
+ return
{rows.get('End of life')}
;
+ default:
+ return
;
+ }
+}
diff --git a/frontend/src/components/details/NavbarComponent.js b/frontend/src/components/details/NavbarComponent.js
index a2664f91..b576c52e 100644
--- a/frontend/src/components/details/NavbarComponent.js
+++ b/frontend/src/components/details/NavbarComponent.js
@@ -8,7 +8,6 @@ import { useHistory } from 'react-router-dom';
* a divider Pannel for seperating search compoents and result components
* and also providing the comparison feature by compare button
*
- * @author Parham Gandomkar, Irem Toroslu, Julian Oelhaf, Mani Anand
*/
const NavbarComponent = (props) => {
const history = useHistory();
@@ -19,7 +18,7 @@ const NavbarComponent = (props) => {
history.goBack()}>
-
+
diff --git a/frontend/src/components/details/PanelComponent.jsx b/frontend/src/components/details/PanelComponent.jsx
index 3a91d725..278835ce 100644
--- a/frontend/src/components/details/PanelComponent.jsx
+++ b/frontend/src/components/details/PanelComponent.jsx
@@ -6,7 +6,6 @@ import slugs from 'resources/slugs';
* a divider Pannel for seperating search compoents and result components
* and also providing the comparison feature by compare button
*
- * @author Parham Gandomkar, Irem Toroslu, Julian Oelhaf
*/
const PanelComponent = (props) => {
diff --git a/frontend/src/components/details/PieChartComponent.jsx b/frontend/src/components/details/PieChartComponent.jsx
index 17fcc291..60422544 100644
--- a/frontend/src/components/details/PieChartComponent.jsx
+++ b/frontend/src/components/details/PieChartComponent.jsx
@@ -1,20 +1,21 @@
-import React from 'react';
+import { React } from 'react';
import ReactApexChart from 'react-apexcharts';
import {
getMaterialCompositionData,
getMaterialCompositionLabels
} from 'interface/projectInterface';
-import theme from 'resources/theme';
-
+//import theme from 'resources/theme';
/**
* Pie Chart Diagram
- *
- * @author Parham Gandomkar, Julian Oelhaf, Irem Toroslu
*/
+
const PieChartComponent = () => {
const series = getMaterialCompositionData();
const labels = getMaterialCompositionLabels();
+ console.log(series);
+ console.log(labels);
+
const options = {
//TODO
maintainAspectRatio: true,
@@ -25,26 +26,26 @@ const PieChartComponent = () => {
chart: {
type: 'donut'
},
- pie: {
- expandOnClick: true
- },
+
labels: labels,
- // TODO: do the materials stay the same? otherwise doesn't make sense to use fixed color / hardcode them
- colors: [
- '#fae920',
- '#cfd6e3',
- '#eb8fa1',
- '#89b5c4',
- theme.color.Alminium,
- '#36a6c7',
- '#eb8323'
- ],
+ // TODO: color map
+ // fill: {
+ // colors: [
+ // '#fae920',
+ // '#cfd6e3',
+ // '#eb8fa1',
+ // '#89b5c4',
+ // theme.color.Alminium,
+ // '#36a6c7',
+ // '#eb8323'
+ // ]
+ // },
responsive: [
{
breakpoint: 6400,
options: {
chart: {
- height: '300px'
+ heigt: 'auto'
},
legend: {
position: 'bottom'
@@ -53,6 +54,8 @@ const PieChartComponent = () => {
}
]
};
+ //lassName='ChartItems' cause PieChart to overlap: needs to be fixed in charts_tables.css
+ // works fine if className is taken out
return (
diff --git a/frontend/src/components/details/ScenarioComponent.js b/frontend/src/components/details/ScenarioComponent.js
index cd6cdef2..e3e9d721 100644
--- a/frontend/src/components/details/ScenarioComponent.js
+++ b/frontend/src/components/details/ScenarioComponent.js
@@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import SelectVariableComponent from './SelectVariableComponent';
import NavbarComponent from './NavbarComponent';
-import PieChart from './PieChartComponent';
-import ColumnChart from './ColumnChartComponent';
+import PieChartComponent from './PieChartComponent';
+import ColumnChartComponent from './ColumnChartComponent';
import TableComponent from './TableComponent';
import { Col, Container, Row } from 'react-grid-system';
import { Hidden } from '@material-ui/core';
@@ -37,7 +37,7 @@ class ScenarioComponent extends Component {
Results of the impact assessment
-
+
Material Composition
-
+
@@ -63,7 +63,7 @@ class ScenarioComponent extends Component {
>
@@ -75,7 +75,7 @@ class ScenarioComponent extends Component {
@@ -94,7 +94,7 @@ ScenarioComponent.propTypes = {
onExportClick: PropTypes.func.isRequired,
scenarioName: PropTypes.string,
selectedProduct: PropTypes.shape({
- modelId: PropTypes.string,
+ modelID: PropTypes.string,
modelName: PropTypes.string,
productName: PropTypes.string
})
diff --git a/frontend/src/components/details/SelectVariableComponent.jsx b/frontend/src/components/details/SelectVariableComponent.jsx
index b2644354..4451af3e 100644
--- a/frontend/src/components/details/SelectVariableComponent.jsx
+++ b/frontend/src/components/details/SelectVariableComponent.jsx
@@ -3,7 +3,6 @@ import React, { Component } from 'react';
/**
* a drop down component for selecting variable
*
- * @author Parham Gandomkar, Irem Toroslu
*/
class SelectVariableComponent extends Component {
@@ -49,22 +48,18 @@ class SelectVariableComponent extends Component {
-
diff --git a/frontend/src/components/details/TableComponent.jsx b/frontend/src/components/details/TableComponent.jsx
index 0012bbf3..34f12b9f 100644
--- a/frontend/src/components/details/TableComponent.jsx
+++ b/frontend/src/components/details/TableComponent.jsx
@@ -3,16 +3,15 @@ import React, { Component } from 'react';
import { Container } from 'react-grid-system';
import {
getImpactCategoriesTableHeaders,
- getImpactCategoriesTableData
+ getImpactAssessmentData
} from 'interface/projectInterface';
-
/**
* displays the impact catagories table of the selected model of the related product.
*/
class TableComponent extends Component {
state = {
- headers: getImpactCategoriesTableHeaders(this.props.modelId),
- rows: getImpactCategoriesTableData(this.props.modelId)
+ headers: getImpactCategoriesTableHeaders(),
+ rows: getImpactAssessmentData()
};
render() {
const idKey = this.props.tableKey;
@@ -35,18 +34,23 @@ class TableComponent extends Component {
))}
+
- {this.state.rows.map((item, index) => (
-
-
{item.impactCategory}
-
{item.unit}
-
{item.total}
-
{item.materialsLPT}
-
{item.manufacturing}
-
{item.operations}
-
{item.endOfLife}
-
- ))}
+
+
{'Global Warming'}
+
+ {'kg CO'}
+ 2
+ {' eq'}{' '}
+
+
{this.state.rows.get('Total')}
+
{this.state.rows.get('Materials')}
+
+ {this.state.rows.get('Manufacturing and Transportation')}
+