Skip to content

Commit

Permalink
Resolved requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias0127 committed Aug 3, 2023
1 parent 14fc38f commit 973d236
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/client/app/actions/lineReadings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ export function fetchNeededLineReadings(timeInterval: TimeInterval, unitID: numb

return Promise.all(promises);
};
}
}
7 changes: 2 additions & 5 deletions src/client/app/components/ErrorBarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TooltipMarkerComponent from './TooltipMarkerComponent';
* React Component rendering an Error Bar checkbox for toggle operation.
* @returns Error Bar checkbox with tooltip and label
*/
const ErrorBarComponent = () => {
export default function ErrorBarComponent() {
const dispatch = useDispatch();
const graphState = useSelector((state: State) => state.graph);

Expand All @@ -39,7 +39,4 @@ const ErrorBarComponent = () => {
<TooltipMarkerComponent page='home' helpTextId='help.home.error.bar' />
</div>
);
};

export default ErrorBarComponent;

}
14 changes: 7 additions & 7 deletions src/client/app/containers/LineChartContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ function mapStateToProps(state: State) {
const timeInterval = state.graph.timeInterval;
const unitID = state.graph.selectedUnit;
const datasets: any[] = [];
const yMinData: number[] = [];
const yMaxData: number[] = [];
// The unit label depends on the unit which is in selectUnit state.
const graphingUnit = state.graph.selectedUnit;
// The current selected rate
Expand Down Expand Up @@ -70,6 +68,9 @@ function mapStateToProps(state: State) {
// Create two arrays for the x and y values. Fill the array with the data from the line readings
const xData: string[] = [];
const yData: number[] = [];
// Create two arrays to store the min and max values of y-axis data points
const yMinData: number[] = [];
const yMaxData: number[] = [];
const hoverText: string[] = [];
const readings = _.values(readingsData.readings);
// The scaling is the factor to change the reading by. It divides by the area while will be 1 if no scaling by area.
Expand All @@ -82,11 +83,11 @@ function mapStateToProps(state: State) {
xData.push(timeReading.format('YYYY-MM-DD HH:mm:ss'));
const readingValue = reading.reading * scaling;
yData.push(readingValue);
const minValue = reading.min * scaling;
yMinData.push(minValue);
const maxValue = reading.max * scaling;
yMaxData.push(maxValue);
if (state.graph.showMinMax) {
const minValue = reading.min * scaling;
yMinData.push(minValue);
const maxValue = reading.max * scaling;
yMaxData.push(maxValue);
hoverText.push(`<b> ${timeReading.format('ddd, ll LTS')} </b> <br> ${label}: ${readingValue.toPrecision(6)}` +
` ${unitLabel} <br> min: ${minValue.toPrecision(6)} <br> max: ${maxValue.toPrecision(6)}`);
} else {
Expand Down Expand Up @@ -129,7 +130,6 @@ function mapStateToProps(state: State) {
color: getGraphColor(colorID, DataType.Meter)
}
});

}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/app/translations/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const localeData = {
"edit.unit": "Edit Unit",
"email": "Email",
"enable": "Enable",
"error.bar": "Error Bar",
"error.bar": "Show error bars",
"export.graph.data": "Export graph data",
"export.raw.graph.data": "Export graph meter data",
"failed.logging.in": "Failed logging in",
Expand Down Expand Up @@ -234,7 +234,7 @@ const localeData = {
"help.home.chart.select": "Any graph type can be used with any combination of groups and meters (except maps which only do meters within map). Line graphs show the usage (e.g., kW) vs. time. You can zoom and scroll with the controls right below the graph. Bar shows the total usage (e.g., kWh) for the time frame of each bar where you can control the time frame. Compare allows you to see the current usage vs. the usage in the last previous period for a day, week and four weeks. Map graphs show a spacial image of each meter where the circle size is related to four weeks of usage. Clicking on one of the choices (Line, Bar, Compare, Map) renders that graphic. Please visit {link} for further details and information.",
"help.home.compare.interval.tip": "Selects the time interval (Day, Week or 4 Weeks) to compare for current to previous. Please see {link} for further details and information.",
"help.home.compare.sort.tip": "Allows user to select the order of multiple comparison graphs to be Alphabetical (by name), Ascending (greatest to least reduction in usage) and Descending (least to greatest reduction in usage). Please see {link} for further details and information.",
"help.home.error.bar": "Toggles error bar with min and max value.Please visit {link} for further details and information.",
"help.home.error.bar": "Toggle error bars with min and max value. Please visit {link} for further details and information.",
"help.home.export.graph.data": "With the \"Export graph data\" button, one can export the data for the graph when viewing either a line or compare graphic. The zoom and scroll feature on the line graph allows you to control the time frame of the data exported. The \"Export graph data\" button gives the data points for the graph and not the original meter data. The \"Export graph meter data\" gives the underlying meter data (line graphs only). Please visit {link} for further details and information on when meter data export is allowed.",
"help.home.hide.or.show.options": "With the \"Hide options\" button the options buttons and dropdown menus on the left and top of the OED window are all hidden. A new \"Menu\" button at the top, right of the web page is available to see these options including a button to \"Show options\" to reverse this choice. When the web page window becomes too small the options will automatically hide. Please visit {link} for further details and information.",
"help.home.select.groups": "Groups aggregate (sum the usage) of any combination of groups and meters. You can choose which groups to view in your graphic from the \"Groups:\" dropdown menu. Note you can type in text to limit which groups are shown. The Groups button in the top, right side of the window allows you to see more details about each group and, if you are an admin, to edit the groups. Please visit {link} for further details and information.",
Expand Down
4 changes: 1 addition & 3 deletions src/client/app/types/redux/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export interface ChangeChartToRenderAction {
export interface ToggleAreaNormalizationAction {
type: ActionType.ToggleAreaNormalization;
}
export interface ToggleShowMinMaxAction {
type: ActionType.ToggleShowMinMax;
}

export interface ToggleShowMinMaxAction {
type: ActionType.ToggleShowMinMax;
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/migrations/registerMigration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const migrations = [
require('./0.5.0-0.6.0'),
require('./0.6.0-0.7.0'),
require('./0.7.0-0.8.0'),
require('./0.8.0-1.0.0')
require('./0.8.0-1.0.0'),
require('./1.0.0-1.1.0')
/* eslint-enable global-require */
];

Expand Down

0 comments on commit 973d236

Please sign in to comment.