-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Parul Sharma
authored and
Parul Sharma
committed
Apr 24, 2020
1 parent
95b8db8
commit 99bf392
Showing
15 changed files
with
971 additions
and
24 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
|
||
function About() { | ||
return ( | ||
<div> | ||
<h1>What is covid19?</h1> | ||
<p>Coronavirus disease (COVID-19) is an infectious disease caused by a newly discovered coronavirus. | ||
|
||
Most people infected with the COVID-19 virus will experience mild to moderate respiratory illness and recover without requiring special treatment. Older people, and those with underlying medical problems like cardiovascular disease, diabetes, chronic respiratory disease, and cancer are more likely to develop serious illness. | ||
|
||
</p> | ||
|
||
</div> | ||
) | ||
} | ||
|
||
export default About; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import React from 'react'; | ||
import Chart from 'chart.js'; | ||
import {isEmpty} from "lodash"; | ||
|
||
export default class CaseChart extends React.Component { | ||
chartRef = React.createRef(); | ||
constructor(){ | ||
super(); | ||
this.myChart ={}; | ||
} | ||
|
||
componentDidMount(){ | ||
this.createChart(this.props); | ||
} | ||
|
||
componentDidUpdate(){ | ||
this.createChart(this.props); | ||
} | ||
|
||
createChart(props) { | ||
if(props.chartData && props.chartData.length!==undefined){ | ||
let dailyArr = []; | ||
props.chartData.forEach((element, index) => { | ||
dailyArr.push(element-props.chartData[index-1]) | ||
}); | ||
|
||
const myChartRef = this.chartRef.current.getContext("2d"); | ||
if(!isEmpty(this.myChart)) { | ||
this.myChart.data.datasets[0].data = dailyArr.splice(-20); | ||
|
||
this.myChart.update(); | ||
} else{ | ||
this.myChart = new Chart(myChartRef, { | ||
type : "line", | ||
data : { | ||
labels: props.dates.splice(-20), | ||
datasets: [ | ||
{ | ||
label: "Confirmed", | ||
data : dailyArr.splice(-20), | ||
borderColor : '#4285f4', | ||
fill : false, | ||
pointRadius : 0 | ||
} | ||
] | ||
}, | ||
options : { | ||
animation : { | ||
duration : 2000, | ||
easing : 'easeInOutQuint' | ||
|
||
}, | ||
tooltips : { | ||
enabled : true, | ||
mode : "nearest" | ||
}, | ||
|
||
legend : { | ||
display : false | ||
}, | ||
title : { | ||
display : false, | ||
}, | ||
scales:{ | ||
xAxes: [ | ||
{ | ||
ticks:{ | ||
display : false | ||
}, | ||
gridLines: { | ||
display : false | ||
} | ||
} | ||
], | ||
yAxes: [ | ||
{ | ||
ticks:{ | ||
display : false | ||
}, | ||
gridLines: { | ||
display : false | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
render(){ | ||
|
||
return( | ||
<div> | ||
<canvas id = "myChart" ref={this.chartRef} | ||
/> | ||
</div> | ||
|
||
) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import {Col} from 'react-bootstrap'; | ||
import CaseChart from './CaseChart' | ||
function CaseData(props) { | ||
var changeInNumberFromPrevDay = props.data[props.data.length-1]-props.data[props.data.length-2]; | ||
var sign = changeInNumberFromPrevDay > 0? "+" : | ||
changeInNumberFromPrevDay < 0 ? "-" : ""; | ||
return ( | ||
<Col md={2} sm={4} xs={4} className={props.class}> | ||
{props.data[props.data.length-1]}<br /> | ||
{props.title} | ||
<div>[{sign}{Math.abs(changeInNumberFromPrevDay)}]</div> | ||
<CaseChart chartData={props.data} dates ={props.dates} color="#005C25"/> | ||
</Col> | ||
) | ||
} | ||
|
||
export default CaseData; |
Oops, something went wrong.