Skip to content

Commit

Permalink
Use new categories
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Jun 25, 2024
1 parent 617345e commit 4b02080
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion common/types/reliability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Line } from './lines';

export interface LineDelays {
date: string;
disabled_train: number;
disabled_vehicle: number;
door_problem: number;
flooding: number;
fire: number;
Expand All @@ -12,6 +12,7 @@ export interface LineDelays {
police_activity: number;
power_problem: number;
signal_problem: number;
mechanical_problem: number;
brake_problem: number;
switch_problem: number;
total_delay_time: number;
Expand Down
13 changes: 12 additions & 1 deletion modules/reliability/charts/DelayBreakdownGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const DelayBreakdownGraph: React.FC<DelayBreakdownGraphProps> = ({
fill: true,
pointHoverRadius: 6,
pointHoverBackgroundColor: lineColor,
data: data.map((datapoint) => datapoint.disabled_train),
data: data.map((datapoint) => datapoint.disabled_vehicle),
},
{
label: `Door Problem`,
Expand Down Expand Up @@ -124,6 +124,17 @@ export const DelayBreakdownGraph: React.FC<DelayBreakdownGraphProps> = ({
pointHoverBackgroundColor: lineColor,
data: data.map((datapoint) => datapoint.track_issue),
},
{
label: `Mechanical Problem`,
borderColor: '#451a03',
backgroundColor: hexWithAlpha('#451a03', 0.8),
pointRadius: 0,
pointBorderWidth: 0,
fill: true,
pointHoverRadius: 6,
pointHoverBackgroundColor: lineColor,
data: data.map((datapoint) => datapoint.mechanical_problem),
},
{
label: `Flooding`,
borderColor: '#0ea5e9',
Expand Down
5 changes: 4 additions & 1 deletion modules/reliability/charts/DelayByCategoryGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const DelayByCategoryGraph: React.FC<DelayByCategoryGraphProps> = ({
'🎚️ Switch Problem',
'🛑 Brake Issue',
'🛤️ Track Issue',
'🔧 Mechanical Problem',
'🌊 Flooding',
'🚓 Police Activity',
'🚑 Medical Emergency',
Expand All @@ -62,6 +63,7 @@ export const DelayByCategoryGraph: React.FC<DelayByCategoryGraphProps> = ({
'#10b981',
'#4c1d95',
'#8b5cf6',
'#451a03',
'#0ea5e9',
'#1d4ed8',
'#be123c',
Expand All @@ -71,13 +73,14 @@ export const DelayByCategoryGraph: React.FC<DelayByCategoryGraphProps> = ({
const delayTotals: number[] = sumArray(
data.map((datapoint) => {
return [
datapoint.disabled_train,
datapoint.disabled_vehicle,
datapoint.door_problem,
datapoint.power_problem,
datapoint.signal_problem,
datapoint.switch_problem,
datapoint.brake_problem,
datapoint.track_issue,
datapoint.mechanical_problem,
datapoint.flooding,
datapoint.police_activity,
datapoint.medical_emergency,
Expand Down

0 comments on commit 4b02080

Please sign in to comment.