#989 Create a function that creates graphs. #1150

Closed
a21jonfa wants to merge 7 commits from #989 into both_teams_week_8
Collaborator

Added a Graph component with line graph so far fully supported.
features:

  • resizable
  • dynamic scale of the y-axis
  • can display up to 5 properties.
    i think alot of features can be stripped out and used for other types of graphs in the future making them much easier to implement.
    #989
Added a Graph component with line graph so far fully supported. features: * resizable * dynamic scale of the y-axis * can display up to 5 properties. i think alot of features can be stripped out and used for other types of graphs in the future making them much easier to implement. #989
c24danli 2026-05-26 06:28:57 +00:00
Collaborator

Review on #989

Whats done

A reusable Graph component has been added. The current implementation supports line graphs with dynamic resizing, y-axis labels, graph dots, and a legend.

Tested on Windows using Chrome

  • App starts.
  • Inspected the implementation and reviewed the screenshots provided in the PR.
  • The graph could not be fully tested directly in the application because the test view is not connected to the dashboard/routing.
  • This is also stated in the code comment in TestGraph.js.

Inspected following files

  • frontend/src/components/Graphs/Graph.js

    • Indentation/code styling

      • Mostly readable and consistent.
    • Naming convention

      • Component names follow PascalCase:

        • Graph
        • LineGraph
        • BarGraph
        • PieGraph
      • Variable names mostly follow camelCase.

    • Printed text uses and follows localization standards

      • Hardcoded visible text exists and should use localization if shown to users:

        • No valid data availible
        • "Is not a valid/supported graph type."
        • bar
        • pie
      • Spelling issue: availible should be available.

    • Comments

      • Comments are understandable, but some should be shorter and more formal.
    • General code quality

      • The line graph implementation looks reusable.

      • Missing React key props in some mapped SVG elements.

      • BarGraph and PieGraph are currently only placeholders.

      • Edge cases should be handled better, for example:

        • only one data point
        • equal min and max y-values
        • more than 5 properties
      • Inline styles and hardcoded colors are used.

  • frontend/src/features/Graphs/TestGraph.js

    • Indentation/code styling

      • Mostly readable.
    • Naming convention

      • TestGraphView follows PascalCase.
      • Data should be renamed to data according to camelCase variable naming convention.
    • Printed text uses and follows localization standards

      • No localization issue found in this file.
    • Comments

      • The comment clearly explains that the view is not connected to the dashboard.
    • General code quality

      • Useful as a mock/test view.
      • The view is not connected to the dashboard/routing, so the graph cannot be tested directly through the app.

What needs to be done

  • frontend/src/components/Graphs/Graph.js

    • Add missing React key props for mapped elements.
    • Fix spelling: availibleavailable.
    • Move visible hardcoded text to localization if it can be shown to users.
    • Handle edge cases for one data point, equal y-values, and too many properties.
    • Consider moving inline styles and hardcoded colors to CSS/classes or constants.
    • Consider removing or hiding unsupported bar and pie options until they are implemented.
  • frontend/src/features/Graphs/TestGraph.js

    • Rename Data to data.
    • Connect the test graph view to routing/dashboard or provide clear testing instructions for reviewers.

Conclusion

  • The line graph implementation looks promising and the screenshots show the intended result.
  • However, the graph could not be fully tested directly in the application because the test view is not connected to the dashboard/routing.
  • The PR should be improved before merge, mainly by making the graph testable in the app and fixing the React/key, naming, localization, and edge case issues.
# Review on #989 ## Whats done A reusable `Graph` component has been added. The current implementation supports line graphs with dynamic resizing, y-axis labels, graph dots, and a legend. ### Tested on Windows using Chrome * App starts. * Inspected the implementation and reviewed the screenshots provided in the PR. * The graph could not be fully tested directly in the application because the test view is not connected to the dashboard/routing. * This is also stated in the code comment in `TestGraph.js`. ### Inspected following files * `frontend/src/components/Graphs/Graph.js` * Indentation/code styling * Mostly readable and consistent. * Naming convention * Component names follow PascalCase: * `Graph` * `LineGraph` * `BarGraph` * `PieGraph` * Variable names mostly follow camelCase. * Printed text uses and follows localization standards * Hardcoded visible text exists and should use localization if shown to users: * `No valid data availible` * `"Is not a valid/supported graph type."` * `bar` * `pie` * Spelling issue: `availible` should be `available`. * Comments * Comments are understandable, but some should be shorter and more formal. * General code quality * The line graph implementation looks reusable. * Missing React `key` props in some mapped SVG elements. * `BarGraph` and `PieGraph` are currently only placeholders. * Edge cases should be handled better, for example: * only one data point * equal min and max y-values * more than 5 properties * Inline styles and hardcoded colors are used. * `frontend/src/features/Graphs/TestGraph.js` * Indentation/code styling * Mostly readable. * Naming convention * `TestGraphView` follows PascalCase. * `Data` should be renamed to `data` according to camelCase variable naming convention. * Printed text uses and follows localization standards * No localization issue found in this file. * Comments * The comment clearly explains that the view is not connected to the dashboard. * General code quality * Useful as a mock/test view. * The view is not connected to the dashboard/routing, so the graph cannot be tested directly through the app. ## What needs to be done * `frontend/src/components/Graphs/Graph.js` * Add missing React `key` props for mapped elements. * Fix spelling: `availible` → `available`. * Move visible hardcoded text to localization if it can be shown to users. * Handle edge cases for one data point, equal y-values, and too many properties. * Consider moving inline styles and hardcoded colors to CSS/classes or constants. * Consider removing or hiding unsupported `bar` and `pie` options until they are implemented. * `frontend/src/features/Graphs/TestGraph.js` * Rename `Data` to `data`. * Connect the test graph view to routing/dashboard or provide clear testing instructions for reviewers. ## Conclusion * The line graph implementation looks promising and the screenshots show the intended result. * However, the graph could not be fully tested directly in the application because the test view is not connected to the dashboard/routing. * The PR should be improved before merge, mainly by making the graph testable in the app and fixing the React/key, naming, localization, and edge case issues.
a22erigr changed target branch from team_2_week_7 to both_teams_week_8 2026-05-27 08:57:18 +00:00
Added missing React keys, localized text, fixed spelling, removed unused bar and pie placeholders.
Collaborator

Review on #989, PR #1150

Whats done

Reviewed the new graph code changes and testing app from latest commit makign changes based on previous review

Tested on Linux using Firefox

  • App starts after running an Installation
  • graph could not be tested as expected and described by previous review

Inspected following files

  • frontend/src/components/Graphs/Graph.js
    • Indentation/code styling
      • Follows our prettier code standard and is correctly indented
    • General Code quality
      • code quality is good and translations are now used correctly
      • unnecessary elements have been removed
  • frontend/src/features/Graphs/TestGraph.js
    • Code Styling
      • variable names have now be turned into camelCase and follow our standards
  • frontend/src/locales/en.json and sv.json
    • Spelling
      • Spelling is correct for both english and swedish versions

What needs to be done

  • create future issues to make a usable card or graph utilizing this system to be tested

Conclusion

  • Everything looks good and should be ready to merge
  • create issues related to creating testable and usable cards of this system
# Review on #989, PR #1150 ## Whats done Reviewed the new graph code changes and testing app from latest commit makign changes based on previous review ### Tested on Linux using Firefox + App starts after running an Installation + graph could not be tested as expected and described by previous review ### Inspected following files + frontend/src/components/Graphs/Graph.js + Indentation/code styling + Follows our prettier code standard and is correctly indented + General Code quality + code quality is good and translations are now used correctly + unnecessary elements have been removed + frontend/src/features/Graphs/TestGraph.js + Code Styling + variable names have now be turned into camelCase and follow our standards + frontend/src/locales/en.json and sv.json + Spelling + Spelling is correct for both english and swedish versions ## What needs to be done + create future issues to make a usable card or graph utilizing this system to be tested ## Conclusion + Everything looks good and should be ready to merge + create issues related to creating testable and usable cards of this system
Collaborator

because we can't see the graph creation in a view this will not be merged.

because we can't see the graph creation in a view this will not be merged.
a22erigr closed this pull request 2026-05-28 10:43:19 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!1150
No description provided.