Skip to content

Charts Overview

Beautiful, responsive chart components powered by industry-leading charting libraries.

Features

  • ✅ Unified API - Same props and usage across all frameworks (Vue, React, Angular, React Native, Flutter)
  • ✅ Powered by Best-in-Class Libraries - ECharts for web, fl_chart for Flutter
  • ✅ Responsive - Auto-resize on container changes
  • ✅ Theme Support - Light and dark mode out of the box
  • ✅ TypeScript - Full type safety across all frameworks
  • ✅ Accessible - WCAG 2.1 AA compliant
  • ✅ Customizable - Extensive configuration options
  • ✅ Mobile Optimized - Touch-friendly, performant on mobile devices

Available Charts

Chart TypeStatusDescription
Line Chart✅ AvailableDisplay data trends over time with smooth curves
Bar Chart✅ AvailableCompare values across categories with vertical/horizontal bars
Pie Chart✅ AvailableShow proportions and percentages in circular format
Donut Chart✅ AvailableDisplay proportional data with hollow center for emphasis
Area Chart✅ AvailableVisualize cumulative totals with filled areas and gradients
Radar Chart✅ AvailableMulti-dimensional data comparison on radial grid
Scatter Chart✅ AvailableDistribution and correlation analysis with scatter plots
Mixed Chart✅ AvailableCombine multiple chart types (line, bar, area) in one visualization
Gauge Chart✅ AvailableCircular gauge (speedometer) for metrics with min-max ranges and color zones

Design Philosophy

1. Unified API Across All Frameworks

Same data structure, same props, consistent behavior:

typescript
const chartData = {
  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
  datasets: [{
    label: 'Sales 2024',
    data: [30, 45, 35, 50, 49],
    color: '#3b82f6'
  }]
}
vue
<LineChart :data="chartData" :height="350" theme="light" />
tsx
<LineChart data={chartData} height={350} theme="light" />
typescript
<ui-line-chart [data]="chartData" [height]="350" theme="light" />
tsx
<LineChart data={chartData} height={300} theme="light" />
dart
GalaxyLineChart(
  data: chartData,
  height: 300,
  theme: ChartTheme.light,
)

2. Framework-Specific Optimizations

While the API is unified, each implementation is optimized for its platform:

  • Web (Vue/React/Angular): Uses ECharts with full interactivity
  • React Native: Uses @wuba/react-native-echarts with Skia rendering
  • Flutter: Uses fl_chart with native Dart performance

3. Production-Ready

  • Tree-shakeable imports
  • Lazy loading support
  • Minimal bundle impact
  • Comprehensive error handling

Installation

Charts are installed individually via the Galaxy UI CLI:

bash
npx @galaxy-stack/nebula-cli@latest add line-chart
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add line-chart
bash
yarn dlx @galaxy-stack/nebula-cli@latest add line-chart
bash
bunx @galaxy-stack/nebula-cli@latest add line-chart

The CLI automatically:

  • Copies component files to your project
  • Installs required dependencies (ECharts, fl_chart, etc.)
  • Sets up TypeScript types
  • Configures imports

Quick Start Example

Here's a complete example showing how to use charts in your app:

vue
<script setup lang="ts">
import { LineChart } from '@/components/ui/charts'
import { ref } from 'vue'

const salesData = ref({
  labels: ['Q1', 'Q2', 'Q3', 'Q4'],
  datasets: [{
    label: 'Revenue',
    data: [45000, 52000, 48000, 61000],
    color: '#3b82f6'
  }]
})
</script>

<template>
  <div class="p-6 bg-white dark:bg-gray-900 rounded-lg shadow">
    <h2 class="text-2xl font-bold mb-4">Annual Revenue</h2>
    <LineChart
      :data="salesData"
      :height="350"
      theme="light"
      :smooth="true"
    />
  </div>
</template>
tsx
import { LineChart } from '@/components/ui/charts'

const salesData = {
  labels: ['Q1', 'Q2', 'Q3', 'Q4'],
  datasets: [{
    label: 'Revenue',
    data: [45000, 52000, 48000, 61000],
    color: '#3b82f6'
  }]
}

export default function Dashboard() {
  return (
    <div className="p-6 bg-white dark:bg-gray-900 rounded-lg shadow">
      <h2 className="text-2xl font-bold mb-4">Annual Revenue</h2>
      <LineChart
        data={salesData}
        height={350}
        theme="light"
        smooth
      />
    </div>
  )
}

Common Props

All chart components share these common props:

PropTypeDefaultDescription
dataChartDatarequiredChart data with labels and datasets
heightnumber300Chart height in pixels
widthnumber | string'100%'Chart width
theme'light' | 'dark''light'Color theme
legendbooleantrueShow/hide legend
legendPosition'top' | 'bottom' | 'left' | 'right''top'Legend position
animationbooleantrueEnable/disable animations
loadingbooleanfalseShow loading state
emptyTextstring'No data available'Empty state message

Color Schemes

Built-in color schemes for consistent styling:

typescript
import { ChartColorSchemes } from '@/components/ui/charts'

// Available schemes:
ChartColorSchemes.default    // Modern, vibrant
ChartColorSchemes.pastel      // Soft colors
ChartColorSchemes.vivid       // Bold, saturated
ChartColorSchemes.monochrome  // Grayscale

Performance Tips

  1. Use memoization for data that doesn't change frequently
  2. Lazy load chart components for better initial page load
  3. Debounce real-time data updates
  4. Use notMerge option in React for frequent updates
  5. Implement virtual scrolling for large datasets

Browser Support

BrowserVersion
Chrome/Edge90+
Firefox88+
Safari14+
iOS Safari14+
Android Chrome90+

Framework Support

FrameworkStatusLibrary Used
Vue 3✅ FullECharts (via vue-echarts)
React 18+✅ FullECharts (via echarts-for-react)
Angular 20✅ FullECharts (via ngx-echarts)
React Native✅ FullECharts (via @wuba/react-native-echarts)
Flutter✅ Fullfl_chart

Resources

Need Help?

Author

Bùi Trọng Hiếu (kevinbui)

License

MIT © 2025 Bùi Trọng Hiếu (kevinbui)

Released under the MIT License.