Overview
Analytics features are role-specific, providing insights relevant to each user type:Manager Analytics
Pie charts showing profit distribution across all inventory items and team performance
Salesperson Analytics
Bar graphs tracking daily profit generation over time with trend analysis
Manager Analytics
Managers access profit analysis through visual pie charts that break down revenue by product.Accessing Manager Analytics
Pie Chart Components
The manager analytics uses MPAndroidChart library for visualization:Graph/GraphManagerActivity.java:32-37
Data Calculation
The system calculates profit distribution across all inventory items:Retrieve Inventory
Fetch all inventory items for the current manager:Source:
Graph/GraphManagerActivity.java:54-60Calculate Total Profit
Sum profit from all inventory items:Source:
Graph/GraphManagerActivity.java:62-70Total profit = Sum of (Profit per unit × Quantity sold) for all items
Calculate Percentages
Compute each item’s percentage contribution:Source:
Graph/GraphManagerActivity.java:72-78Formula: Percentage = (Item Profit ÷ Total Profit) × 100Chart Customization
The pie chart includes several visual enhancements:Graph/GraphManagerActivity.java:92-99
Real-Time Updates
The pie chart updates automatically when inventory changes:Graph/GraphManagerActivity.java:109-161
When a salesperson records a sale, the manager’s pie chart automatically recalculates and updates the profit distribution.
What the Chart Shows
Profit Distribution
Profit Distribution
Each pie slice represents the percentage of total profit contributed by a specific inventory item.Example:
- Total Profit: $10,000
- Laptop Sales Profit: $4,000 → 40% of pie
- Phone Sales Profit: $3,000 → 30% of pie
- Tablet Sales Profit: $2,000 → 20% of pie
- Accessories Profit: $1,000 → 10% of pie
Color Coding
Color Coding
The chart uses the ColorTemplate.VORDIPLOM_COLORS palette, assigning distinct colors to each product for easy differentiation.
Legend
Legend
A legend at the bottom lists all products with their corresponding colors, helping you identify each slice.
Center Text
Center Text
The center displays “Your Profit Analysis” as the chart title.
Salesperson Analytics
Salespersons view their performance through bar charts showing daily profit trends.Accessing Salesperson Analytics
Bar Chart Components
The salesperson analytics uses a bar chart for time-series data:Graph/GraphSalespersonActivity.java:32-38
Data Retrieval
Performance data is fetched from the GraphSalesperson collection:Get Salesperson Name
Retrieve the current user’s name:Source:
Graph/GraphSalespersonActivity.java:56-64Fetch Graph Data
Query the GraphSalesperson collection for historical profit data:Source:
Graph/GraphSalespersonActivity.java:67-88Build Bar Entries
Create bar entries with day offsets:Source:
Graph/GraphSalespersonActivity.java:76-86The X-axis represents days since your first recorded sale, with day 0 being your first sale date.
Graph Data Model
Sales data points are stored as GraphObject instances:Recording Graph Data
When a salesperson records a sale, the profit is added to the graph:SalespersonMain.java:179-186
The GraphSalesperson.create() method:
- Stores the profit amount
- Records the current date
- Associates with the salesperson’s name
- Adds to Firebase for chart rendering
Axis Customization
The bar chart includes detailed axis formatting:Graph/GraphSalespersonActivity.java:102-119
What the Chart Shows
X-Axis: Days Since First Sale
X-Axis: Days Since First Sale
The horizontal axis shows days elapsed since your first recorded sale:
- Day 0: Your first sale date
- Day 1-29: Subsequent days in the current month
- Cycles through 30-day periods
Y-Axis: Profit Amount
Y-Axis: Profit Amount
The vertical axis displays the profit generated on each day:
- Higher bars = More profitable days
- Bar height corresponds to total profit for that day
- Multiple sales on the same day are aggregated
Bar Colors
Bar Colors
Bars use the VORDIPLOM color scheme, with different colors for visual variety.
Animation
Animation
The chart animates with a bounce effect over 3 seconds when first loaded, making data easier to digest.
Analytics Use Cases
Manager: Identifying Top Products
Manager: Identifying Top Products
Workflow:
- Open Manager Statistics
- Review pie chart slices
- Identify largest slices (highest profit contributors)
- Focus inventory and marketing on these products
- Consider adding similar items
- Analyze underperforming products (small slices)
- Allocate more inventory to high-profit items
- Provide additional training on top products
- Discontinue consistently low-performing items
Manager: Profit Distribution Analysis
Manager: Profit Distribution Analysis
Workflow:
- Check if profit is concentrated in few items
- Look for diversification opportunities
- Compare current chart with previous periods
- Set targets to balance profit sources
- Over-reliance on single product = Risk
- Balanced distribution = Stable revenue
- Seasonal variations in product performance
Salesperson: Tracking Performance Trends
Salesperson: Tracking Performance Trends
Workflow:
- Open Salesperson Statistics
- Review bar chart for trends
- Identify high-performance days
- Look for patterns (weekly, monthly)
- Compare recent performance to earlier periods
- Upward trend = Improving performance
- Consistent bars = Steady sales rhythm
- Gaps = Days with no sales (identify why)
- Spikes = Exceptional days (learn what worked)
Salesperson: Goal Setting
Salesperson: Goal Setting
Workflow:
- View your average bar height
- Identify your highest profit day
- Set goal to consistently reach that level
- Track progress over coming weeks
- Adjust strategies based on results
- Use analytics as motivation
- Aim to eliminate low-performance days
- Replicate successful days
- Build consistent high-performance habits
Loading States
Both analytics screens show progress indicators during data loading:Graph/GraphManagerActivity.java:47-81 and Graph/GraphSalespersonActivity.java:47-90
Technical Implementation
MPAndroidChart Library
The app uses the MPAndroidChart library for professional chart rendering:- PieChart: Manager profit distribution
- BarChart: Salesperson performance over time
- Animations: Smooth chart loading
- Gestures: Pinch-to-zoom, tap-to-highlight
- Legends: Automatic color coding
Firebase Integration
Charts pull data directly from Firebase Realtime Database: Manager Data:Best Practices
Regular Review
Check analytics weekly to spot trends early and adjust strategies
Compare Periods
Take screenshots of charts to compare performance month-over-month
Data-Driven Decisions
Use charts to guide inventory, training, and sales focus
Team Discussions
Share analytics insights in team meetings for collective improvement
Limitations
For detailed profit breakdowns beyond what charts show, navigate to individual inventory items or use the “My Team” feature to drill down into specific salesperson performance.