Modern scientific calculator web app with interactive graphing, memory operations and unit conversion.
- Overview
- Features
- Graphing Mode
- Unit Converter
- Tech Stack
- Requirements
- Getting Started
- Project Structure
- Future Improvements
- Author
React Scientific Calculator is a modern web application for performing basic, scientific and graph-based calculations.
The project includes a glassmorphism-inspired responsive interface, dark and light mode, calculation history, memory operations, keyboard support, unit conversion and an interactive graphing mode for visualizing mathematical functions.
The application was created to practice building a structured React project with Vite, JavaScript, CSS, React Hooks, localStorage and the HTML Canvas API.
- addition, subtraction, multiplication and division
- percentage calculations
- decimal numbers
- delete and clear actions
- result formatting
- keyboard input support
- calculation history saved in localStorage
- MC โ clear memory
- MR โ recall memory
- M+ โ add current result to memory
- M- โ subtract current result from memory
- memory value saved in localStorage
- trigonometric functions: sin, cos, tan
- additional trigonometric functions: sec, csc, cot
- inverse trigonometric functions: asin, acos, atan
- hyperbolic functions: sinh, cosh, tanh
- logarithmic functions: log, ln
- constants: ฯ and e
- powers and roots
- factorial
- absolute value
- exponential function
- floor, ceil and round
- random number function
- modulo operation
- previous result usage with ANS
- draw function graphs directly in the browser
- support for multiple functions at the same time
- add and remove function rows
- edit each function expression separately
- choose graph color per function
- change line thickness per function
- use function presets
- zoom in and zoom out with buttons
- zoom with mouse wheel
- pan the graph by dragging
- display cursor coordinates
- reset graph view
- manually set X/Y axis range
- responsive canvas rendering
- separate graph colors for dark and light theme
- convert length units
- convert mass units
- convert temperature units
- convert time units
- convert data units
- convert speed units
- swap source and target units
- custom styled dropdowns
- responsive converter layout
- modern glassmorphism UI
- dark and light theme
- animated background
- responsive layout
- custom dropdown menus
- clean scientific calculator layout
- premium-style buttons and cards
The graphing mode allows the user to create and compare multiple function graphs.
Each function row includes:
- function label, such as f1(x), f2(x), f3(x)
- editable expression input
- preset selector
- color picker
- line thickness control
- add or delete function controls
Example expressions:
sin(x)
cos(x)
tan(x)
x^2
x^3 - 3*x
sqrt(x)
log(x)
exp(x/4)The graph is rendered with the HTML Canvas API.
The canvas updates when the function list, axis range, zoom level, theme or cursor position changes.
Interactive graph controls:
Drag mouse -> pan graph
Mouse wheel -> zoom graph
Reset button -> reset graph view
X/Y range input -> manually set graph window
Cursor move -> show graph coordinatesThe application includes a separate converter mode for common unit conversions.
Supported categories:
Length
Mass
Temperature
Time
Data
SpeedThe converter allows selecting source and target units, entering a numeric value and swapping units with one button.
| Area | Technology |
|---|---|
| Frontend | React |
| Build Tool | Vite |
| Language | JavaScript |
| Styling | CSS |
| Graph Rendering | HTML Canvas API |
| State Management | React Hooks |
| Storage | localStorage |
| Deployment | GitHub Pages |
| Platform | Web Browser |
To run the project locally, you need:
- Node.js
- npm
- modern web browser
- Clone the repository
git clone https://github.com/Avuii/react-scientific-calculator.git
cd react-scientific-calculator- Install dependencies
npm install- Run the development server
npm run dev- Build the project
npm run build- Preview the production build locally
npm run previewreact-scientific-calculator/
โโโ public/
โโโ src/
โ โโโ components/
โ โ โโโ CalcButton.jsx
โ โ โโโ Calculator.jsx
โ โ โโโ ConverterPanel.jsx
โ โ โโโ Display.jsx
โ โ โโโ GraphPanel.jsx
โ โ โโโ HistoryPanel.jsx
โ โ โโโ ScienceToolbar.jsx
โ โ โโโ ThemeToggle.jsx
โ โโโ hooks/
โ โ โโโ useCalculator.js
โ โ โโโ useKeyboard.js
โ โ โโโ useLocalStorage.js
โ โโโ logic/
โ โ โโโ calculator.js
โ โ โโโ constants.js
โ โโโ styles/
โ โ โโโ global.css
โ โโโ App.jsx
โ โโโ main.jsx
โโโ index.html
โโโ package.json
โโโ vite.config.js
โโโ README.md
โโโ .gitignore- add better error messages for invalid expressions
- add support for saving graph presets
- add graph export as image
- add more calculator themes
- add unit tests for calculator logic
- improve accessibility for keyboard and screen reader users
Created by Katarzyna Staลczyk.