Skip to content

Commit

Permalink
add histogram back (#749)
Browse files Browse the repository at this point in the history
* add histogram back

* change subtitle

* rename
  • Loading branch information
PatrickCleary committed Jul 13, 2023
1 parent 1e895c4 commit 25df8f8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/constants/baselines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const PEAK_SCHEDULED_SERVICE = {
};

export const PEAK_SPEED = {
'line-red': 21.4,
'line-red': 21.2,
'line-orange': 18,
'line-blue': 20.5,
'line-green': 12.6,
Expand Down
2 changes: 1 addition & 1 deletion modules/headways/HeadwaysDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function HeadwaysDetails() {
/>

<HeadwaysHistogramWrapper
headways={headways}
query={headways}
fromStation={fromStation}
toStation={toStation}
/>
Expand Down
10 changes: 5 additions & 5 deletions modules/headways/charts/HeadwaysHistogramWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import { ChartPlaceHolder } from '../../../common/components/graphics/ChartPlace
import { HeadwaysHistogram } from './HeadwaysHistogram';

interface HeadwaysHistogramWrapperProps {
headways: UseQueryResult<SingleDayDataPoint[]>;
query: UseQueryResult<SingleDayDataPoint[]>;
toStation: Station | undefined;
fromStation: Station | undefined;
}

export const HeadwaysHistogramWrapper: React.FC<HeadwaysHistogramWrapperProps> = ({
headways,
query,
toStation,
fromStation,
}) => {
const dataReady = headways.data && toStation && fromStation;
if (!dataReady) return <ChartPlaceHolder query={headways} />;
const dataReady = query.data && toStation && fromStation;
if (!dataReady) return <ChartPlaceHolder query={query} />;
return (
<HeadwaysHistogram headways={headways.data} fromStation={fromStation} toStation={toStation} />
<HeadwaysHistogram headways={query.data} fromStation={fromStation} toStation={toStation} />
);
};
14 changes: 14 additions & 0 deletions modules/tripexplorer/SubwayTripGraphs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { DwellsAggregateWrapper } from '../dwells/DwellsAggregateWrapper';
import { TravelTimesSingleWrapper } from '../traveltimes/TravelTimesSingleWrapper';
import { HeadwaysSingleWrapper } from '../headways/HeadwaysSingleWrapper';
import { DwellsSingleWrapper } from '../dwells/DwellsSingleWrapper';
import { HeadwaysHistogramWrapper } from '../headways/charts/HeadwaysHistogramWrapper';

interface SubwayTripGraphsProps {
fromStation: Station;
Expand Down Expand Up @@ -150,6 +151,19 @@ export const SubwayTripGraphs: React.FC<SubwayTripGraphsProps> = ({
/>
<DwellsSingleWrapper query={dwells} toStation={toStation} fromStation={fromStation} />
</WidgetDiv>
<WidgetDiv>
<WidgetTitle
title="Headway distribution"
subtitle="Time between trains"
location={location}
line={line}
/>
<HeadwaysHistogramWrapper
query={headways}
toStation={toStation}
fromStation={fromStation}
/>
</WidgetDiv>
</>
)}
</div>
Expand Down

0 comments on commit 25df8f8

Please sign in to comment.