This repository demonstrates a prototype implementation of a gauge chart to visualize student task progress. The gauge chart is intended to replace the current pie chart used on the dashboard. This prototype uses the ngx-gauge library and mock data to simulate its functionality.
The purpose of this project is to:
- Provide a more intuitive and compact visualization for student task progress.
- Replace the pie chart with a gauge chart, which highlights the progress value more effectively.
- Serve as a prototype for integrating the gauge chart into a production dashboard.
- Gauge Chart: Displays progress as a percentage in a circular format, focusing on a single value.
- Improved Visualization: Compared to the pie chart, the gauge chart provides a more direct and compact way to interpret progress.
- Mock Data: Simulates student task progress for testing and demonstration purposes.
- Customizable: Can be tailored to match the design and functionality of the final dashboard.
- Focus on a Single Metric: The pie chart divides progress into segments, which can be less intuitive for users. The gauge chart emphasizes the progress percentage clearly.
- Compact Design: Gauge charts are space-efficient and visually appealing.
- Improved Usability: A gauge chart provides immediate feedback on progress without requiring detailed interpretation.
To integrate the gauge chart into an Angular application, the following modules and libraries are required:
-
Angular Core Modules:
- Ensure your project is set up as an Angular application.
-
ngx-gauge Library:
- Install the library using npm:
npm install ngx-gauge
- Install the library using npm:
-
App Module Configuration:
- Import the
NgxGaugeModulein yourapp.module.tsfile:import { NgxGaugeModule } from 'ngx-gauge'; @NgModule({ declarations: [ AppComponent, ], imports: [ BrowserModule, NgxGaugeModule, // Import the Gauge Module ], providers: [], bootstrap: [AppComponent], }) export class AppModule { }
- Import the
-
Dependencies:
- Ensure other Angular dependencies (like
@angular/core,@angular/common, etc.) are installed and up-to-date.
- Ensure other Angular dependencies (like
StackBlitz is an online IDE that lets you run Angular projects directly in your browser without any setup. Follow the steps below to run this project on StackBlitz:
- Visit StackBlitz Angular Starter.
- This will open a blank Angular project with basic files (
app.component.ts,app.component.html, etc.).
- Open the Terminal in StackBlitz (bottom right).
- Run the following command to install the
ngx-gaugelibrary:npm install ngx-gauge
- Copy the contents of the following files from this repository into your StackBlitz project:
app.component.ts: Paste into the existingapp.component.tsfile.app.component.html: Paste into the existingapp.component.htmlfile.data.ts: Create a new file nameddata.tsand paste the content.app.module.ts: Update the existingapp.module.tsto include theNgxGaugeModuleas shown in the Required Modules and Libraries section.
- Save all the changes in StackBlitz.
- The app should automatically reload, and you will see the gauge chart displayed in the browser.
- Modify the mock data in
data.tsto test different progress values.
- Replace the mock data with real data from doubtfire API.
- Customize the gauge chart's design, colors, and ranges to align with the dashboard's theme.
- Test the chart's responsiveness across different devices and screen sizes.
- Integrate the chart into the main dashboard component where the pie chart is currently used.
app.component.ts: Contains the logic for the gauge chart.app.component.html: Defines the template for the gauge chart.data.ts: Stores mock data simulating student task progress.app.module.ts: Configures the Angular app and imports necessary modules.
