Skip to content

Commit

Permalink
add time period to groupCurveChart;
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamineac committed Oct 10, 2023
1 parent c9db37a commit 21fa3f1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/GroupCurveChart/GroupCurveChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Primary.args = {
poe: 0.02,
uncertainty: true,
spectral: false,
timePeriod: 100,
};

Tooltip.args = {
Expand All @@ -62,6 +63,7 @@ Tooltip.args = {
poe: 0.02,
uncertainty: true,
spectral: false,
timePeriod: 100,
};

Crosshair.args = {
Expand All @@ -83,6 +85,7 @@ Crosshair.args = {
poe: 0.02,
uncertainty: true,
spectral: false,
timePeriod: 100,
};

TooltipWithCrosshair.args = {
Expand All @@ -104,6 +107,7 @@ TooltipWithCrosshair.args = {
poe: 0.02,
uncertainty: true,
spectral: false,
timePeriod: 100,
};

UncertaintyFalse.args = {
Expand All @@ -125,6 +129,7 @@ UncertaintyFalse.args = {
poe: 0.02,
uncertainty: false,
spectral: false,
timePeriod: 100,
};

SpectralAccelUncertaintyTrue.args = {
Expand All @@ -147,6 +152,7 @@ SpectralAccelUncertaintyTrue.args = {
poe: 0.1,
uncertainty: true,
spectral: true,
timePeriod: 100,
};

SpectralAccelUncertaintyFalse.args = {
Expand All @@ -169,6 +175,7 @@ SpectralAccelUncertaintyFalse.args = {
poe: 0.1,
uncertainty: false,
spectral: true,
timePeriod: 100,
};

SpectralAccelLog.args = {
Expand All @@ -191,4 +198,5 @@ SpectralAccelLog.args = {
poe: 0.1,
uncertainty: true,
spectral: true,
timePeriod: 100,
};
1 change: 1 addition & 0 deletions src/GroupCurveChart/GroupCurveChart.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const props: GroupCurveChartProps = {
subHeading: 'subHeading',
poe: 0.02,
uncertainty: true,
timePeriod: 100,
};

const Wrapper = () => {
Expand Down
5 changes: 3 additions & 2 deletions src/GroupCurveChart/GroupCurveChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const GroupCurveChart: React.FC<GroupCurveChartProps> = (props: GroupCurveChartP
subHeading,
poe,
uncertainty,
timePeriod,
} = props;
const height = width * 0.75;
const marginLeft = 50;
Expand Down Expand Up @@ -92,7 +93,7 @@ const GroupCurveChart: React.FC<GroupCurveChartProps> = (props: GroupCurveChartP
const ordinalColorScale = useMemo(() => {
if (!spectral) {
return scaleOrdinal({
domain: !poe ? [...curvesDomain.domain] : [...curvesDomain.domain, !spectral && `POE ${poe * 100}% (50 Yrs)`],
domain: !poe ? [...curvesDomain.domain] : [...curvesDomain.domain, !spectral && `POE ${poe * 100}% (${timePeriod} Yrs)`],
range: !poe ? [...curvesDomain.range] : [...curvesDomain.range, !spectral && '#989C9C'],
});
} else {
Expand All @@ -101,7 +102,7 @@ const GroupCurveChart: React.FC<GroupCurveChartProps> = (props: GroupCurveChartP
range: [...curvesDomain.range],
});
}
}, [curvesDomain, poe, spectral]);
}, [curvesDomain, poe, spectral, timePeriod]);

const poeLine = useMemo(() => {
const getPoE = (poeValue: number) => {
Expand Down
1 change: 1 addition & 0 deletions src/GroupCurveChart/groupCurveChart.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface GroupCurveChartProps {
resizeParent?: (state: any) => void;
poe: number | undefined;
uncertainty: boolean;
timePeriod: number;
}

export interface Curve {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Primary.args = {
heading: 'Hazard Chart with Uncertainty',
subHeading: 'WLG 250',
poe: 0.02,
timePeriod: 100,
};

SpectralAccelUncertaintyTrue.args = {
Expand All @@ -50,6 +51,7 @@ SpectralAccelUncertaintyTrue.args = {
subHeading: 'WLG 400m/s',
poe: undefined,
uncertainty: true,
timePeriod: 100,
};

SpectralAccelUncertaintyFalse.args = {
Expand All @@ -68,4 +70,5 @@ SpectralAccelUncertaintyFalse.args = {
subHeading: 'WLG 400m/s',
poe: undefined,
uncertainty: false,
timePeriod: 100,
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface GroupCurveChartResponsiveProps {
subHeading?: string;
poe: number | undefined;
uncertainty: boolean;
timePeriod: number;
}

const GroupCurveChartResponsive: React.FC<GroupCurveChartResponsiveProps> = (props: GroupCurveChartResponsiveProps) => {
Expand Down
1 change: 1 addition & 0 deletions src/HazardChart/HazardChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Primary.args = {
scalesConfig: hazardChartScalesConfig,
heading: 'Hazard Chart',
subHeading: 'PGA',
timePeriod: 100,
};

0 comments on commit 21fa3f1

Please sign in to comment.