Skip to content

Commit 2e7a23f

Browse files
committed
Re-render request, response, and speed charts
1 parent 81106df commit 2e7a23f

7 files changed

Lines changed: 93 additions & 45 deletions

File tree

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
node_modules
2-
.eslintrc.js
3-
package-lock.json
4-
settings.json
5-
.DS_Store
1+
node_modules

app/charts/plotly_copy_speed.jsx

Whitespace-only changes.

app/charts/request-type-chart.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,22 @@ const RequestTypesChart = (props) => {
2929
values: Object.values(requestObj),
3030
labels: ['DELETE', 'GET', 'PATCH', 'POST', 'PUSH', 'PUT'],
3131
type: 'pie',
32-
}]}
32+
marker: {
33+
'colors': [
34+
'#f38181',
35+
'#fce38a',
36+
'#fcbad3',
37+
'#95e1d3',
38+
'#a8d8ea',
39+
'#aa96da',
40+
]
41+
},
42+
}]}
3343
layout = {{
3444
height: 500,
35-
width: 500
45+
width: 500,
46+
displaylogo: false,
47+
paper_bgcolor: '#fffbe0'
3648
}}
3749
/>
3850
)

app/charts/response-code-chart.jsx

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useContext } from 'react';
2-
import { Doughnut } from 'react-chartjs-2';
2+
import Plot from 'react-plotly.js';
33
import CommunicationsContext from '../context/OverviewContext';
44

55
const ResponseCodeChart = (props) => {
@@ -53,23 +53,31 @@ const ResponseCodeChart = (props) => {
5353
}
5454
}
5555

56-
const chartData = {
57-
datasets: [
58-
{
59-
data: Object.values(responseCodes),
60-
backgroundColor: [
61-
'rgb(2, 210, 249)',
62-
'rgb(198, 42, 177)',
63-
'rgb(252, 170, 52)',
64-
'rgb(239, 91, 145)',
65-
'rgb(182, 219, 26)',
66-
'rgb(254, 255, 0)',
67-
],
68-
},
69-
],
70-
labels: ['100-199', '200-299', '300-399', '400-499', '500-599', 'Null'],
71-
};
72-
return <Doughnut data={chartData} />;
56+
return (
57+
<Plot
58+
data = {[{
59+
values: Object.values(responseCodes),
60+
labels: ['Informational 1xx', 'Successful 2xx', 'Redirection 3xx', 'Client Error 4xx', 'Server Error 5xx'],
61+
type: 'pie',
62+
marker: {
63+
'colors': [
64+
'#f38181',
65+
'#fce38a',
66+
'#fcbad3',
67+
'#95e1d3',
68+
'#a8d8ea',
69+
'#aa96da',
70+
]
71+
}
72+
}]}
73+
layout = {{
74+
height: 500,
75+
width: 500,
76+
displaylogo: false,
77+
paper_bgcolor: '#fffbe0'
78+
}}
79+
/>
80+
)
7381
};
7482
return <div>{createChart()}</div>;
7583
};

app/charts/speed-chart.jsx

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useContext } from 'react';
2-
import { Line } from 'react-chartjs-2';
2+
import Plot from 'react-plotly.js';
33
import HealthContext from '../context/DetailsContext';
44

55
const SpeedChart = (props) => {
@@ -24,24 +24,56 @@ const SpeedChart = (props) => {
2424
}
2525
}
2626

27-
const chartData = {
28-
datasets: [
29-
{
30-
label: `CPU Speed of ${props.service}`,
31-
data: yAxis,
32-
backgroundColor: [
33-
'rgb(2, 210, 249)',
34-
],
35-
},
36-
],
37-
options: {
38-
},
39-
xAxisID: 'Speed',
40-
yAxisID: 'Communicaton',
41-
labels: xAxis,
42-
};
43-
44-
return <Line data={chartData} />;
27+
return (
28+
<Plot
29+
data = {[{
30+
domain: { x: [0, 1], y: [0, 1] },
31+
type: 'indicator',
32+
value: yAxis[length],
33+
title: {'text': "Speed Chart"},
34+
delta: {'reference': 3.5, 'increasing': {'color': "mistyrose"}},
35+
mode: "gauge+number+delta",
36+
gauge: { axis: { range: [null, 7] },
37+
'tickwidth': 1,
38+
'tickcolor': "#fce38a",
39+
'bar': {'color': "#6eb6ff"},
40+
'bordercolor': "#a3de83",
41+
'steps': [
42+
{'range': [0, 3.5], 'color': '#fab57a'},
43+
{'range': [3.5, 5.3], 'color': '#edf798'}],
44+
'threshold': {
45+
'line': {'color': "red", 'width': 4},
46+
'thickness': 0.75,
47+
'value': 6}
48+
},
49+
}]}
50+
layout = {{
51+
height: 500,
52+
width: 500,
53+
paper_bgcolor: '#fffbe0'
54+
}}
55+
/>
56+
)
57+
58+
59+
// const chartData = {
60+
// datasets: [
61+
// {
62+
// label: `CPU Speed of ${props.service}`,
63+
// data: yAxis,
64+
// backgroundColor: [
65+
// 'rgb(2, 210, 249)',
66+
// ],
67+
// },
68+
// ],
69+
// options: {
70+
// },
71+
// xAxisID: 'Speed',
72+
// yAxisID: 'Communicaton',
73+
// labels: xAxis,
74+
// };
75+
76+
// return <Line data={chartData} />;
4577
};
4678

4779
return <div>{createChart()}</div>;

user/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"setupRequired":false,"services":[["asdf","MongoDB","mongodb+srv://alon:testing123@cluster0-phsei.mongodb.net/test?retryWrites=true&w=majority"]],"splash":true}
1+
{"setupRequired":false,"services":[["asdf","MongoDB","mongodb+srv://alon:testing123@cluster0-phsei.mongodb.net/test?retryWrites=true&w=majority"]],"splash":false}

0 commit comments

Comments
 (0)