Skip to content

Mixed Chart

Combine multiple chart types (line, bar, area) in a single visualization for powerful multi-dimensional data analysis.

Loading chart...

Installation

bash
npx @galaxy-stack/nebula-cli@latest add mixed-chart
bash
pnpm dlx @galaxy-stack/nebula-cli@latest add mixed-chart
bash
yarn dlx @galaxy-stack/nebula-cli@latest add mixed-chart
bash
bunx @galaxy-stack/nebula-cli@latest add mixed-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

Features

  • 📊 Multiple Chart Types - Combine line, bar, and area charts in one visualization
  • 🎨 Per-Dataset Styling - Each dataset can have its own chart type and colors
  • 📈 Advanced Analysis - Compare different metrics with appropriate visualizations
  • 📱 Responsive - Adapts to all screen sizes seamlessly
  • 🌓 Dark Mode - Built-in dark theme support
  • Performance - Optimized rendering even with multiple datasets

Use Cases

  • Business Dashboards - Compare revenue, sales, and profit in one view
  • Analytics - Visualize multiple KPIs with appropriate chart types
  • Financial Reports - Mix actual vs. forecast with different visualizations
  • Performance Monitoring - Track multiple metrics over time
  • Multi-Metric Analysis - Combine related data points with suitable chart types

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
gridboolean | GridConfigtrueShow/hide grid lines or custom grid config
tooltipboolean | TooltipConfigtrueEnable/disable tooltip or custom config
animationbooleantrueEnable/disable animations
loadingbooleanfalseShow loading state
emptyTextstring"No data available"Text shown when no data

ChartData Interface

typescript
interface ChartData {
  labels: string[]
  datasets: ChartDataset[]
}

interface ChartDataset {
  label: string
  data: number[]
  type?: 'line' | 'bar' | 'area'  // Specify chart type per dataset
  color?: string
  smooth?: boolean  // For line/area charts
}

Examples

Line + Bar Combination

Compare trends with exact values:

vue
<script setup lang="ts">
const data = {
  labels: ['Q1', 'Q2', 'Q3', 'Q4'],
  datasets: [
    {
      label: 'Target',
      data: [100, 120, 140, 160],
      type: 'line',
      color: '#8b5cf6',
    },
    {
      label: 'Actual',
      data: [90, 130, 135, 155],
      type: 'bar',
      color: '#10b981',
    },
  ],
}
</script>

<template>
  <MixedChart :data="data" />
</template>
tsx
const data = {
  labels: ['Q1', 'Q2', 'Q3', 'Q4'],
  datasets: [
    {
      label: 'Target',
      data: [100, 120, 140, 160],
      type: 'line',
      color: '#8b5cf6',
    },
    {
      label: 'Actual',
      data: [90, 130, 135, 155],
      type: 'bar',
      color: '#10b981',
    },
  ],
}

<MixedChart data={data} />

Multiple Lines + Area

Show ranges with trends:

vue
<script setup lang="ts">
const data = {
  labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
  datasets: [
    {
      label: 'Users',
      data: [1200, 1900, 1500, 2100, 1800],
      type: 'line',
      color: '#3b82f6',
    },
    {
      label: 'Sessions',
      data: [2000, 2800, 2200, 3100, 2700],
      type: 'line',
      color: '#10b981',
    },
    {
      label: 'Bandwidth',
      data: [800, 1200, 900, 1500, 1100],
      type: 'area',
      color: '#f59e0b',
    },
  ],
}
</script>

<template>
  <MixedChart :data="data" :height="400" />
</template>
tsx
const data = {
  labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
  datasets: [
    {
      label: 'Users',
      data: [1200, 1900, 1500, 2100, 1800],
      type: 'line',
      color: '#3b82f6',
    },
    {
      label: 'Sessions',
      data: [2000, 2800, 2200, 3100, 2700],
      type: 'line',
      color: '#10b981',
    },
    {
      label: 'Bandwidth',
      data: [800, 1200, 900, 1500, 1100],
      type: 'area',
      color: '#f59e0b',
    },
  ],
}

<MixedChart data={data} height={400} />

Dark Theme

vue
<MixedChart :data="data" theme="dark" />
tsx
<MixedChart data={data} theme="dark" />

Legend Position

vue
<MixedChart :data="data" legendPosition="bottom" />
tsx
<MixedChart data={data} legendPosition="bottom" />

Tips

  • Consistent Scales: Ensure all datasets use comparable value ranges
  • Type Selection: Use lines for trends, bars for comparisons, areas for volumes
  • Color Contrast: Choose distinct colors for each dataset
  • Legend Clarity: Position legend for easy reference without blocking data
  • Dataset Order: Place most important data in front (last in array)

Released under the MIT License.