← 返回 Skills 市场
openlark

Chartjs

作者 OpenLark · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
110
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install chartjs
功能描述
Chart.js charting skill. Used to generate visual charts such as line charts, bar charts, pie charts, radar charts, scatter plots, etc.
使用说明 (SKILL.md)

Chart.js

Chart.js is a popular open-source charting library supporting 8 chart types, rendered via Canvas with responsive design.

Trigger Scenarios

  • User requests to create/generate/draw a chart
  • User mentions Chart.js or data visualization
  • User requests to visualize data with a chart
  • User uploads data and requests visualization

Installation

npm:

npm install chart.js

CDN (Script Tag):

\x3Cscript src="https://cdn.jsdelivr.net/npm/chart.js">\x3C/script>

Webpack/Rollup (recommended for tree-shaking):

import Chart from 'chart.js/auto';  // Full features, no manual registration needed

Chart Types and Required Components

Each chart type has minimal dependencies; importing on demand optimizes bundle size:

Chart Type Controller Element Default Scale
Bar BarController BarElement CategoryScale(x) + LinearScale(y)
Line LineController LineElement + PointElement CategoryScale(x) + LinearScale(y)
Pie PieController ArcElement
Doughnut DoughnutController ArcElement
PolarArea PolarAreaController ArcElement RadialLinearScale
Radar RadarController LineElement + PointElement RadialLinearScale
Scatter ScatterController PointElement LinearScale(x/y)
Bubble BubbleController PointElement LinearScale(x/y)

Basic Usage

HTML:

\x3Cdiv style="max-width: 600px">
  \x3Ccanvas id="myChart">\x3C/canvas>
\x3C/div>

JavaScript:

const ctx = document.getElementById('myChart');
new Chart(ctx, {
  type: 'bar',  // Chart type
  data: {
    labels: ['January', 'February', 'March'],
    datasets: [{
      label: 'Sales (10k)',
      data: [12, 19, 3],
      borderWidth: 1
    }]
  },
  options: {
    responsive: true,
    scales: {
      y: { beginAtZero: true }
    }
  }
});

Common Configurations

Responsive (auto-adapts to container width)

options: {
  responsive: true,
  maintainAspectRatio: false
}

Fill Line Chart (Area)

datasets: [{
  fill: true,        // or 'origin'/'start'/'end'
  tension: 0.4       // Curve smoothness 0-1
}]

Multiple Datasets

datasets: [
  { label: '2023', data: [1, 2, 3], borderColor: 'red' },
  { label: '2024', data: [3, 2, 1], borderColor: 'blue' }
]

Quick Color Settings

backgroundColor: [
  'rgba(255, 99, 132, 0.5)',
  'rgba(54, 162, 235, 0.5)',
]

Interaction Events

Click to get data point values (requires helpers import):

import Chart from 'chart.js/auto';
import { getRelativePosition } from 'chart.js/helpers';

options: {
  onClick: (e) => {
    const pos = getRelativePosition(e, chart);
    const x = chart.scales.x.getValueForPixel(pos.x);
    const y = chart.scales.y.getValueForPixel(pos.y);
    console.log(x, y);
  }
}

Time Scale

Requires a date adapter (e.g., chartjs-adapter-moment):

import moment from 'moment';
import 'chartjs-adapter-moment';
// Then configure scales with type: 'time'

Output Methods

After generation, there are two output paths:

  1. Render directly in an HTML page — Generate a complete HTML file containing canvas + Chart.js CDN, open with a browser
  2. Screenshot/PDF — Take a screenshot using the browser tool, or generate an image file using puppeteer/canvas

Tip: Generating HTML is the simplest and most reliable output method; let Chart.js handle responsive layout itself.

More References

For detailed API and examples, see references/api.md.

安全使用建议
This is documentation-style help for Chart.js and appears coherent. It does not ask for credentials or system access. Things to keep in mind before you act on its instructions: if you follow the npm install or puppeteer/canvas suggestions, you will install third-party packages—verify package versions and sources and avoid running arbitrary post-install scripts; the CDN link (jsdelivr) is a common choice but will load remote code into a page, so only use it for trusted environments; generating screenshots with a headless browser can access local resources if run on your machine, so review any code the agent proposes to execute and approve installs/commands manually.
功能分析
Type: OpenClaw Skill Name: chartjs Version: 1.0.0 The skill bundle provides standard documentation and instructions for using the Chart.js library to generate data visualizations. It contains legitimate API references, usage examples, and configuration options without any evidence of malicious intent, data exfiltration, or harmful prompt injection (SKILL.md, references/api.md).
能力评估
Purpose & Capability
Name/description (Chart.js charting helper) matches the SKILL.md and reference content. The skill only documents how to install and use Chart.js and related adapters/plugins; nothing requests unrelated services, credentials, or system access.
Instruction Scope
Runtime instructions are documentation and examples (npm install, CDN script tag, example code, tips about using puppeteer/canvas to produce screenshots). The instructions do not direct the agent to read arbitrary system files, access environment variables, or exfiltrate data. The only external network endpoint mentioned is a well-known CDN (jsdelivr) and npm packages relevant to Chart.js.
Install Mechanism
There is no install spec in the registry (instruction-only). The SKILL.md recommends npm and a CDN (jsdelivr) which are standard for front-end libs. It also mentions optional tools like puppeteer/canvas and chartjs-adapter-moment—these are reasonable for image/screenshot generation but would install heavier dependencies if the user chooses that output path.
Credentials
The skill requires no environment variables, credentials, or config paths. Examples reference common JS/browser APIs and optional npm packages only, which are proportionate to chart generation.
Persistence & Privilege
always is false and there is no install action that would persist or modify other skills or system config. The skill being instruction-only means it does not request persistent privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chartjs
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chartjs 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the chartjs skill. - Provides Chart.js integration for generating visual charts (line, bar, pie, radar, scatter, etc.). - Details installation methods (npm, CDN, import) and setup instructions. - Describes chart types, required controllers/elements, and basic usage. - Includes tips for common configurations, responsive layouts, multiple datasets, colors, and interactions. - Covers output methods, including HTML rendering and screenshot/image export. - Reference to additional API documentation for advanced usage.
元数据
Slug chartjs
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Chartjs 是什么?

Chart.js charting skill. Used to generate visual charts such as line charts, bar charts, pie charts, radar charts, scatter plots, etc. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 110 次。

如何安装 Chartjs?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chartjs」即可一键安装,无需额外配置。

Chartjs 是免费的吗?

是的,Chartjs 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Chartjs 支持哪些平台?

Chartjs 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Chartjs?

由 OpenLark(@openlark)开发并维护,当前版本 v1.0.0。

💬 留言讨论