Skip to main content

Component Architecture

The Fuzzy C-Means clustering application is built with four main React components that work together to provide an interactive clustering visualization experience:
  1. InputPoint - Handles user input for adding data points and centroids
  2. DataChart - Visualizes points and centroids using Chart.js scatter plots
  3. MatrixTable - Displays membership matrices in a tabular format
  4. PointTable - Shows point and centroid coordinates in table form

Component Hierarchy

The components follow a simple, flat hierarchy where each component receives data through props from the parent application state:
App
├── InputPoint (for points)
├── InputPoint (for centroids)
├── DataChart
├── MatrixTable
└── PointTable
All components use the shared Point type:
type Point = {
    x: number,
    y: number
}

Component Details

InputPoint

Component for adding data points and centroids manually or randomly

DataChart

Scatter plot visualization with dynamic color coding based on membership values

MatrixTable

Table component for displaying membership matrices with centroid-point relationships

PointTable

Simple table for displaying point and centroid coordinates

Technology Stack

The components leverage the following libraries:
  • React - Core UI framework
  • Ant Design - UI components (Table, InputNumber)
  • Chart.js with react-chartjs-2 - Data visualization
  • TypeScript - Type safety
  • Tailwind CSS - Styling

Data Flow

All components follow a unidirectional data flow pattern:
  1. User interactions trigger callback functions passed via props
  2. Parent component updates application state
  3. Updated state flows down to components as props
  4. Components re-render with new data
This architecture ensures predictable behavior and makes the components easy to test and maintain.

Build docs developers (and LLMs) love