Skip to content

Area Chart

Visualize cumulative totals over time with filled areas, smooth curves, and gradient support.

Loading chart...

Installation

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

Dependencies

This component automatically installs the following dependencies:

  • Vue: vue-echarts@^7.0.3, echarts@^5.5.1
  • React: echarts-for-react@^3.0.2, echarts@^5.5.1
  • Angular: ngx-echarts@^18.0.0, echarts@^5.5.1
  • React Native: @wuba/react-native-echarts@^3.0.1, echarts@^5.5.1, @shopify/react-native-skia@^1.6.4
  • Flutter: fl_chart@^0.68.0

Usage

Basic Area Chart

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

const salesData = {
  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
  datasets: [{
    label: 'Revenue',
    data: [30, 45, 35, 50, 49, 60],
    color: '#3b82f6'
  }]
}
</script>

<template>
  <AreaChart :data="salesData" :height="300" />
</template>
tsx
import { AreaChart } from "@/components/ui/charts"

const salesData = {
  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
  datasets: [{
    label: 'Revenue',
    data: [30, 45, 35, 50, 49, 60],
    color: '#3b82f6'
  }]
}

export default function App() {
  return <AreaChart data={salesData} height={300} />
}

With Gradient Fill

vue
<template>
  <AreaChart
    :data="data"
    :height="300"
    :gradient="true"
    :opacity="0.6"
  />
</template>

Stacked Area Chart

vue
<script setup lang="ts">
const data = {
  labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
  datasets: [
    { label: 'Product A', data: [320, 332, 301, 334, 390], color: '#3b82f6' },
    { label: 'Product B', data: [220, 182, 191, 234, 290], color: '#10b981' },
    { label: 'Product C', data: [150, 232, 201, 154, 190], color: '#f59e0b' }
  ]
}
</script>

<template>
  <AreaChart :data="data" :height="400" :stack="true" />
</template>

Dark Theme

vue
<template>
  <div class="dark">
    <AreaChart
      :data="data"
      :height="300"
      theme="dark"
      class="bg-gray-900 rounded-lg p-4"
    />
  </div>
</template>

API Reference

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
smoothbooleantrueSmooth curve lines
showPointsbooleantrueShow points on line
pointSizenumber6Size of points
stackbooleanfalseStack multiple datasets
opacitynumber0.6Area fill opacity (0-1)
gradientbooleanfalseEnable gradient fill
loadingbooleanfalseShow loading state
emptyTextstring'No data available'Empty state message
zoombooleanfalseEnable zoom controls (Web only)

Performance Tips

  1. Disable animations for real-time data: Set animation={false}
  2. Use memoization: Use useMemo (React) or computed (Vue)
  3. Limit data points: Too many points can impact performance
  4. Lazy load: Import chart components dynamically

Browser/Platform Support

PlatformSupportNotes
Chrome 90+✅ FullRecommended
Firefox 88+✅ Full
Safari 14+✅ Full
Edge 90+✅ Full
iOS 14+✅ FullTouch optimized
Android 10+✅ FullTouch optimized

Author

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

License

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

Released under the MIT License.