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

feat: compute averages, add london and paris #48

Open
wants to merge 1 commit 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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"format": "eslint . --fix",
"docs": "echo NOT IMPLEMENTED"
},
"proxy": "http://localhost:4040",
"eslintConfig": {
"extends": [
"react-app",
Expand Down
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ class App extends React.Component {
regenData: false,
chartData: {
latencyData: chartData.latencyData,
latencyMean: chartData.latencyMean,
distanceData: chartData.distanceData,
distanceMean: chartData.distanceMean,
durationData: chartData.durationData,
durationMean: chartData.durationMean,
},
});
};
Expand Down
9 changes: 5 additions & 4 deletions src/RouteCharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class RouteCharts extends React.Component {
if (this.props.chartData.durationData.length === 1) {
return <div>No data -- routing method not supported in this region?</div>;
}
console.log("gots chartData", this.props.chartData);
return (
<div>
<Chart
Expand All @@ -44,7 +45,7 @@ class RouteCharts extends React.Component {
loader={<div>Loading Chart</div>}
data={this.props.chartData.durationData}
options={{
title: "Route Duration (seconds)",
title: `Route Duration (seconds)\nmean: ${this.props.chartData.durationMean}`,
legend: { position: "none" },
histogram: {
minValue: 0,
Expand All @@ -60,7 +61,7 @@ class RouteCharts extends React.Component {
loader={<div>Loading Chart</div>}
data={this.props.chartData.distanceData}
options={{
title: "Route Length (meters)",
title: `Route Length (meters)\nmean: ${this.props.chartData.distanceMean}`,
legend: { position: "none" },
histogram: {
minValue: 0,
Expand All @@ -76,11 +77,11 @@ class RouteCharts extends React.Component {
loader={<div>Loading Chart</div>}
data={this.props.chartData.latencyData}
options={{
title: "Request Latency (milliseconds)",
title: `Request Latency (milliseconds)\nmean: ${this.props.chartData.latencyMean}`,
legend: { position: "none" },
histogram: {
minValue: 0,
maxValue: 3000,
maxValue: 1000,
maxNumBuckets: 100,
bucketSize: 30,
lastBucketPercentile: 5,
Expand Down
4 changes: 4 additions & 0 deletions src/dataModel/algoFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { getOriginDestinationPairs } from "./data";
import { RouteData } from "./routeData";
import { computeRoutesDirectionsJsSDK } from "../apis/directionsJsSDK";
import { computeRoutesPreferred } from "../apis/routesPreferred";
import { meanBy } from "lodash";

function getCacheKey(metro, algoDefinition) {
return `${metro}_${JSON.stringify(algoDefinition)}_route`;
Expand Down Expand Up @@ -118,8 +119,11 @@ async function GetChartData(map, metro, algoDefinition) {

return {
latencyData: latencyData,
latencyMean: meanBy(latencyData.slice(1), (x) => x[1]),
durationData: durationData,
durationMean: meanBy(durationData.slice(1), (x) => x[1]),
distanceData: distanceData,
distanceMean: meanBy(distanceData.slice(1), (x) => x[1]),
};
}

Expand Down
28 changes: 28 additions & 0 deletions src/dataModel/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,34 @@ const metroOptions = [
],
],
},
{
enabled: true,
value: "London",
label: "London",
paths: [
[
{ lat: 51.693530127447346, lng: -0.4382735734477635 },
{ lat: 51.665747477216556, lng: 0.18181011008356804 },
{ lat: 51.26379448345281, lng: 0.22477593375394456 },
{ lat: 51.242558083640944, lng: -0.7667434474520355 },
{ lat: 51.74693568962239, lng: -0.7143923202850315 },
],
],
},
{
enabled: true,
value: "Paris",
label: "Paris",
paths: [
[
{ lat: 48.93738979343349, lng: 2.1614455980745033 },
{ lat: 48.93182654593182, lng: 2.4967512089499837 },
{ lat: 48.784546112317805, lng: 2.4830713508641318 },
{ lat: 48.777682210161544, lng: 2.166613008063558 },
{ lat: 48.93898041799014, lng: 2.1717599219308883 },
],
],
},
];

function getMetroPolygon(map, metro, showMetroPolygon) {
Expand Down
8 changes: 7 additions & 1 deletion src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.