This project is a web-based charting application that uses React on the frontend and Django REST framework on the backend. The application visualizes financial data such as candlestick charts and other types of data using the CanvasJS library for charting.
- Clone the Repository:
git clone https://github.com/doranchang/Blockhouse.git cd Blockhouse```
- Set up a virtual environment:
source venv/bin/activate # For Windows: venv\Scripts\activate```
- Install dependencies:
pip install -r requirements.txt
- Run Django migrations:
python manage.py migrate```
- Run Django server:
python manage.py runserver
- Navigate to the frontend directory:
cd nextjs-charts
- Install dependencies:
npm install
- Run the React development server:
npm run dev
Backend (Django):
- Django: A web framework for building the backend API.
- Django REST Framework: An extension for Django that provides a powerful toolkit for building Web APIs.
Frontend (React):
- React: A JavaScript library for building user interfaces.
- Next.js: A React framework that supports server-side rendering and static site generation.
- CanvasJS: A lightweight charting library for creating interactive charts.
Backend:
- API Endpoints: The backend exposes several endpoints to provide chart data in JSON format. Each endpoint corresponds to a specific chart type (e.g., line chart, bar chart, pie chart).
- Data Management: Initially, the data is hard-coded for demonstration purposes. In a production setup, data would be stored in a database and managed through Django models.
Frontend:
- Component-Based Architecture: React's component-based structure helps in managing and rendering UI elements efficiently. Each chart type (e.g., candlestick, line) is implemented as a separate component.
- CanvasJS Integration: The CanvasJS library is used for rendering various types of charts. The data fetched from the backend API is passed to CanvasJS components to render the charts.
- API Communication: Axios is used to make HTTP requests to the Django API endpoints to fetch the chart data.
Development Process:
- Frontend and Backend Development: Development started concurrently on both frontend and backend. This allowed for early integration and testing of data flow between the two components.
- Testing: Initial testing focused on verifying that the frontend correctly received and displayed data from the backend. Further improvements include enhancing interactivity and visual appeal.