Skip to content

Commit

Permalink
feat: add axios requests and d3
Browse files Browse the repository at this point in the history
  • Loading branch information
akomiqaia committed Aug 29, 2020
1 parent 2f1805c commit df418c3
Show file tree
Hide file tree
Showing 7 changed files with 614 additions and 5 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"babel-plugin-root-import": "^6.5.0",
"babel-plugin-styled-components": "^1.11.1",
"bootstrap": "^4.5.2",
"britecharts-react": "^0.5.4",
"d3": "^6.0.0",
"gatsby": "^2.22.5",
"gatsby-plugin-layout": "^1.3.10",
"gatsby-plugin-styled-components": "^3.3.10",
Expand Down
12 changes: 12 additions & 0 deletions src/components/d3charts/d3areaChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

import * as d3 from 'd3';

const SparklineChart = ({ estimatePay }) => {
const dataset = estimatePay;
// .sort((a, b) => console.log(a, b));
console.log(dataset);
return <div>Coming</div>;
};

export default SparklineChart;
38 changes: 38 additions & 0 deletions src/components/d3charts/d3donutChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';

import { Donut } from 'britecharts-react';

const with4Slices = () => {
return [
{
quantity: 60,
percentage: 60,
name: `React`,
id: 1,
},
{
quantity: 20,
percentage: 20,
name: `Ember`,
id: 2,
},
{
quantity: 10,
percentage: 10,
name: `Angular`,
id: 3,
},
{
quantity: 10,
percentage: 10,
name: `Backbone`,
id: 4,
},
];
};

const DonutChart = () => {
return <Donut data={with4Slices()} />;
};

export default DonutChart;
Empty file.
37 changes: 35 additions & 2 deletions src/templates/CareerPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import CareerPathDetail from '../components/careerPath/CareerPathDetail';
import Graph1 from '../assets/temp/lc1.png';
import Graph2 from '../assets/temp/lc2.png';
import Graph3 from '../assets/temp/dc.png';
import DonutChart from '../components/d3charts/d3donutChart';
import SparklineChart from '../components/d3charts/d3areaChart';

const ReverseCardGroupStyle = styled(CardGroupStyle)`
grid-template-columns: 35% 60%;
Expand Down Expand Up @@ -43,6 +45,8 @@ const CareerPath: React.FC<PageProps> = ({ data }) => {
return setLmiData({ loading: false, lmiData: lmi4AllData(lmiCode, name) });
}, []);

console.log(lmiData.lmiData.estimatePay);

return (
<main>
<CareerPathDetail path={{ name, videoUrl, lmiCode, description }} />
Expand All @@ -62,12 +66,17 @@ const CareerPath: React.FC<PageProps> = ({ data }) => {
<strong>Average Salary</strong>
</Card.Title>
<GraphImg src={Graph1} />
{lmiData.loading ? (
`loading`
) : (
<SparklineChart estimatePay={lmiData.lmiData.estimatePay} />
)}
</Card.Body>
</StyledCard>
<StyledCard>
<Card.Body>
<Card.Title className="mb-4">
<strong>Employment ratio</strong>
<strong>Employment Rate</strong>
</Card.Title>
<GraphImg src={Graph2} />
</Card.Body>
Expand All @@ -76,12 +85,36 @@ const CareerPath: React.FC<PageProps> = ({ data }) => {
<StyledCard>
<Card.Body>
<Card.Title className="mb-4">
<strong>Success Ratio</strong>
<strong>Courses taken to become {name}</strong>
</Card.Title>
<GraphImg src={Graph3} />
</Card.Body>
</StyledCard>
</ReverseCardGroupStyle>
<p>
<StyledCard>
<Card.Body>
<Card.Title className="mb-4">
<strong>
Another card that has infomration about current number of vacancies, replacemenet
demand with a number over ceratin time of years. top skills in demand to become
{` `}
{name}.
</strong>
</Card.Title>
</Card.Body>
</StyledCard>
</p>
<p>
<StyledCard>
<Card.Body>
<Card.Title className="mb-4">
<strong>predicted Employment</strong>
<DonutChart />
</Card.Title>
</Card.Body>
</StyledCard>
</p>
</div>
</main>
);
Expand Down
1 change: 0 additions & 1 deletion src/utils/lmi4all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function lmi4AllData(lmiCode, name) {
.catch((errors) => {
throw new Error(errors);
});

return lmiData;
}

Expand Down
Loading

0 comments on commit df418c3

Please sign in to comment.