Skip to content

Commit

Permalink
add min/max to chart link
Browse files Browse the repository at this point in the history
Per discussion and agreement with the developers of this PR, I added the
min/max error bars to the chart link ability.
  • Loading branch information
huss committed Aug 4, 2023
1 parent 973d236 commit eb1a362
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/client/app/actions/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export interface LinkOptions {
sliderRange?: TimeInterval;
toggleAreaNormalization?: boolean;
areaUnit?: string;
toggleMinMax?: boolean;
toggleBarStacking?: boolean;
comparePeriod?: ComparePeriod;
compareSortingOrder?: SortingOrder;
Expand All @@ -234,7 +235,7 @@ export function changeOptionsFromLink(options: LinkOptions) {
const dispatchSecond: Array<Thunk | t.ChangeChartToRenderAction | t.ChangeBarStackingAction |
t.ChangeGraphZoomAction | t.ChangeCompareSortingOrderAction | t.ToggleOptionsVisibility |
m.UpdateSelectedMapAction | t.UpdateLineGraphRate | t.ToggleAreaNormalizationAction |
t.UpdateSelectedAreaUnitAction> = [];
t.UpdateSelectedAreaUnitAction | t.ToggleShowMinMaxAction> = [];
/* eslint-enable @typescript-eslint/indent */

if (options.meterIDs) {
Expand Down Expand Up @@ -269,7 +270,9 @@ export function changeOptionsFromLink(options: LinkOptions) {
}
if (options.areaUnit) {
dispatchSecond.push(updateSelectedAreaUnit(options.areaUnit as AreaUnitType));

}
if (options.toggleMinMax) {
dispatchSecond.push(toggleShowMinMax());
}
if (options.toggleBarStacking) {
dispatchSecond.push(changeBarStacking());
Expand Down
6 changes: 6 additions & 0 deletions src/client/app/components/RouteComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface RouteProps {
role: UserRole;
renderOnce: boolean;
areaNormalization: boolean;
minMax: boolean;
changeOptionsFromLink(options: LinkOptions): Promise<any[]>;
clearCurrentUser(): any;
changeRenderOnce(): any;
Expand Down Expand Up @@ -214,6 +215,11 @@ export default class RouteComponent extends React.Component<RouteProps> {
case 'areaUnit':
options.areaUnit = info;
break;
case 'minMax':
if (this.props.minMax.toString() !== info) {
options.toggleMinMax = true;
}
break;
case 'comparePeriod':
options.comparePeriod = validateComparePeriod(info);
break;
Expand Down
1 change: 1 addition & 0 deletions src/client/app/containers/ChartLinkContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function mapStateToProps(state: State) {
linkText += `&unitID=${unitID.toString()}`;
linkText += `&rate=${state.graph.lineGraphRate.label.toString()},${state.graph.lineGraphRate.rate.toString()}`;
linkText += `&areaUnit=${state.graph.selectedAreaUnit}&areaNormalization=${state.graph.areaNormalization}`;
linkText += `&minMax=${state.graph.showMinMax}`;
return {
linkText,
chartType
Expand Down
3 changes: 2 additions & 1 deletion src/client/app/containers/RouteContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function mapStateToProps(state: State) {
role,
// true if the chartlink rendering has been done.
renderOnce: state.graph.renderOnce,
areaNormalization: state.graph.areaNormalization
areaNormalization: state.graph.areaNormalization,
minMax: state.graph.showMinMax
};
}

Expand Down

0 comments on commit eb1a362

Please sign in to comment.