This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
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.
Merge pull request #23 from fga-eps-mds/11-create-real-time-chart
Criar componente do gráfico de tempo real
- Loading branch information
Showing
8 changed files
with
223 additions
and
60 deletions.
There are no files selected for viewing
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,36 @@ | ||
--- | ||
name: Bug reporte | ||
about: Reporte um bug ou nos ajude a resolver algum | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Descrição do problema | ||
|
||
Um descrição clara e concisa sobre o problema | ||
|
||
## Passos para reprodução | ||
|
||
Passos para reproduzir o comportamento. | ||
|
||
1. Vá para... | ||
2. Click em... | ||
... | ||
|
||
### Comportamento atual | ||
|
||
O que está acontecendo atualmente | ||
|
||
### Comportamento esperado | ||
|
||
Qual é o comportamento esperado pelo sistema | ||
|
||
## Contextos, prints e informações adicionais | ||
|
||
Se for aplicável, adicione gifs, imagens ou qualquer outro detalhe de enriqueça a descrição do problema. | ||
|
||
## Possível Solução | ||
|
||
Caso você tenha algum sugestão de onde começar a procurar o problema ou uma solução para ele escreva aqui. |
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 |
---|---|---|
@@ -1,31 +1,36 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
about: Reporte um bug ou nos ajude a resolver algum | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the bug | ||
A clear and concise description of what the bug is. | ||
## Descrição do problema | ||
|
||
## Steps to Reproduce | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
Um descrição clara e concisa sobre o problema | ||
|
||
## Behavior | ||
### Actual Behavior | ||
What is happening when you execute the steps? | ||
## Passos para reprodução | ||
|
||
### Expected Behavior | ||
A clear and concise description of what you expected to happen. | ||
Passos para reproduzir o comportamento. | ||
|
||
## Additional context and screenshots | ||
If applicable, add screenshots and other details to help explain your problem. | ||
1. Vá para... | ||
2. Click em... | ||
... | ||
|
||
## Possible Fix | ||
If you have any idea of what can be done to solve the problem, write it here. | ||
### Comportamento atual | ||
|
||
O que está acontecendo atualmente | ||
|
||
### Comportamento esperado | ||
|
||
Qual é o comportamento esperado pelo sistema | ||
|
||
## Contextos, prints e informações adicionais | ||
|
||
Se for aplicável, adicione gifs, imagens ou qualquer outro detalhe de enriqueça a descrição do problema. | ||
|
||
## Possível Solução | ||
|
||
Caso você tenha algum sugestão de onde começar a procurar o problema ou uma solução para ele escreva aqui. |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Template de tarefas | ||
about: Template para definir a tarefa para algum membro | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Descrição | ||
|
||
Descreva a tarefa aqui | ||
|
||
## Tarefas | ||
|
||
- [ ] Primeira tarefa | ||
- [ ] Segunda tarefa | ||
- [ ] ... | ||
|
||
## Informação adicional | ||
|
||
Dê mais informação sobre a tarefa (sites, imagens, ideias, qualquer coisa que possa ser útil para quem estiver trabalhando) |
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,83 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
import { | ||
LineChart, | ||
Line, | ||
XAxis, | ||
YAxis, | ||
CartesianGrid, | ||
Tooltip, | ||
Legend | ||
} from "recharts"; | ||
|
||
class RealTimeChart extends React.PureComponent { | ||
render() { | ||
const { data, X, Y, Label1, Label2 } = this.props; | ||
return ( | ||
<LineChart | ||
width={600} | ||
height={300} | ||
data={data} | ||
margin={{ | ||
top: 8, | ||
right: 5, | ||
left: 5, | ||
bottom: 5 | ||
}} | ||
> | ||
<CartesianGrid strokeDasharray="2 3" /> | ||
<XAxis | ||
dataKey="name" | ||
label={{ | ||
value: X, | ||
position: "insideBottomRight", | ||
offset: -5 | ||
}} | ||
/> | ||
<YAxis label={{ value: Y, angle: -90, position: "insideLeft" }} /> | ||
<Tooltip /> | ||
<Legend /> | ||
<Line | ||
type="monotone" | ||
dataKey={Label1} | ||
stroke="#FF1493" | ||
activeDot={{ r: 8 }} | ||
/> | ||
<Line type="monotone" dataKey={Label2} stroke=" #FF8C69" /> | ||
</LineChart> | ||
); | ||
} | ||
} | ||
RealTimeChart.propTypes = { | ||
data: PropTypes.instanceOf(Array), | ||
X: PropTypes.string, | ||
Y: PropTypes.string, | ||
Label1: PropTypes.string, | ||
Label2: PropTypes.string | ||
}; | ||
RealTimeChart.defaultProps = { | ||
data: [ | ||
{ | ||
Frenagem: 500, | ||
Velocidade: 3000, | ||
amt: 3000 // Ponto 1 | ||
}, | ||
{ | ||
Frenagem: 2000, | ||
Velocidade: 2000, | ||
amt: 200 | ||
}, | ||
{ | ||
Frenagem: 3000, | ||
Velocidade: 1000, | ||
amt: 2290 | ||
} | ||
], | ||
X: "Eixo X", | ||
Y: "Eixo Y", | ||
Label1: "Frenagem", | ||
Label2: "Velocidade" | ||
}; | ||
|
||
export default RealTimeChart; |
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 Enzyme, { shallow } from "enzyme"; | ||
import toJson from "enzyme-to-json"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
import RealTimeChart from "../components/RealTimeChart"; | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); | ||
|
||
describe("<RealTimeChart />", () => { | ||
describe("render()", () => { | ||
test("renders the component", () => { | ||
const wrapper = shallow(<RealTimeChart />); | ||
const component = wrapper.dive(); | ||
|
||
expect(toJson(component)).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |