Overview
Get a working chart by hand, or paste one prompt and let an agent render one.
Show code for
npm install @chartkitdev/core @chartkitdev/reactimport { Chart } from "@chartkitdev/react";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core @chartkitdev/vue<script setup>
import { Chart } from "@chartkitdev/vue";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
</script>
<template>
<Chart :spec="spec" />
</template>npm install @chartkitdev/core @chartkitdev/svelte<script>
import { Chart } from "@chartkitdev/svelte";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
</script>
<Chart {spec} />npm install @chartkitdev/core @chartkitdev/astro---
import { Chart } from "@chartkitdev/astro";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
---
<Chart spec={spec} />npm install @chartkitdev/core @chartkitdev/solidimport { Chart } from "@chartkitdev/solid";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
export function Panel() {
return <Chart spec={spec} />;
}npm install @chartkitdev/core @chartkitdev/qwikimport { component$ } from "@builder.io/qwik";
import { Chart } from "@chartkitdev/qwik";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
export const Panel = component$(() => {
return <Chart spec={spec} />;
});npm install @chartkitdev/core @chartkitdev/angularimport { Component } from "@angular/core";
import { Chart } from "@chartkitdev/angular";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
@Component({
standalone: true,
imports: [Chart],
template: `<ck-chart [spec]="spec" />`,
})
export class Panel {
spec = spec;
}npm install @chartkitdev/core @chartkitdev/vanillaimport { mount } from "@chartkitdev/vanilla";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
mount(document.querySelector("#chart"), spec);npm install @chartkitdev/core @chartkitdev/elementimport "@chartkitdev/element";
const spec = {
version: "1",
type: "line",
data: [
{ week: "W1", signups: 18 },
{ week: "W2", signups: 42 },
],
encoding: { x: "week", y: "signups" },
a11y: { alt: "Signups rose from 18 to 42." },
};
const chart = document.querySelector("chart-kit");
chart.spec = spec;You should now see a chart.
Paste this into Cursor, Claude, or ChatGPT.
Read https://chartkit.dev/llms.txt.
Write a ChartKit spec (JSON, version "1") for this chart.
Run validate() on the spec. If validate() reports errors, run repair().
Render it with the ChartKit package for my framework, or show the rendered SVG.Put this block in .cursor/mcp.json and in Claude Desktop's claude_desktop_config.json.
{
"mcpServers": {
"chartkit": {
"command": "npx",
"args": ["-y", "@chartkitdev/mcp"]
}
}
}You should now see a chart.
Next steps
- Concepts. The spec, data, and encoding.
- Validate. Check a spec, then repair it.
- Theming. Theme, tokens, and presets.
- Gallery. Every chart type.
- Playground. Edit a spec and render it.