Line Area Chart
by dennisadriaans
Build LineChart and AreaChart components. Use for time series, trends, and continuous data visualization.
Skill Details
Repository Files
1 file in this skill directory
name: line-area-chart description: Build LineChart and AreaChart components. Use for time series, trends, and continuous data visualization.
LineChart & AreaChart
LineChart and AreaChart share the same API. LineChart is essentially AreaChart with hideArea: true.
Data Structure Pattern
┌──────────────────────────────────────────────────────────┐
│ DATA FLOW │
│ │
│ Raw Data Array Categories Config │
│ ┌─────────────┐ ┌──────────────────┐ │
│ │ { x, y1, y2 }│ + │ y1: {name, color}│ → Chart │
│ │ { x, y1, y2 }│ │ y2: {name, color}│ │
│ │ ... │ └──────────────────┘ │
│ └─────────────┘ │
└──────────────────────────────────────────────────────────┘
Complete Example
<script setup lang="ts">
import { LineChart, CurveType, LegendPosition } from 'vue-chrts'
interface DataItem {
date: string
desktop: number
mobile: number
}
const data: DataItem[] = [
{ date: '2024-01-01', desktop: 186, mobile: 120 },
{ date: '2024-01-02', desktop: 305, mobile: 250 },
{ date: '2024-01-03', desktop: 237, mobile: 180 },
{ date: '2024-01-04', desktop: 273, mobile: 220 },
{ date: '2024-01-05', desktop: 209, mobile: 170 },
]
const categories = {
desktop: { name: 'Desktop', color: '#3b82f6' },
mobile: { name: 'Mobile', color: '#10b981' }
}
const xFormatter = (tick: number) => {
const item = data[tick]
return new Date(item.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })
}
const yFormatter = (tick: number) => `${tick.toLocaleString()}`
</script>
<template>
<LineChart
:data="data"
:categories="categories"
:height="300"
:xFormatter="xFormatter"
:yFormatter="yFormatter"
:curveType="CurveType.MonotoneX"
:legendPosition="LegendPosition.TopRight"
xLabel="Date"
yLabel="Visitors"
:xNumTicks="5"
:yNumTicks="4"
:yGridLine="true"
/>
</template>
AreaChart Specific Features
<!-- Stacked area chart -->
<AreaChart
:data="data"
:categories="categories"
:height="300"
:stacked="true"
:xFormatter="xFormatter"
/>
<!-- Custom gradient stops -->
<AreaChart
:data="data"
:categories="categories"
:height="300"
:gradientStops="[
{ offset: '0%', stopOpacity: 0.4 },
{ offset: '100%', stopOpacity: 0.05 }
]"
/>
<!-- Hide area (becomes LineChart) -->
<AreaChart
:data="data"
:categories="categories"
:height="300"
:hideArea="true"
/>
Key Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
data |
T[] |
required | Array of data objects |
categories |
Record<string, BulletLegendItem> |
required | Map of data keys to display config |
height |
number |
required | Chart height in pixels |
curveType |
CurveType |
Linear |
Line interpolation style |
lineWidth |
number |
2 |
Stroke width of lines |
lineDashArray |
number[][] |
undefined |
Dashed line patterns per series |
stacked |
boolean |
false |
Stack areas on top of each other |
hideArea |
boolean |
false |
Show only lines (AreaChart only) |
gradientStops |
Array<{offset, stopOpacity}> |
default gradient | Custom fill gradient |
xFormatter |
(tick, i?, ticks?) => string |
- | X-axis label formatter |
yFormatter |
(tick, i?, ticks?) => string |
- | Y-axis label formatter |
tooltipTitleFormatter |
(data: T) => string |
- | Custom tooltip title |
xNumTicks |
number |
auto | Desired x-axis tick count |
yNumTicks |
number |
auto | Desired y-axis tick count |
minMaxTicksOnly |
boolean |
false |
Show only first/last x ticks |
xGridLine |
boolean |
false |
Show vertical grid lines |
yGridLine |
boolean |
false |
Show horizontal grid lines |
xDomainLine |
boolean |
true |
Show x-axis line |
yDomainLine |
boolean |
true |
Show y-axis line |
hideLegend |
boolean |
false |
Hide the legend |
hideTooltip |
boolean |
false |
Hide tooltips |
legendPosition |
LegendPosition |
TopRight |
Legend placement |
Curve Types Cheat Sheet
Linear ──────── MonotoneX ∿∿∿∿∿ Step ┌─┐┌─┐
Best for: Best for: Best for:
Discrete data Smooth trends Discrete states
Natural ~~~~~ Basis ∼∼∼∼∼ Cardinal ≈≈≈≈
Best for: Best for: Best for:
Flowing curves Extra smooth Balanced curves
Common Gotchas
- X-axis shows numbers instead of labels: You forgot
xFormatter - Only one series shows: Categories keys must match data object keys exactly
- Tooltip shows wrong info: Use
tooltipTitleFormatterfor custom display - Lines look jagged: Try
CurveType.MonotoneXinstead ofLinear
Related Skills
Xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Analyzing Financial Statements
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
Data Storytelling
Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.
Team Composition Analysis
This skill should be used when the user asks to "plan team structure", "determine hiring needs", "design org chart", "calculate compensation", "plan equity allocation", or requests organizational design and headcount planning for a startup.
Startup Financial Modeling
This skill should be used when the user asks to "create financial projections", "build a financial model", "forecast revenue", "calculate burn rate", "estimate runway", "model cash flow", or requests 3-5 year financial planning for a startup.
Kpi Dashboard Design
Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Startup Metrics Framework
This skill should be used when the user asks about "key startup metrics", "SaaS metrics", "CAC and LTV", "unit economics", "burn multiple", "rule of 40", "marketplace metrics", or requests guidance on tracking and optimizing business performance metrics.
