# TikTok Analytics VChart Component
**Production-ready React component for visualizing TikTok video analytics in Lark aPaaS using VChart.**
[](https://www.typescriptlang.org/)
[](https://reactjs.org/)
[](https://www.visactor.io/vchart)
[](LICENSE)
## π Quick Start
### Option 1: Standalone Demo (No Installation)
Open `demo.html` directly in your browser - no build step required!
```bash
open demo.html
```
### Option 2: React Component
#### Installation
```bash
npm install @visactor/vchart react react-dom
```
#### Basic Usage
```tsx
import { VChartComponent } from './src/vchart-component';
const data = [
{
videoId: '123',
title: 'My Video',
views: 1000000,
likes: 50000,
comments: 2000,
shares: 1000,
watchPercent: 75,
datePublished: '2025-01-15',
duration: 45
}
];
function App() {
return (
<VChartComponent
data={data}
chartType="dashboard"
height={600}
responsive={true}
/>
);
}
```
**See [QUICK_START.md](QUICK_START.md) for detailed instructions.**
## Available Chart Types
### 1. Line Chart
Shows views over time trend.
```tsx
<VChartComponent data={data} chartType="line" height={400} />
```
### 2. Bar Chart
Displays top 10 videos by views.
```tsx
<VChartComponent data={data} chartType="bar" height={400} />
```
### 3. Pie Chart
Shows engagement breakdown (likes/comments/shares).
```tsx
<VChartComponent data={data} chartType="pie" height={400} />
```
### 4. Dashboard
Combined multi-chart view.
```tsx
<VChartComponent data={data} chartType="dashboard" height={600} />
```
## π Component Structure
```
src/vchart-component/
βββ index.tsx # Main VChart component
βββ types.ts # TypeScript type definitions
βββ utils.ts # Utility functions
βββ data-fetcher.ts # Data fetcher with MCP proxy
βββ responsive.ts # Responsive design utilities
βββ export.ts # Public API exports
βββ demo.html # Standalone demo (no build!)
βββ deploy.sh # Deployment script
βββ package.json # Package configuration
βββ tsconfig.json # TypeScript config
βββ jest.config.js # Test configuration
β
βββ specs/ # VChart specifications
β βββ index.ts # Spec exports
β βββ line-chart.ts # Views over time
β βββ bar-chart.ts # Top videos
β βββ pie-chart.ts # Engagement breakdown
β βββ dashboard.ts # Combined view
β
βββ component/ # aPaaS integration
β βββ tiktok-dashboard/
β βββ index.tsx # Dashboard component
β βββ meta.ts # Metadata & types
β βββ model.ts # Data hooks
β βββ index.meta.json # aPaaS manifest
β
βββ __tests__/ # Unit tests
β βββ specs.test.ts # Chart spec tests
β βββ utils.test.ts # Utility tests
β βββ data-fetcher.test.ts # Data fetcher tests
β
βββ Documentation
βββ README.md # This file
βββ QUICK_START.md # Quick start guide
βββ IMPLEMENTATION_SUMMARY.md # Complete summary
```
**Complete documentation**: See [APPROACH_C_COMPLETE.md](/APPROACH_C_COMPLETE.md) in project root.
## Data Format
```typescript
interface TikTokVideoData {
videoId: string;
title: string;
views: number;
likes: number;
comments: number;
shares: number;
watchPercent: number;
datePublished: string;
duration: number;
}
```
## β¨ Features
### Visualizations
- β
**4 Chart Types**: Line, Bar, Pie, and Dashboard views
- β
**Interactive Tooltips**: Hover for detailed information
- β
**Smooth Animations**: Professional animations with easing
- β
**TikTok Colors**: Brand-consistent color scheme
- β
**Export**: Save charts as PNG, SVG, or JPEG
### Data & Integration
- β
**Multiple Sources**: Direct API, MCP Proxy, or Bitable SDK
- β
**Auto Caching**: Built-in 60-second cache
- β
**Auto Refresh**: Configurable refresh intervals
- β
**Data Validation**: Type-safe data transformation
- β
**Error Handling**: Comprehensive error boundaries
### Developer Experience
- β
**Full TypeScript**: 100% type coverage
- β
**Unit Tests**: Complete test suite included
- β
**Standalone Demo**: No build required
- β
**Responsive**: Mobile, tablet, desktop support
- β
**Well Documented**: Extensive guides and examples
### Production Ready
- β
**Performance**: Optimized for large datasets
- β
**Accessibility**: ARIA labels and keyboard navigation
- β
**Browser Support**: Chrome, Firefox, Safari, Edge
- β
**Error Recovery**: Graceful degradation
- β
**Loading States**: Proper loading indicators
## Customization
### Colors
Edit `TIKTOK_COLORS` in `index.tsx`:
```typescript
export const TIKTOK_COLORS = {
primary: '#1890ff',
secondary: '#ff4d4f',
success: '#52c41a',
warning: '#faad14',
info: '#13c2c2'
};
```
### Chart Specifications
Customize individual chart specs in the `specs/` directory.
## Browser Support
- Chrome >= 90
- Firefox >= 88
- Safari >= 14
- Edge >= 90
## License
MIT