スキル一覧に戻る
LounisBou

vuejs-apex-charts

by LounisBou

0🍴 0📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: vuejs-apex-charts description: | ApexCharts integration for Vue 3 using vue3-apexcharts for data visualization. WHEN: Creating charts in Vue 3 (line, bar, pie, donut, radar, heatmap), building dashboards, real-time chart updates, integrating API data with charts. WHEN NOT: Non-Vue projects, other chart libraries (Chart.js, D3), general Vue development (use vuejs-dev).

Vue 3 ApexCharts

Complete guide for ApexCharts in Vue 3 using vue3-apexcharts.

Installation

npm install apexcharts vue3-apexcharts

Setup

// main.js
import { createApp } from 'vue'
import VueApexCharts from 'vue3-apexcharts'
import App from './App.vue'

const app = createApp(App)
app.use(VueApexCharts)
app.mount('#app')

Local Registration

<script setup>
import VueApexCharts from 'vue3-apexcharts'
</script>

<template>
  <VueApexCharts type="line" :options="options" :series="series" />
</template>

Component Props

PropTypeDefaultDescription
typeString'line'Chart type (required)
seriesArray[]Data series (required)
optionsObject{}Chart configuration
widthString/Number'100%'Chart width
heightString/Number'auto'Chart height

Basic Usage

<script setup>
import { ref } from 'vue'

const options = ref({
  chart: { id: 'basic-chart' },
  xaxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'] }
})

const series = ref([{
  name: 'Sales',
  data: [30, 40, 35, 50, 49]
}])
</script>

<template>
  <apexchart 
    type="line" 
    height="350" 
    :options="options" 
    :series="series" 
  />
</template>

Chart Types Quick Reference

TypeValueUse Case
LinelineTrends over time
AreaareaVolume/cumulative data
BarbarHorizontal comparisons
Columnbar + verticalVertical comparisons
PiepiePart of whole (few items)
DonutdonutPart of whole with center
RadarradarMulti-variable comparison
HeatmapheatmapMatrix/density data
CandlestickcandlestickFinancial OHLC data
RadialBarradialBarProgress/gauges
TreemaptreemapHierarchical data
ScatterscatterCorrelation analysis
Bubblebubble3-variable comparison

For detailed chart configurations, see:

  • references/charts-cartesian.md - Line, Area, Bar, Column, Scatter, Bubble
  • references/charts-circular.md - Pie, Donut, RadialBar, PolarArea
  • references/charts-specialized.md - Heatmap, Treemap, Radar, Candlestick, BoxPlot, RangeBar

Updating Charts

In Vue 3, charts auto-update when reactive props change:

<script setup>
import { ref } from 'vue'

const series = ref([{ name: 'Sales', data: [30, 40, 35] }])
const options = ref({ chart: { id: 'my-chart' } })

// Update data - chart auto-updates
function updateData() {
  series.value = [{ name: 'Sales', data: [50, 60, 45] }]
}

// Update options - chart auto-updates
function updateOptions() {
  options.value = {
    ...options.value,
    theme: { palette: 'palette2' }
  }
}
</script>

Series Data Formats

Category Data (Most Common)

// Data + separate categories
series: [{ name: 'Sales', data: [30, 40, 35, 50] }]
options: { xaxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr'] } }
// Self-contained with labels
series: [{
  name: 'Sales',
  data: [
    { x: 'Jan', y: 30 },
    { x: 'Feb', y: 40 },
    { x: 'Mar', y: 35 }
  ]
}]

Numeric XY Data

// For scatter/bubble charts
series: [{
  name: 'Points',
  data: [
    { x: 10, y: 20 },
    { x: 15, y: 35 },
    { x: 20, y: 25 }
  ]
}]
options: { xaxis: { type: 'numeric' } }

Datetime Data

// Timestamps or date strings
series: [{
  name: 'Traffic',
  data: [
    { x: new Date('2024-01-01').getTime(), y: 100 },
    { x: new Date('2024-01-02').getTime(), y: 150 }
  ]
}]
options: { xaxis: { type: 'datetime' } }

Pie/Donut Data

// Single array with labels
series: [44, 55, 13, 43, 22]
options: { labels: ['Apple', 'Mango', 'Orange', 'Banana', 'Grape'] }

// Or XY format (v5.3+)
series: [{
  data: [
    { x: 'Apple', y: 44 },
    { x: 'Mango', y: 55 }
  ]
}]

For data transformation patterns, see references/data-patterns.md

Common Options Structure

const options = {
  chart: {
    id: 'unique-id',
    type: 'line',
    height: 350,
    toolbar: { show: true },
    zoom: { enabled: true }
  },
  title: { text: 'Chart Title', align: 'center' },
  subtitle: { text: 'Subtitle', align: 'center' },
  xaxis: {
    type: 'category', // 'category' | 'datetime' | 'numeric'
    categories: [],
    title: { text: 'X Axis' }
  },
  yaxis: {
    title: { text: 'Y Axis' },
    min: 0,
    max: 100
  },
  stroke: { curve: 'smooth', width: 2 },
  dataLabels: { enabled: false },
  legend: { position: 'top' },
  tooltip: { enabled: true, shared: true },
  colors: ['#008FFB', '#00E396', '#FEB019'],
  responsive: [{
    breakpoint: 768,
    options: { chart: { height: 300 } }
  }]
}

For complete options reference, see references/options-reference.md

References

FileContent
references/charts-cartesian.mdLine, Area, Bar, Column, Scatter, Bubble charts
references/charts-circular.mdPie, Donut, RadialBar, PolarArea charts
references/charts-specialized.mdHeatmap, Treemap, Radar, Candlestick, Funnel
references/options-reference.mdComplete options API reference
references/methods-events.mdChart methods and event handlers
references/data-patterns.mdAPI integration, real-time updates, datetime
references/styling-tailwind.mdTailwind CSS integration, themes, dark mode

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です