Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes with FAQ page #186

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 60 additions & 12 deletions front-end/src/graphs/AreaChart.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
import React from 'react'
import Plot from 'react-plotly.js'
import createPlotlyComponent from 'react-plotlyjs';
//npm install react-plotlyjs
import React from 'react';
import Plotly from 'plotly.js/dist/plotly-cartesian';
const PlotlyComponent = createPlotlyComponent(Plotly);

const AreaChart = ({ data, xAxisAttribute, yAxisAttribute }) => {
console.log(data);

let xData = data.map((d) => {
if (d[xAxisAttribute] === undefined || d[xAxisAttribute] === 'NULL') {
return 'UNKOWN';
}
return d[xAxisAttribute];
});

let yData = data.map((d) => {
if (d[yAxisAttribute] === undefined || d[yAxisAttribute] === 'NULL') {
return 'UNKOWN';
}
return d[yAxisAttribute];
});
console.log(xData);
console.log(yData);
let dataKeys=[
{
fill: 'tozeroy',
type: 'scatter',
x: xData,
y: yData,
// x: [1, 2, 3, 4],
// y: [3, 5, 1, 7],
marker:{
color:'(16,32,77)'
}
},
{
fill: 'tonexty',
type: 'scatter',
x: xData,
y: yData,
// x: [1, 2, 3, 4],
// y: [0, 2, 3, 5],
}
];
let layout = {
autosize: true,
xaxis: { title: xAxisAttribute },
yaxis: { title: yAxisAttribute },
// yaxis: { title: 'Count' },
};
let config = {
showLink: false,
displayModeBar: true
};

function AreaChart() {
return (
<>
<div>
<h2 className="header-text">Area Chart </h2>
<div className="block">
<p className="full-text">TBH</p>
</div>
</div>
<PlotlyComponent className="" data={dataKeys} layout={layout} config={config}/>
</>
)
}
);

}
export default AreaChart;

export default AreaChart
33 changes: 33 additions & 0 deletions front-end/src/graphs/GraphDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import './GraphDisplay.css';
import { ChevronDownIcon } from '@heroicons/react/solid';
import { useState } from 'react';


//Main component that displays your created graph
//Components in React can be in the form of functions, classes etc.
//and consist of both javascript code and html code (html is the return value)
Expand All @@ -26,6 +27,9 @@ function GraphDisplay() {
const selectBoxData = dataKeys.map((d) => ({ fieldName: d, value: d }));

const [histoXAttr, setHistoXAttr] = useState('ID');
//area chart attribute
const [areaXattr, setAreaXattr] = useState('ID');
const [areaYattr, setAreaYattr] = useState('ID');
//Below is the html code (return value)
return (
<>
Expand Down Expand Up @@ -57,8 +61,37 @@ function GraphDisplay() {
</div>
</div>
</div>

</div>
<div className="rounded overflow-hidden shadow-lg m-auto p-4">
<p>Area Chart</p>
<AreaChart
data={dataNonGeo}
xAxisAttribute={areaXattr}
yAxisAttribute={areaYattr}
></AreaChart>
</div>

</div>
<div className='font-bold text-xl py-2'>
Area Chart X Axis Data of Non-Geo Data
</div>
<div className='m-auto w-64'>
<SelectBox
data={selectBoxData}
onValueChange={setAreaXattr}
></SelectBox>
</div>
<div className='font-bold text-xl py-2'>
Area Chart Y Axis Data of Non-Geo Data
</div>
<div className='m-auto w-64'>
<SelectBox
data={selectBoxData}
onValueChange={setAreaYattr}
></SelectBox>
</div>

</>
);
}
Expand Down
Binary file modified ux-design/questions/FAQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ux-design/questions/FAQ_UxDesign.docx
Binary file not shown.
Binary file added ux-design/questions/FAQ_wireframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ux-design/questions/Resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ux-design/questions/Resources_wireframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ux-design/questions/UXdesignDocument.docx
Binary file not shown.