This project is a React application integrated with GoJS for interactive diagrams. It allows you to visualize and export diagrams along with a legend.
This application uses GoJS to create and manage interactive diagrams. The diagrams are rendered in a React component, and you can generate, modify, and export them with a legend.
- Diagram Component: Handles the rendering and interaction of the GoJS diagram. It allows for dynamic node creation and updates.
- Legend Component: Displays a legend corresponding to the nodes in the diagram, including shapes and colors.
- Dynamic Node Generation: Nodes are generated with random shapes and colors.
- Legend Setup: Automatically generates a legend based on the nodes in the diagram.
- Export Functionality: Allows exporting the diagram along with the legend as a PNG image.
-
User Interface Enhancements:
- Add options to customize node appearance and legend layout.
- Implement zoom and pan controls for better diagram navigation.
- Enhance responsiveness for various screen sizes and devices.
-
Functionality Extensions:
- Allow users to save diagrams and legends in different formats (e.g., SVG, PDF).
- Implement undo/redo functionality for diagram modifications.
- Add support for importing and exporting diagrams to/from external formats.
-
Performance Optimizations:
- Optimize rendering performance for large diagrams with many nodes.
- Improve the efficiency of legend generation, especially for complex diagrams.
-
User Experience:
- Provide tooltips or contextual help for better user guidance.
- Add functionality for users to edit node and legend properties directly in the UI.
-
Testing and Quality Assurance:
- Increase test coverage, including unit tests for utility functions and integration tests for components.
- Perform cross-browser testing to ensure compatibility.
-
Accessibility Improvements:
- Ensure that the application is accessible to users with disabilities (e.g., keyboard navigation, screen reader support).
- Node.js (>= 14.x)
- npm (>= 6.x) or yarn (>= 1.x)
-
Clone the Repository:
git clone https://github.com/yourusername/your-repo.git cd your-repo
-
Install Dependencies:
npm install # or yarn install
In the project directory, you can run:
Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
Launches the test runner in interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes. Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc.) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point, you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However, we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
-
Run the Application:
npm start # or yarn start
Visit http://localhost:3000 to see the application in action.
-
Generating Nodes:
Nodes are created dynamically. You can adjust the
generateNodes
function ingenerateUtils.ts
to customize node generation. -
Exporting Diagrams:
Use the
exportWithLegend
function fromutils/exportUtils.ts
to export the diagram and legend as a PNG file.
src/components/Diagram.tsx
: Contains the React component for rendering the GoJS diagram.src/components/Legend.tsx
: Contains the React component for displaying the legend.src/utils/generateUtils.ts
: Utility functions for generating nodes and setting up the legend.src/utils/exportUtils.ts
: Utility functions for exporting the diagram with the legend.
- GoJS Documentation: GoJS Overview
- React Documentation: React Overview
- Create React App Documentation: Create React App Overview
Feel free to open an issue or submit a pull request if you have any questions or suggestions!