@classic-homes/charts-svelte

中文文档
0.7.1发布于 2026/11/07MITTypeScriptES Module近 30 天下载 2128

Svelte ECharts components for Classic Theme

原始使用文档
文档目录4 节
  1. Installation
  2. Quick Start
  3. Exports
  4. Related Packages

@classic-homes/charts-svelte

Svelte ECharts components for the Classic Theme design system. Charts pick up the Classic light and dark themes from @classic-homes/charts-core.

Installation

npm install @classic-homes/charts-svelte echarts svelte

Peer dependencies: echarts@^5.5.0, svelte@^5.20.0.

Quick Start

<script lang="ts">
  import { LineChart } from '@classic-homes/charts-svelte';

  const data = {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
    series: [
      { name: '2024', data: [120, 132, 101, 134, 90, 230] },
      { name: '2025', data: [220, 182, 191, 234, 290, 330] },
    ],
  };
</script>

<LineChart title="Monthly Revenue" {data} smooth height={400} />

Exports

  • Charts: LineChart, BarChart, PieChart, AreaChart, ScatterChart, DonutChart, RadarChart, FunnelChart, GaugeChart, HeatmapChart, TreemapChart, CandlestickChart, SankeyChart, ComboChart, DotPlotChart, BulletChart, HistogramChart, BoxPlotChart, WaterfallChart
  • Stat helpers: Sparkline, StatCard, StatGroup
  • Base components: ChartContainer, ChartSkeleton, ChartError, ChartEmpty, ChartLegend, ChartDataTable
  • Composables: useChart, useChartTheme, useChartResize, useChartLegend, useReducedMotion, registerClassicThemes, registerEchartsModules, exportChartImage
  • Data helpers (from @classic-homes/charts-core): fromRecords, toSliceData, binValues, boxplotStats, waterfallLayout, formatValue, computeDelta, tableToCsv, downloadCsv

Chart data and option types are exported from the package root, and also from @classic-homes/charts-core/types.

<script lang="ts">
  import { ChartSkeleton, DonutChart, type PieSliceData } from '@classic-homes/charts-svelte';
</script>
  • @classic-homes/charts-core: shared themes, types, and utilities
  • @classic-homes/charts-react: React equivalents for the core and extended charts

版本与发布记录

@classic-homes/charts-svelte 共发布 49 个版本,首次发布于 2026/01/16;过去 12 个月发布了 49 个版本。

版本发布日期距今
0.7.1latest2026/11/073 天前
0.7.02026/11/064 天前
0.6.02026/11/064 天前
0.5.02026/11/055 天前
0.4.22026/11/055 天前
0.4.12026/10/2219 天前

关于 @classic-homes/charts-svelte 的常见问题

@classic-homes/charts-svelte 是什么?

Svelte ECharts components for Classic Theme

如何安装 @classic-homes/charts-svelte?

在项目目录运行 npm install @classic-homes/charts-svelte,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:svelte(^5.20.0)、echarts(^5.5.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@classic-homes/charts-svelte 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@classic-homes/charts-svelte 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@classic-homes/charts-svelte 可以商用吗?

@classic-homes/charts-svelte 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@classic-homes/charts-svelte 的下载量有多少?

根据 npm 官方下载统计,@classic-homes/charts-svelte 在 2026/10/10 – 2026/11/08 这 30 天内被下载 2,128 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@classic-homes/charts-svelte 还在维护吗?

最新版本 0.7.1 发布于 2026/11/07(3 天前);至今共发布 49 个版本,其中过去 12 个月发布了 49 个;首次发布于 2026/01/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。