VibeFox JS Charts — Help
Overview
VibeFox JS Charts is a charting library for web applications: more than 35 series types on one canvas — from lines, columns and pies to sankey diagrams, treemaps, word clouds and geographic maps — with zoom, drilldown, real-time data, dashboards and vector export. It is plain JavaScript with no dependencies and works with or without a framework.
You create a chart with one call, createChart(target, options), and control it through the same methods as every VibeFox JS library: setData, setOptions, on, getState, setState, setTheme, destroy.
Key features
- Series: line, area, column, bar, scatter, bubble, pie, donut, radar, gauge, heatmap, treemap, sunburst, funnel, pyramid, waterfall, box plot, histogram, range area / column / bar, polar, radial bar, bullet, sankey, chord, dependency wheel, arc diagram, network, word cloud, Venn, timeline, x-range, and the map series map, mapbubble, mappoint, mapline.
- Axes: category, linear, time and logarithmic, several y axes, stacking, annotations, "smart stats" lines (min, max, average, trend).
- Interaction: tooltips with a crosshair, legend toggles, zoom and pan with mouse, touch and keyboard, a navigator, a range selector, a scrollbar, drilldown with breadcrumbs, dragging points to edit the data with undo / redo.
- Data: real-time appending with a sliding window, CSV, HTML tables, datasets and Google Sheets as data sources; large data with downsampling and optional WebGL.
- Geographic maps from your GeoJSON / TopoJSON: choropleths, bubbles, points and routes, seven projections, zoom.
- Dashboards from one JSON configuration: KPI tiles, charts, filter controls and cross-filtering between the charts.
- Export: PNG, SVG, vector PDF, printing, CSV and Excel; an accessible data table view; rendering to SVG / PNG without a DOM (Node, workers).
- Text to chart ("sales by region as pie") and "explain this chart" with built-in rules; an optional adapter for your own language model.
- Five ready-made styles and eleven palettes (several safe for color blindness), fill patterns, every color and size as a CSS variable, themes, right-to-left layout, keyboard navigation over the points and a spoken summary.
Requirements
- A current web browser.
- No runtime dependencies. The library makes no network requests of its own; a data source with a
urlor Google Sheets link is loaded only when you give one. - Node.js is not needed in the browser. The ES module can be imported in Node (no DOM is touched at import):
renderToSVGrenders charts without a DOM,renderToPNGwith a canvas library you provide, andparseCSV,textToChart,explainChartand the Excel helpers run on a server. - Map data (GeoJSON / TopoJSON) is yours: the library ships no maps.
Installation
Files of the library
VibeFox JS Charts is a separate product with its own files. The whole JavaScript of the library is one file and the styles are one CSS file: a page needs exactly these two. The other files are optional.
| File | What it is |
|---|---|
vibefox-js-charts.global.js | The library for a classic <script> tag; defines one global variable, VibeFoxJSCharts. Minified: vibefox-js-charts.global.min.js. |
vibefox-js-charts.esm.js | The same code as an ES module. Minified: vibefox-js-charts.esm.min.js. |
vibefox-js-charts.css | All styles of the library, inside @layer vfjs; includes the themes light, dark and high-contrast. Minified: vibefox-js-charts.min.css. |
vibefox-js-themes.css | Optional theme pack: 18 ready-made themes (see Theming and styling). Minified: vibefox-js-themes.min.css. |
locales/vibefox-js-charts.<lang>.js | Optional language files, one for each language except English (see Localization and RTL). The same language as an ES module: .esm.js; as plain strings: .json. |
vibefox-js-charts.d.ts | TypeScript declarations (also vibefox-js-charts.esm.d.ts). |
*.js.map | Source maps. |
vibefox-js-charts-react.js, vibefox-js-charts-vue.js, vibefox-js-charts-svelte.js, vibefox-js-charts-jquery.js | Optional framework wrappers (each with its .d.ts). |
vibefox-js-charts-angular | Optional Angular package (Angular Package Format). |
vibefox-js-charts-wc.js | Optional Web Components wrapper (custom elements). |
Script tag
Link the CSS file and the script. The global variable VibeFoxJSCharts holds every export of the library. This also works from a file opened from disk (file://).
<link rel="stylesheet" href="vibefox-js-charts.css">
<script src="vibefox-js-charts.global.js"></script>
<script>
const chart = VibeFoxJSCharts.createChart('#app', { series });
</script>
ES module
Import the ES module file and link the CSS file. Browsers load modules only over http(s), not from file://.
<link rel="stylesheet" href="vibefox-js-charts.css">
<script type="module">
import { createChart } from './vibefox-js-charts.esm.js';
const chart = createChart('#app', { series });
</script>
npm
The library is also prepared as an npm package named @vibefox/js-charts. Install it from the package folder (or its packed .tgz file) that you received, then import it by name. Bundlers take the CSS through the @vibefox/js-charts/css export.
npm install ./vibefox-js-charts
import { createChart } from '@vibefox/js-charts';
import '@vibefox/js-charts/css';
Exports of the package: @vibefox/js-charts (ES module), @vibefox/js-charts/min, @vibefox/js-charts/global, @vibefox/js-charts/global.min, @vibefox/js-charts/css, @vibefox/js-charts/min.css, @vibefox/js-charts/themes, @vibefox/js-charts/themes.min.css, @vibefox/js-charts/locales/<lang>, @vibefox/js-charts/locales/<lang>.json. TypeScript finds the declarations by itself.
Framework wrappers
The wrappers are small separate files; the library works without them. Each wrapper needs only VibeFox JS Charts and its framework (a peer dependency). The wrappers do not load CSS: link vibefox-js-charts.css yourself.
| Framework | File | npm package | Supported versions |
|---|---|---|---|
| React | vibefox-js-charts-react.js | @vibefox/js-charts-react | React 16.8 and newer |
| Vue 3 | vibefox-js-charts-vue.js | @vibefox/js-charts-vue | Vue 3.3 and newer |
| Angular | vibefox-js-charts-angular | @vibefox/js-charts-angular | Angular 17 and newer |
| Svelte | vibefox-js-charts-svelte.js | @vibefox/js-charts-svelte | Svelte 3, 4 and 5 |
| jQuery | vibefox-js-charts-jquery.js | @vibefox/js-charts-jquery | jQuery 1.12 to 4.x |
| Web Components | vibefox-js-charts-wc.js | @vibefox/js-charts-wc | no framework |
The ES module wrappers import the library as @vibefox/js-charts. Without npm, map that name to vibefox-js-charts.esm.js in your bundler settings or in an import map. The jQuery wrapper takes the library from the global VibeFoxJSCharts.
Common rules of all wrappers: props / inputs are the options of the library (changed ones go to setData or one setOptions call); events are framework events with the same payload object as on(); the instance is available for every method; on the server (SSR) an empty container is rendered and the instance is created in the browser only. The option style (ready-made look) is the prop variant in React, Vue, Svelte and Angular, because style and className / class belong to the host element.
Web Components
Load vibefox-js-charts-wc.js after the library file. It defines the elements <vfjs-chart> and <vfjs-chart-dashboard> from the global VibeFoxJSCharts. Attributes are options in kebab-case (JSON for objects and arrays), properties are options, the methods of the component are methods of the element, events are CustomEvents named vfjschart:<event> (dashboard: vfjschartdashboard:<event>) with the payload in detail. The element uses the light DOM, so the CSS of the library and your page CSS apply as usual.
<link rel="stylesheet" href="vibefox-js-charts.css">
<script src="vibefox-js-charts.global.js"></script>
<script type="module" src="vibefox-js-charts-wc.js"></script>
<vfjs-chart id="g" style="height: 300px" title="Sales"></vfjs-chart>
<script>
const el = document.getElementById('g');
el.series = [{ name: 'Sales', type: 'column', data: [5, 8, 3] }];
el.addEventListener('vfjschart:pointClick', (e) => console.log(e.detail.point));
</script>
With a bundler: import * as lib from '@vibefox/js-charts'; import { define } from '@vibefox/js-charts-wc'; define(lib);
Quick start
Plain HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="vibefox-js-charts.css">
<script src="vibefox-js-charts.global.js"></script>
</head>
<body>
<div id="app" style="height: 360px"></div>
<script>
const chart = VibeFoxJSCharts.createChart('#app', {
title: 'Sales 2026',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Plan', type: 'column', data: [10, 12, 9, 14, 15, 13] },
{ name: 'Fact', type: 'line', data: [8, 14, 11, 13, 17, 16], markers: true, stats: ['avg'] },
],
yAxis: { title: 'k EUR' },
on: { pointClick: (e) => console.log(e.series.name, e.point) },
});
</script>
</body>
</html>
The chart fills its element: give the element a height (without one, the chart is 400 px high: the variable --vfjs-charts-min-height).
React
import { useRef } from 'react';
import { VibeFoxJSChartReact } from '@vibefox/js-charts-react';
import '@vibefox/js-charts/css';
const series = [{ name: 'Sales', type: 'column', data: [5, 8, 3] }];
export function Sales() {
const chart = useRef(null); // the VibeFoxJSChart instance
return (
<div style={{ height: 300 }}>
<button onClick={() => chart.current.exportPNG('sales.png')}>PNG</button>
<VibeFoxJSChartReact ref={chart} series={series} categories={['A', 'B', 'C']} onPointClick={(e) => console.log(e.point)} />
</div>
);
}
The dashboard wrapper is VibeFoxJSChartDashboardReact.
Vue 3
<script setup>
import { ref } from 'vue';
import { VibeFoxJSChartVue } from '@vibefox/js-charts-vue';
import '@vibefox/js-charts/css';
const series = ref([{ name: 'Sales', type: 'line', data: [5, 8, 3] }]);
</script>
<template>
<VibeFoxJSChartVue :series="series" :categories="['A', 'B', 'C']" style="height: 300px" @point-click="(e) => console.log(e.point)" />
</template>
Angular
import { Component } from '@angular/core';
import { VibeFoxJSChartComponent } from '@vibefox/js-charts-angular';
@Component({
selector: 'app-root',
standalone: true,
imports: [VibeFoxJSChartComponent],
template: `
<vfjs-chart-ng #chart [series]="series" [categories]="categories" style="display: block; height: 300px"
(pointClick)="clicked($event)"></vfjs-chart-ng>
<button (click)="chart.instance?.exportSVG('chart.svg')">SVG</button>`,
})
export class AppComponent {
series = [{ name: 'Sales', type: 'column', data: [5, 8, 3] }];
categories = ['A', 'B', 'C'];
clicked(e: unknown) { console.log(e); }
}
Link vibefox-js-charts.css in angular.json (styles) or in index.html. For NgModule applications import VibeFoxJSChartsModule.
Svelte
<script>
import { vfjsChart } from '@vibefox/js-charts-svelte';
let series = [{ name: 'Sales', type: 'column', data: [5, 8, 3] }];
</script>
<div style="height: 300px" use:vfjsChart={{ series, categories: ['A', 'B', 'C'] }}
on:vfjschart:pointClick={(e) => console.log(e.detail.point)}></div>
jQuery
<script src="jquery.min.js"></script>
<link rel="stylesheet" href="vibefox-js-charts.css">
<script src="vibefox-js-charts.global.js"></script>
<script src="vibefox-js-charts-jquery.js"></script>
<script>
$('#chart').vfjsChart({ series: [{ type: 'pie', data: [{ name: 'A', value: 3 }, { name: 'B', value: 5 }] }] })
.on('vfjschart:pointClick', (e, payload) => console.log(payload.point));
</script>
Core concepts
Series and points
A chart shows a list of series. Each series has a type (default 'line'), a name, an optional id and color, and its data. Shared x categories go into the chart option categories. A point may be:
- a number (the value at the category of the same index);
[x, y]or[x, y, r](bubbles) — x is a number, aDate, an ISO date string or a category name;- an object:
{ x, y },{ name, value }(pie, funnel, treemap),{ low, high }(ranges),{ from, to, weight }(links),{ code, value }(map regions) and the other fields listed under Series types;labelandcolorwork on every point; null— a gap.
Creating and destroying
const chart = VibeFoxJSCharts.createChart('#app', { series: [{ type: 'line', data: [1, 3, 2] }] });
chart.setData([{ type: 'column', data: [4, 5, 6] }]); // replace the series (animated)
chart.setOptions({ title: 'New title', legend: { position: 'right' } });
chart.setOption('yAxis.title', 'Units');
chart.addSeries({ id: 'b', name: 'B', data: [2, 2, 2] });
chart.removeSeries('b');
chart.destroy();
new VibeFoxJSChart(target, options) is the same as createChart. The option data is the same as series.
Events
Every event handler receives one payload object. Subscribe in the options (on: { pointClick: fn }) or later with on, once and off; on('*', (event, payload) => …) receives every event.
chart.on('pointClick', (e) => console.log(e.series.name, e.index, e.point));
chart.on('zoomChange', (e) => console.log(e.xMin, e.xMax));
chart.on('seriesToggle', (e) => console.log(e.id, e.hidden));
Every VibeFox JS component emits ready, dataChange, optionsChange, themeChange and destroy. The drag events pointDragStart, pointDrag and pointDrop can be cancelled with preventDefault(). The full list is in API reference.
State snapshots
getState() returns a JSON-safe snapshot: zoom window, hidden series and slices, data labels, logarithmic axes, style and palette, dragged network nodes, the drilldown path, the pressed range button and the map view. setState(state) restores it.
localStorage.setItem('sales-chart', JSON.stringify(chart.getState()));
chart.setState(JSON.parse(localStorage.getItem('sales-chart')));
Series types
Cartesian series
line, area, column, bar (horizontal), scatter, bubble, heatmap, waterfall, boxplot, histogram, rangeArea, rangeColumn, rangeBar, xrange. Series of different types can share one chart (for example columns and a line).
VibeFoxJSCharts.createChart('#app', {
categories: ['Q1', 'Q2', 'Q3', 'Q4'],
stacked: true,
series: [
{ name: 'North', type: 'column', data: [5, 6, 7, 8], borderRadius: 4 },
{ name: 'South', type: 'column', data: [3, 4, 2, 5], pattern: 'diagonal' },
{ name: 'Target', type: 'line', data: [9, 9, 10, 12], stack: false, dash: [6, 4], smooth: true },
],
});
Line and area: smooth, step, lineWidth, dash, markers, markerSize, markerShape, fillOpacity. Columns and bars: stack (or the chart option stacked), bandFraction, borderRadius, pattern. Scatter and bubble: pointSize, minRadius, maxRadius. Heatmap: points [x, y, value] with yAxis.categories, colors, showValues, cellGap. Waterfall: { y } changes and { sum: 'total' | 'subtotal' } bars, upColor, downColor, totalColor, connectors. Box plot: [low, q1, median, q3, high] or { values } (statistics computed), whiskers, showMean. Histogram: the raw values with bins, binWidth, binRange, normalize. Ranges: { low, high } or [x, low, high]. X-range: { x, x2, y } bars on rows with partialFill.
Pie and other series without axes
pie, donut, gauge, radar, polar, radialBar, funnel, pyramid, treemap, sunburst, bullet. Several of them in one chart are placed side by side (seriesLayout: 'auto', 'grid', 'row', 'column' or 'overlay').
VibeFoxJSCharts.createChart('#app', { series: [
{ type: 'donut', name: 'Share', data: [{ name: 'Web', value: 55 }, { name: 'Store', value: 30 }, { name: 'Phone', value: 15 }],
showTotal: true, centerLabel: 'Orders' },
{ type: 'gauge', name: 'Load', data: [72], max: 100, bands: [{ from: 80, to: 100, color: '#dc2626' }] },
] });
Pie and donut: innerRadius, startAngle, labels, showTotal, centerLabel, selectable (a click pulls a slice out), patterns. Gauge: min, max, bands, ticks, thickness, needle, label. Radar: categories are the spokes, rings. Polar: mode ('column' | 'line' | 'area'). Radial bar: angle, rounded, trackColor. Funnel and pyramid: width, neck, reversed, gap. Treemap and sunburst: nested children or flat { id, parent, value }, levels, levelShade, padding, headerHeight. Bullet: target, ranges, rangeColors, targetColor, orientation.
Relations, text and time
sankey, chord, dependencyWheel, arc and network take links [from, to, weight] (or { from, to, weight }) and optional nodes ({ id, name, color, value, column, group }); a chord also takes a square matrix. wordcloud takes words with weights or a plain text whose words are counted. venn takes { sets: ['A', 'B'], value }. timeline takes events { x, name, description }.
VibeFoxJSCharts.createChart('#app', { series: [{
type: 'sankey', name: 'Energy',
data: [['Coal', 'Power', 40], ['Gas', 'Power', 25], ['Power', 'Homes', 35], ['Power', 'Industry', 30]],
linkColor: 'mix',
}] });
Options: nodeWidth, nodePadding, nodeAlign, iterations, linkColor ('source' | 'target' | 'mix' or a color), linkOpacity; network: linkDistance, charge, gravity, seed, linkWidth, directed, nodeSize, minNodeSize, maxNodeSize, maxScale, draggable (drag nodes; getNodePositions(), setNodePositions(), event nodeDrag); word cloud: minFontSize, maxFontSize, fontScale, rotations, maxWords, minWordLength, stopWords; timeline: spacing, labelWidth, dateFormat; x-range: grouping, pointWidth; colorByPoint.
Helpers: histogramBins(values, options), boxStats(values, options), squarify(values, x, y, w, h).
Axes
xAxis: type ('auto', 'linear', 'category', 'time', 'log'), min, max, ticks, format, grid, labelRotation, title, logBase, visible. yAxis is one axis or an array: type ('linear' | 'log'), min, max, ticks, format, grid, title, position ('left' | 'right'), categories (heatmap and x-range rows), visible. A series picks its axis with yAxisIndex.
VibeFoxJSCharts.createChart('#app', {
xAxis: { type: 'time' },
yAxis: [{ title: 'Price' }, { title: 'Volume', position: 'right', format: (v) => v / 1000 + 'k' }],
series: [
{ name: 'Price', data: [['2026-01-01', 10], ['2026-02-01', 12], ['2026-03-01', 11]] },
{ name: 'Volume', type: 'column', yAxisIndex: 1, data: [['2026-01-01', 5000], ['2026-02-01', 8000], ['2026-03-01', 6500]] },
],
});
chart.toggleLogScale(0); // y axis 0 logarithmic; toggleLogScale('x') for the x axis
getLogAxes() lists the logarithmic axes. padding sets the space around the plot.
Labels, tooltips, legend and annotations
Data labels
dataLabels (chart or series): 'auto' (default: points with a label, pie slices, the gauge value), true, false or { show, format, decimals, position, offset, rotation, overlap, color, background, borderColor, fontSize, fontWeight }. format is a function or a template with {y}, {value}, {x}, {label}, {series}, {percent}, {r}, {index}. toggleDataLabels() switches them.
dataLabels: { show: true, format: '{y} k', position: 'outside', overlap: 'auto' }
Tooltip and legend
tooltip: show, shared (one tooltip for all series at an x), crosshair (true or 'xy'), format({ title, rows, point }) returning HTML. legend: show, position ('top' | 'bottom' | 'left' | 'right'); a click on a legend item hides the series (toggleSeries(), showSeries(), hideSeries(); events seriesToggle, sliceToggle, seriesHighlight). title and subtitle are shown above the plot.
Annotations and statistics lines
annotations are lines, bands and labels: { type: 'lineX' | 'lineY' | 'rangeX' | 'rangeY' | 'label', value, from, to, x, y, text, color, opacity, axis, dash, width, position }. addAnnotation(), removeAnnotation(id), clearAnnotations(); annotateExtremes(series) marks the minimum and maximum of a series. A series with stats: ['min', 'max', 'avg', 'trend'] draws these lines. The label of a stats line or a lineY annotation goes under its line when there is no room above it (a maximum at the top edge of the plot).
chart.addAnnotation({ id: 'goal', type: 'lineY', value: 15, text: 'Goal', dash: [4, 4] });
chart.addAnnotation({ type: 'rangeX', from: 'Mar', to: 'Apr', text: 'Campaign', opacity: 0.15 });
chart.annotateExtremes(1);
Ghost comparison
snapshot() keeps the current data as a dashed outline behind the new data (opacity: ghost.opacity); clearSnapshot() removes it.
Zoom, navigator and range selector
Cartesian charts zoom with the mouse wheel and a drag on the plot, and pan by dragging (zoom: enabled, wheel (true, false or 'ctrl'), drag ('zoom' | 'pan' | false), pan, minSpan, keyboard). From code:
chart.setZoom(0.5, 1); // the second half of the x range (fractions 0..1)
chart.setXRange('2026-03-01', '2026-06-30');
chart.zoomBy(0.8); chart.panBy(-0.1);
chart.getZoom(); chart.getXRange(); chart.resetZoom();
navigator: { enabled: true } shows an overview of all data under the plot with a window over the visible range (series, type, export); scrollbar: { enabled: true } adds a scrollbar; rangeSelector: { enabled: true } adds buttons (default on time axes: 1M, 3M, 6M, YTD, 1Y, All) and from / to inputs (buttons, selected, inputs, position). selected is the button pressed at the start: its index in buttons or its text ('6M', 'YTD', 'All'; an unknown text is ignored); getState() returns it as rangeSelected (the index), and setState({ rangeSelected }) takes the index or the text. Buttons can be strings such as '2W', '12h', '10pts' or objects { type, count, text }. Event: zoomChange (start, end, xMin, xMax). Two charts zoom together with link(a, 'zoomChange', b, 'setXRange').
Drilldown
A point with drilldown opens a lower level when clicked; breadcrumbs lead back. Levels are given by id in drilldown.series, inline in the point, or loaded by drilldown.load(context) (async).
VibeFoxJSCharts.createChart('#app', {
series: [{ id: 'regions', type: 'column', name: 'Regions',
data: [{ name: 'Europe', y: 30, drilldown: 'eu' }, { name: 'America', y: 20, drilldown: true }] }],
drilldown: {
series: [{ id: 'eu', type: 'column', name: 'Europe', data: [{ name: 'Germany', y: 12 }, { name: 'France', y: 18 }] }],
load: async (ctx) => ({ type: 'pie', name: ctx.point.name, data: [{ name: 'USA', value: 15 }, { name: 'Canada', value: 5 }] }),
},
});
Options: enabled, series, load, animation, cache, breadcrumbs (show, position, back, separator, rootText, export). Treemap and sunburst nodes open their subtree with drilldown: true on the series. Methods: drillDown(series, index), drillUp(levels), getDrilldown(). Events: drilldown, drillup, drilldownError.
Real-time data
appendData(series, points) adds points without the entrance animation; realtime.maxPoints (or the series option maxPoints) keeps a sliding window. Event: dataAppend.
const chart = VibeFoxJSCharts.createChart('#app', { xAxis: { type: 'time' }, realtime: { maxPoints: 300 },
series: [{ id: 'cpu', name: 'CPU', type: 'area', data: [] }] });
setInterval(() => chart.appendData('cpu', [[Date.now(), Math.random() * 100]]), 1000);
Data sources
dataSource (or setDataSource()) loads series from CSV text, a URL, a Google Sheets link, an HTML table or a dataset, and maps the columns to series.
chart.setDataSource({
csv: 'month;north;south\nJan;5;3\nFeb;6;4\nMar;7;2',
type: 'column', x: 'month', y: ['north', 'south'],
});
chart.importCSV('a,b\n1,2\n3,4', { type: 'scatter', x: 'a', y: 'b' });
VibeFoxJSCharts.createChartFromTable('#sales-table', { title: 'From the table' }); // a chart before the table
Source fields: csv, url, googleSheets (+ sheetName, gid), table, dataset, rows, parse (delimiter, quote, header, decimal, dateFormat, columnTypes, nulls, comment, skipRows, tfoot), mapping or the mapping fields directly (type, x, y, fields, series, seriesBy, name, seriesOptions), transform, fetch, refresh (seconds), watch (follow edits of an HTML table). Events: dataLoad, dataError. Helpers: parseCSV, readTable, tableFromDataset, seriesFromTable, sheetsCsvUrl; getDataSource() returns the last table. A CSV from another site needs CORS on that server.
Large data
A series with more than largeData.minPoints (5 000) points is downsampled to the visible window (LTTB for lines, min / max buckets for areas and columns); the tooltip still shows the original point under the pointer. largeData.webgl: true draws large line and scatter series through WebGL (canvas 2D when WebGL is not available).
const points = Array.from({ length: 1000000 }, (_, i) => [i, Math.sin(i / 5000) * 100 + Math.random() * 10]);
const chart = VibeFoxJSCharts.createChart('#app', { series: [{ type: 'line', data: points }], largeData: { webgl: true } });
console.log(chart.getRenderInfo()); // [{ id, type, large, points, drawn, method, renderer }]
Options: enabled, minPoints, threshold, webgl; series: downsample ('auto', true, false, 'lttb', 'minmax'), webgl. After you change point arrays in place, call redraw(). Exports draw the downsampled points unless allPoints: true.
Editing points
draggable: true (chart or series) lets users drag points of line, area, column, bar, scatter, bubble, range and waterfall series with the mouse, touch or Shift+arrows. Options: axis ('y', 'x', 'xy'), min, max, step, minX, maxX, stepX. Ctrl+Z / Ctrl+Y and undo(), redo(), canUndo(), canRedo() undo and redo the drags. Events: pointDragStart, pointDrag, pointDrop (all cancelable).
const chart = VibeFoxJSCharts.createChart('#app', { categories: ['A', 'B', 'C'],
series: [{ type: 'column', data: [5, 7, 3], draggable: { min: 0, max: 10, step: 0.5 } }] });
chart.on('pointDrop', (e) => console.log('new value', e.value.y));
Maps
Map series draw your GeoJSON or TopoJSON: map (regions colored by value — choropleth), mapbubble, mappoint and mapline (routes, great circles by default).
const chart = VibeFoxJSCharts.createChart('#app', {
map: { data: countriesTopoJson, projection: 'naturalEarth' }, // your map data
colorAxis: { type: 'sequential', steps: 5, title: 'Population (M)' },
series: [
{ type: 'map', name: 'Population', joinBy: 'id', data: [{ code: 'DE', value: 84 }, { code: 'FR', value: 68 }] },
{ type: 'mappoint', name: 'Capitals', data: [{ name: 'Berlin', lon: 13.4, lat: 52.5 }] },
],
});
chart.zoomToRegion(0, 'DE');
map: data, object, projection ('mercator', 'equirectangular', 'naturalEarth', 'albers', 'albersUsa', 'orthographic', 'lambertAzimuthal', a configuration or your own { forward, invert }), fit, bounds, padding, simplify, graticule, water, zoom. colorAxis: type ('sequential', 'diverging', 'categorical', 'classes'), min, max, mid, scale, steps, colors, classes, breaks, categories, nullColor, format, title, legend. Map series: mapData, mapObject, joinBy, allAreas, nullColor, borderColor, borderWidth, minSize, maxSize, sizeBy, geodesic, widthBy, maxWidth.
Methods: getMapView(), setMapView({ zoom, center }), zoomMapBy(), panMapBy(), resetMapView(), zoomToRegion(), projectPoint(lon, lat), invertPoint(x, y); event mapViewChange. Helpers: createProjection(), PROJECTIONS, topoFeatures().
Responsive rules
responsive.rules change options by the size of the chart: { condition: { maxWidth, minWidth, maxHeight, minHeight, callback }, options }. The base options come back when a rule no longer matches.
responsive: { rules: [
{ condition: { maxWidth: 500 }, options: { legend: { position: 'bottom' }, xAxis: { labelRotation: 45 }, dataLabels: false } },
] }
getResponsive() returns the active rules and the size, getBaseOptions() the options without the rules; event responsiveChange.
Dashboards
createChartDashboard(target, options) builds KPI tiles, charts and filter controls from one JSON configuration. A click or a range selection in one chart filters the others (cross-filtering).
const dash = VibeFoxJSCharts.createChartDashboard('#dash', {
title: 'Sales',
data: [
{ date: '2026-01-05', region: 'North', product: 'A', amount: 120 },
{ date: '2026-02-11', region: 'South', product: 'B', amount: 80 },
{ date: '2026-02-20', region: 'North', product: 'B', amount: 150 },
],
kpis: [{ id: 'total', title: 'Revenue', field: 'amount', aggregate: 'sum', format: { compact: true } }],
charts: [
{ id: 'byRegion', type: 'pie', x: 'region', y: 'amount', aggregate: 'sum' },
{ id: 'byMonth', type: 'column', x: { field: 'date', by: 'month' }, y: 'amount', series: 'product' },
],
filters: [{ id: 'product', field: 'product', type: 'multiselect' }],
});
dash.setFilter('product', ['A']);
Options: title, subtitle, sources (named data sources) or data, kpis (field, aggregate, format, compare, good, sparkline, caption), charts (a chart spec: type, x, y, aggregate, series, sort, limit, others, stacked, filter, or a mapping; options, crossFilter, layout), filters (controls: select, multiselect, range, search), defaults, layout (columns, breakpoints, order, orders, engine), crossFilter, filterBar, ariaLabel. Aggregates: sum, avg, count, min, max, median, distinct, first, last, none.
Methods: whenLoaded(), setData(), getData(), getTable(), reload(), getChart(id), getCharts(), getKpi(id), getFilters(), setFilter(), addFilter(), removeFilter(), clearFilters(), getLayout(), setLayout(), moveTile(), getTiles(), getState(), setState(), getImage(), exportPNG(), getSVG(), exportSVG(), getPDF(), exportPDF() (several pages), print(), getPrintLayout(). Events: filterChange, layoutChange, dataLoad, dataError, export.
The dashboard works on its own with its own grid layout. If VibeFox JS UI is also on the page (its file loaded), layout: { engine: 'tiles' } uses its tile layout, where users drag and resize tiles.
Export
chart.exportPNG('sales.png'); // with background, title, subtitle and legend
const canvas = chart.getImage({ legend: false });
const svg = chart.getSVG(); // vectors, selectable text
chart.exportSVG('sales.svg');
await chart.exportPDF('sales.pdf', { pageSize: 'A4', orientation: 'landscape' });
await chart.print();
const csv = chart.exportCSV(null); // text; with a file name it downloads
await chart.exportXLSX('sales.xlsx', { sheets: 'series' });
chart.toggleDataView(true); // an accessible HTML table instead of the canvas
An export right after createChart() (also during the entrance animation) already has the final layout and the final state of the animation: no need to wait for a frame.
Image options: title, legend, navigator, breadcrumbs, allPoints. PDF options add pageSize, orientation, margin, author, subject, embedFonts. Text outside the standard PDF fonts stays selectable; to show it in your font, pass your font files with embedFonts (.ttf, .otf or .woff). With a font that has the letters, Arabic, Hebrew and Hindi text is written as on the screen: right to left where needed, Arabic letters joined, Devanagari syllables built. The library ships no fonts. Excel options: sheets ('single' or 'series'), title. Events: export, dataViewToggle.
Rendering without a DOM
renderToSVG(options, { width, height, theme, vars, locale, measure, title, legend, allPoints, idPrefix }) returns the same SVG as getSVG() without a browser (Node, workers). renderToCanvas(canvas, options, opts) draws on any 2D canvas; renderToPNG(options, opts) returns PNG bytes (in Node pass a canvas factory of a canvas library: canvas: (w, h) => createCanvas(w, h)).
import { renderToSVG } from '@vibefox/js-charts';
const svg = renderToSVG({ title: 'Report', series: [{ type: 'column', data: [3, 5, 2] }] }, { width: 600, height: 300, theme: 'light' });
Text to chart and explanations
explain() describes the chart in words: trends with the change in percent, extremes, outliers, seasonality, shares and correlation (in the locale of the chart); getInsights() returns the facts behind it. textToChart(text, data) turns a request such as "sales by region as pie" into chart options with built-in rules (English and Russian).
console.log(chart.explain());
const rows = [{ region: 'North', sales: 5 }, { region: 'South', sales: 7 }];
VibeFoxJSCharts.createChart('#app2', VibeFoxJSCharts.textToChart('sales by region as pie', rows));
chartFromText(text, data, { resolve }) uses your own language model first: resolve(text, context) receives the table, the JSON Schema of the options (chartSchema()), a tool definition (chartTool()) and the result of the rules, and returns options or a spec; the answer is checked with validateChart(), and the rules are the fallback. The library never calls a model itself. Other helpers: parseChartText, specToChart, explainChart, chartInsights.
Theming and styling
Themes
Every VibeFox JS component has the themes light (default), dark and high-contrast built into its CSS file. The optional vibefox-js-themes.css adds the theme pack: high-contrast-light, paper, paper-dark, glass, glass-dark, classic, classic-dark, ocean, ocean-dark, forest, forest-dark, sunset, sunset-dark, graphite, graphite-dark. The same file works for every VibeFox JS library.
VibeFoxJSCharts.setTheme('dark'); // the whole page
VibeFoxJSCharts.setTheme('ocean', '#sidebar'); // every component inside a container
chart.setTheme('glass'); // one component (also: the theme option)
chart.setTheme(null); // follow the page / container again
A component without its own theme follows the nearest container with a theme, then the page. After setTheme(name, container) the theme variables are set on the container itself too, so your CSS of the container can use them (#sidebar { background: var(--vfjs-bg); }). Your own theme: registerTheme(name, vars) with the theme variables (bg, fg, border, accent, accent-fg, muted, surface, radius, font, shadow, palette-0 … palette-9 and any other token); it applies at once to every component that uses it. getTheme() returns the page theme, themes lists the registered ones; the event themeChange reports a switch.
VibeFoxJSCharts.registerTheme('brand', { accent: '#e11d48', 'accent-fg': '#ffffff', radius: '10px' });
chart.setTheme('brand');
CSS variables
Every color, size, spacing, font, radius, shadow and duration of VibeFox JS Charts is a CSS variable, so any setting is changed in one place. There are three levels:
- theme variables shared by all VibeFox JS components:
--vfjs-bg,--vfjs-fg,--vfjs-border,--vfjs-accent,--vfjs-accent-fg,--vfjs-muted,--vfjs-surface,--vfjs-radius,--vfjs-font,--vfjs-shadow,--vfjs-palette-0…--vfjs-palette-9; - design tokens: spacing
--vfjs-space-1…--vfjs-space-8, font sizes--vfjs-font-size,--vfjs-font-size-smand others, radii--vfjs-radius-sm…, status colors--vfjs-danger,--vfjs-success,--vfjs-warning,--vfjs-info, the scale--vfjs-size-unit, durations--vfjs-motion-duration, the focus ring--vfjs-focus-ring-colorand--vfjs-focus-ring-width; - variables of the library,
--vfjs-charts-*, which default to the tokens above.
/* all VibeFox JS components of the page */
.vfjs { --vfjs-accent: #0f766e; --vfjs-radius: 4px; }
/* only this chart */
#sales {
--vfjs-charts-font-size: 14px;
--vfjs-charts-grid-dash: 4 3;
--vfjs-charts-bar-radius: 4px;
}
Main groups of the chart variables (all start with --vfjs-charts-): base (--vfjs-charts-bg, --vfjs-charts-fg, --vfjs-charts-font, --vfjs-charts-font-size), series colors (--vfjs-charts-color-0 … --vfjs-charts-color-11, --vfjs-charts-colors), axes (--vfjs-charts-axis, --vfjs-charts-axis-label, --vfjs-charts-axis-title), grid (--vfjs-charts-grid, --vfjs-charts-grid-width, --vfjs-charts-grid-dash), lines and markers (--vfjs-charts-line-width, --vfjs-charts-dashes, --vfjs-charts-marker-size, --vfjs-charts-marker-shape), areas and bars (--vfjs-charts-area-opacity, --vfjs-charts-bar-width, --vfjs-charts-bar-radius), patterns (--vfjs-charts-pattern), labels (--vfjs-charts-label, --vfjs-charts-label-size), title (--vfjs-charts-title-fg, --vfjs-charts-title-size), tooltip (--vfjs-charts-tooltip-bg, --vfjs-charts-tooltip-fg), legend (--vfjs-charts-legend-fg, --vfjs-charts-legend-swatch-size), maps (--vfjs-charts-map-low, --vfjs-charts-map-high, --vfjs-charts-map-water). The canvas redraws when a variable changes.
From JavaScript: the option colors sets the series colors directly and wins over styles and palettes; getColors() returns the colors in use.
Where to set them: on :root, on any container of your page (#checkout { --vfjs-accent: #0f766e; }), on the element of the component, or in a theme (registerTheme). The closest value wins; a component with its own theme (the option theme or component.setTheme(name)) keeps the theme variables of that theme even inside a container that sets them. A container inside another component (a form inside a dialog or a card) passes the variables of the library to the components in it as well. Only the shared design tokens (--vfjs-space, --vfjs-danger, --vfjs-selected-bg …) do not pass there: set them on a container outside the outer component or on the nested components themselves (#form .vfjs { … }). Popups, menus and dialogs placed in <body> take the values set on the page (:root), not those of the container of their component.
Default values: the theme variables are registered with @property (their initial value is the light theme), so they have a value on every element of the page. The variables of the library (--vfjs-charts-*) keep their defaults inside the stylesheet, at the place where they are used, so a variable that you did not set has no value on your elements:
- in your own CSS that uses a variable of the library, give it a fallback as the library does:
var(--vfjs-charts-bg, var(--vfjs-bg)), or use a theme variable directly; - from JavaScript, read the current value with
cssVar(element, '--vfjs-charts-font-size')(exported by the library; it also returns the default value the component computes);getComputedStyle(element).getPropertyValue()can return an empty string for a variable of the library that nobody set.
/* your own element in the colors of the component */
.my-summary { background: var(--vfjs-charts-bg, var(--vfjs-bg)); color: var(--vfjs-fg); }
const el = document.querySelector('#orders');
console.log(VibeFoxJSCharts.cssVar(el, '--vfjs-charts-font-size')); // the value in use (also a default)
console.log(getComputedStyle(el).getPropertyValue('--vfjs-charts-font-size')); // can be '' unless you set it
If the CSS file of the library comes from another origin without CORS (a <link> without the crossorigin attribute), the browser does not let scripts read the stylesheet, and cssVar() returns an empty string for a variable without a value on the root of the component. From your own origin, or with that attribute, it works.
The variables of the dashboard (--vfjs-charts-dash-*) have a value only on the dashboard.
The stylesheets are written with native CSS nesting; nothing changes for including them, and your own CSS can be written in any form.
Ready-made styles and palettes
The option style (the prop variant in the framework wrappers) picks a ready-made look: 'vivid', 'pastel', 'monochrome' (shades with dashes and marker shapes), 'dark' (dark look whatever the theme), 'print' (black and white with grays, hatches, dashes and marker shapes). The option palette replaces only the series colors: 'vivid', 'pastel', 'monochrome', 'dark', 'grayscale', and the palettes safe for color blindness 'colorblind' (= 'okabe-ito'), 'tol-bright', 'tol-muted', 'tol-vibrant', 'ibm'.
chart.setStyle('print');
chart.setPalette('okabe-ito');
chart.getStyle(); chart.getPalette();
CHART_STYLES and CHART_PALETTES list the names. A style is the class vfjs-charts-style-<name> and a palette the class vfjs-charts-palette-<name> on the chart or any container; any other name uses your own CSS for that class. Fill patterns (series pattern: 'diagonal', 'back-diagonal', 'diagonal-cross', 'horizontal', 'vertical', 'cross', 'dots', 'grid-dots') and marker shapes (markerShape: 'circle', 'square', 'triangle', 'triangle-down', 'diamond', 'cross') also appear in SVG, PDF and print.
Density and size
Set data-vfjs-density="compact", "normal" or "comfortable" on the page or on any container: heights and paddings of every VibeFox JS component inside follow. --vfjs-size-unit (default 1px) scales all sizes of a component at once, for example #orders { --vfjs-size-unit: 1.25px; }. Sizes you give as numbers in options are pixels and are not scaled.
Default height: when the element of the component has no height of its own, it gets the class vfjs-auto-height and a default height from the variable --vfjs-charts-min-height (400 px × --vfjs-size-unit). An element with a height of its own (height, only a min-height, a flex item or a CSS Grid item, height: 100% of a parent with a height, absolute insets) gets the class vfjs-fit and is filled exactly, also when it is smaller; the content never makes it taller. With the variable at 0 (class vfjs-content-height) the height follows the width: --vfjs-charts-aspect-ratio (default: the token --vfjs-aspect-ratio, 2 / 1).
Your own CSS
All library rules are inside the cascade layer @layer vfjs, so your own CSS always wins without !important. The class names of VibeFox JS Charts start with vfjs-chart- (state classes too, for example vfjs-chart-is-hidden), so other CSS frameworks on the page do not restyle it.
.vfjs-chart-legend-item { font-weight: 600; }
.vfjs-chart-header { text-align: start; }
The library ships no font files. It uses the system font stacks of the tokens --vfjs-font, --vfjs-font-mono and --vfjs-font-serif; set them to your own fonts if you want. Animations follow prefers-reduced-motion, and colors follow forced-colors mode (Windows high contrast).
Localization and RTL
Languages
VibeFox JS Charts comes with 14 interface languages. English (en) is built into the library file; each of the others is a language file of its own (dist/locales/vibefox-js-charts.<lang>.js in the package), and a page loads only the ones it uses: Russian (ru), Spanish (es), German (de), French (fr), Italian (it), Portuguese (Brazilian) (pt), Ukrainian (uk), Turkish (tr), Chinese (Simplified) (zh), Japanese (ja), Korean (ko), Hindi (hi) and Arabic (ar). The locale option sets the language of one component; setLocale(lang) sets the default language of the page, which every component without its own locale follows (it re-renders on a change).
VibeFoxJSCharts.setLocale('ru'); // page default
const chart = VibeFoxJSCharts.createChart('#app', { series, locale: 'en' }); // this chart only
chart.setOptions({ locale: 'de' });
The example above needs the files of the languages it uses. With script tags, load a language file after the library. The order matters: loaded first, the file adds no language and writes a warning to the console.
<link rel="stylesheet" href="vibefox-js-charts.css">
<script src="vibefox-js-charts.global.min.js"></script>
<script src="locales/vibefox-js-charts.ru.js"></script>
With npm or a bundler, import the language after the library. Without npm, an ES module page imports ./locales/vibefox-js-charts.ru.esm.js, which registers the language in vibefox-js-charts.esm.js.
import { createChart } from '@vibefox/js-charts';
import '@vibefox/js-charts/locales/ru';
The .esm.js language file does not fit the minified build @vibefox/js-charts/min (it would load a second copy of the library). There, use the .json file:
import { createChart, addLocale } from '@vibefox/js-charts/min';
import ru from '@vibefox/js-charts/locales/ru.json';
addLocale('ru', ru);
Without its file, locale: 'ru' shows English and writes one warning to the console.
Language codes: uk, ko, zh and pt are the real codes; ua and kr also work, as aliases of uk and ko. For each string the library tries the exact code, then the alias, the base language (pt-BR → pt, zh-CN → zh), English, and finally the key itself. normalizeLocale(code) returns the real code of an alias.
A language does not set the direction: with locale: 'ar', also set rtl: true or dir="rtl" on the container. The built-in rules of textToChart() understand English and Russian whatever language files are loaded.
Adding a language
addLocale(lang, dictionary) adds strings to a language (and creates it): a language of your own, or your own wording over a language file. A missing key follows the chain above, so a partial dictionary works; addLocale('ua', …) fills uk. Add the dictionary before the components that use it are created, or switch the locale afterwards.
VibeFoxJSCharts.addLocale('de', {
noData: 'Keine Daten',
chartLegend: 'Legende',
});
The keys of VibeFox JS Charts are camel-case names with the prefix chart (for example chartLegend), about 150 keys: legend, breadcrumbs, range selector, data table, dashboard, screen reader texts and the words of explain(); a few common words are shared keys without a prefix, such as noData. The language files list every key (locales/vibefox-js-charts.ru.json); the English texts are in the readable file vibefox-js-charts.esm.js. t(key, params) translates a key in the page locale, chart.t(key) in the chart's locale; getLocale() returns the page locale, onLocaleChange(fn) reports changes.
Plural forms: a text with a number has the keys <key>.zero, .one, .two, .few, .many and .other (the categories of Intl.PluralRules); .other is the fallback, so your dictionary can give only that form. {count} and {n} are filled in. tPlural(key, count, params, lang) picks the form; the method chart.tPlural(key, count, params) does it in the locale of the component.
VibeFoxJSCharts.addLocale('de', {
'chartRangePoints.one': 'Letzter Punkt',
'chartRangePoints.other': 'Letzte {count} Punkte',
});
VibeFoxJSCharts.tPlural('chartRangePoints', 5, {}, 'de'); // 'Letzte 5 Punkte'
Numbers are formatted with a no-break space between digit groups (axis labels, data labels, tooltips); use format of the axes, labels and tooltips for your own formats. Month and day names of time axes follow the chart locale.
Right-to-left
The option rtl: true lays the component out right-to-left (dir="rtl" on its element); rtl: false forces left-to-right; without it the component follows the page or its container (<html dir="rtl">). The arrow keys follow the reading order. isRtl(element) tells the direction of an element.
In VibeFox JS Charts the title, legend, tooltip, breadcrumbs and dashboard follow the direction; the plot keeps the usual math direction (x grows to the right), and canvas texts are drawn left-to-right.
Accessibility
The plot of VibeFox JS Charts is one tab stop with keyboard navigation over the points; screen readers get a description of the chart (title, counts, range, minimum, maximum and trend of every series) and hear the focused point. Focus is visible (the focus ring is the CSS variables --vfjs-focus-ring-color, --vfjs-focus-ring-width, --vfjs-focus-ring-offset, --vfjs-focus-ring-style); dialogs keep the focus inside and give it back when they close. The high-contrast and high-contrast-light themes, forced-colors mode and prefers-reduced-motion (no animations) are supported; the palettes colorblind, tol-* and ibm, patterns and marker shapes help readers who do not see colors.
Keyboard
| Keys | Action |
|---|---|
| ← → | Previous / next point of the series. |
| ↑ ↓ | Previous / next visible series at the same x. |
| Home, End | First / last point. |
| Enter, Space | Click the point (pointClick; pie slices are pulled out, drilldown opens). |
| Esc | Leave the point. |
| S | Speak the summary. |
| + / −, Shift+↑ / Shift+↓ | Zoom in / out. |
| Shift+← / Shift+→ | Pan. |
| Shift+Home | Show all data. |
| Shift+arrows (draggable points, network nodes) | Move the point or node. |
| Ctrl+Z, Ctrl+Y | Undo / redo point drags. |
| Arrows, Home, End (legend) | Move between legend items; Enter / Space toggles the series. |
Screen readers
The plot has the role application with a description and a keyboard hint; the canvases are hidden from screen readers; the legend is a group of buttons with one tab stop. Options: ariaLabel (default: the title, else "Chart"), a11y: keyboard (false = an image without a tab stop), summary (true, false, your own text or a function of the automatic text), announce. toggleDataView() shows the data as an accessible HTML table.
Methods: getSummary(), announceSummary(), focusPoint(series, index, { focus }), getFocusedPoint(); event pointFocus. The library also exports the helpers it uses itself: announce(message), trapFocus, rovingFocus, setAria, prefersReducedMotion() and others (see API reference).
Using with other VibeFox JS libraries
VibeFox JS Charts works on its own. Every VibeFox JS library is a separate file with its own copy of the shared core, and several libraries on one page work together without conflicts: one global variable per library (VibeFoxJSCharts, VibeFoxJSCharts, …), class names with the library prefix, one page theme, the same events.
Connecting components with link()
link(source, event, target, method, transform) calls a method of one component whenever another emits an event; it returns a function that removes the link. connect(source, event, handler) subscribes and returns an unsubscribe function. bus is a page-wide event channel shared by all VibeFox JS libraries on the page.
// two charts zoom together
VibeFoxJSCharts.link(overview, 'zoomChange', detail, 'setXRange');
// a table of VibeFox JS Grid drives the chart (both files loaded on the page)
const unlink = VibeFoxJSCharts.link(grid, 'selectionChange', chart, 'setOptions', (e) => ({
categories: e.rows.map((r) => r.name),
series: [{ name: 'Salary', data: e.rows.map((r) => r.salary) }],
}));
VibeFoxJSCharts.bus.emit('sales:refresh', { at: Date.now() }); // any library can listen: VibeFoxJSGrid.bus.on('sales:refresh', fn)
What uses another library when it is on the page
- Charts of cell ranges in VibeFox JS Grid: when both files are on the page, the grid draws its range charts with VibeFox JS Charts.
- Dashboards: work on their own; if VibeFox JS UI is also on the page,
layout: { engine: 'tiles' }uses its tile layout. - Export to PDF, SVG, PNG, CSV and Excel works on its own; no other library is needed.
AI tools
The library describes its main actions as tools for function calling with a language model. It never calls a model or a service itself: you send the descriptions to your model and run the calls it asks for.
| Tool | What it does |
|---|---|
chart_get_options | The options and the series. |
chart_set_options | Changes options (checked against chartSchema('options')). |
chart_explain | The text of explain(). |
const { describeTools, callTool, createToolKit } = VibeFoxJSCharts;
const tools = describeTools(chart, { format: 'openai' }); // 'plain' / 'anthropic', 'openai', 'webmcp'
const result = await callTool(chart, 'chart_set_options', { title: 'Revenue' }); // { ok: true, result } or { ok: false, error }
const kit = createToolKit({ sales: chart }); // tool names get the prefix 'sales_'
const answer = await kit.ask('Show this as a bar chart', {
format: 'anthropic',
model: async (request) => (await fetch('/api/llm', { method: 'POST', body: JSON.stringify(request.body) })).json(),
});
callTool checks the arguments against the tool schema before it runs and never throws for bad input. createToolKit(components, { webmcp, readOnly }) joins the tools of several components (also of other VibeFox JS libraries) under unique names; kit.ask(prompt, { model, format, system, maxSteps, signal, onToolCall }) runs the loop "model → tool calls → results" with your model function; kit.registerWebMCP() registers the tools in the browser's navigator.modelContext where available. registerTools(target, provider) adds your own tools; validateSchema(value, schema) is the schema check.
API reference
Exports
Library: createChart, VibeFoxJSChart, createChartDashboard, VibeFoxJSChartDashboard, createChartFromTable, CHART_STYLES, CHART_PALETTES, parseCSV, readTable, tableFromDataset, seriesFromTable, sheetsCsvUrl, renderToSVG, renderToCanvas, renderToPNG, createProjection, PROJECTIONS, topoFeatures, histogramBins, boxStats, squarify, chartSchema, chartTool, validateChart, chartFromText, textToChart, parseChartText, specToChart, explainChart, chartInsights, easings, defaultNumberFormat, LinearScale, CategoryScale, TimeScale, LogScale, renderers.
Shared core (the same in every VibeFox JS library): setTheme, getTheme, registerTheme, themes, tokens, componentTokens, densities, cssVar, cssColor, cssLength, observeTokens, setLocale, getLocale, addLocale, normalizeLocale, t, tPlural, withLocale, onLocaleChange, link, connect, bus, Emitter, VibeFoxJSComponent, factory, toCSV, downloadFile, downloadCanvasPNG, createXlsx, readXlsx, XLSX_MIME, createVectorContext, VectorContext, vectorToSVG, vectorToPDF, printSVG, createVectorImage, loadVectorImage, SVG_MIME, PDF_MIME, PDF_PAGE_SIZES, describeTools, callTool, createToolKit, registerTools, validateSchema, announce, trapFocus, rovingFocus, getFocusable, focusFirst, saveFocus, setAria, ensureId, addAriaRef, removeAriaRef, isRtl, mirrorArrow, prefersReducedMotion, prefersHighContrast, motionDuration, onPreferenceChange, injectStyles, ensureBaseStyles, formatNumber, formatDate, escapeHtml, createEl, deepMerge, isPlainObject, getPath, setPath, uid, clamp, debounce, throttle, VERSION.
Options
Also every VibeFox JS component accepts theme, locale, rtl and on (see Core concepts).
| Option | Type | Default | Description |
|---|---|---|---|
series (alias data) | series[] | [] | The series. |
categories | string[] or null | null | Shared x categories. |
xAxis | object | { type: 'auto', ticks: 6, grid: false, labelRotation: 'auto' } | X axis. |
yAxis | object or array | { ticks: 5, grid: true, position: 'left' } | Y axis / axes. |
title, subtitle | string | '' | Titles. |
legend | object | { show: true, position: 'bottom' } | Legend. |
tooltip | object | { show: true, shared: true, crosshair: true } | Tooltip. |
zoom | object | { enabled: true, wheel: true, drag: 'zoom', pan: true, minSpan: 0.005, keyboard: true } | Zoom and pan. |
animation | object | { enabled: true, duration: 600, easing: 'easeOutCubic' } | Animations. |
stacked | boolean | false | Stack all stackable series. |
realtime | { maxPoints } | { maxPoints: 0 } | Sliding window of appendData. |
annotations | array | [] | Lines, bands, labels. |
ghost | { opacity } | { opacity: 0.35 } | Snapshot outline. |
dataLabels | 'auto', boolean or object | 'auto' | Data labels. |
colors | string[] or null | null | Own series colors. |
style | string or null | null | Ready-made style. |
palette | string or null | null | Palette. |
padding | object | {} | Space around the plot. |
seriesLayout | string or object | 'auto' | Series without axes side by side. |
ariaLabel | string or null | null | Accessible name. |
a11y | object | { keyboard: true, summary: true, announce: true } | Keyboard, summary, announcements. |
navigator | object | { enabled: false } | Overview under the plot. |
scrollbar | object | { enabled: false } | Scrollbar of the x window. |
rangeSelector | object | { enabled: false, inputs: true, position: 'top' } | Range buttons and inputs; selected: index or text of the button pressed at the start. |
drilldown | object | { enabled: true, animation: true, cache: true } | Drilldown levels and breadcrumbs. |
responsive | object or array | { rules: [] } | Responsive rules. |
dataSource | object or null | null | Data source. |
largeData | object or false | { enabled: true, minPoints: 5000, threshold: 2, webgl: false } | Large data. |
draggable | boolean or object | false | Drag points. |
map | object | { projection: 'mercator', fit: 'map', padding: 8, simplify: 0.5 } | Map options. |
colorAxis | object or null | null | Color axis of maps. |
Series options (ChartSeries) are described under Series types; the common ones are id, name, type, data, color, yAxisIndex, stack, maxPoints, stats, dataLabels, pattern, draggable, downsample, webgl.
Events
| Event | Payload | Description |
|---|---|---|
ready, dataChange, optionsChange, themeChange, destroy | see Core concepts | Common events. |
pointClick, pointHover | { series, id, index, point, event } | Point clicked / hovered. |
pointFocus | { series, id, index, point } | Keyboard point moved. |
seriesToggle | { series, id, hidden } | Series shown / hidden. |
sliceToggle | { series, index, hidden } | Pie slice shown / hidden. |
seriesHighlight | { id, series } | Legend item hovered. |
zoomChange | { start, end, xMin, xMax } | Zoom window changed. |
dataAppend | { series, id, points, evicted } | Points appended. |
dataViewToggle | { visible } | Data table shown / hidden. |
export | { format, filename } | SVG, PDF, print or Excel export. |
pointDragStart, pointDrag, pointDrop | { series, id, index, point, value, handle, event, preventDefault } | Point drag (cancelable). |
nodeDrag | { series, id, index, node, x, y, phase, event } | Network node dragged. |
drilldown | { level, path, series, id, index, point, levelSeries, event } | Level opened. |
drillup | { level, path, from } | Back to a level. |
drilldownError | { error, series, id, index, point } | Loading a level failed. |
responsiveChange | { active, width, height } | Other rules match. |
dataLoad | { kind, table, series } | Data source loaded. |
dataError | { error, source } | Data source failed. |
mapViewChange | { zoom, center } | Map zoomed / moved. |
Methods
| Method | Returns | Description |
|---|---|---|
setData, getData, setOptions, setOption, getOption, getState, setState, setTheme, on, once, off, use, t, destroy | — | Common methods (see Core concepts). |
getSeries(id), addSeries(series), removeSeries(id) | series / this | Series. |
appendData(id, points) | this | Real-time append. |
toggleSeries(id, visible), showSeries(id), hideSeries(id) | this | Visibility. |
setZoom, getZoom, resetZoom, setXRange, getXRange, zoomBy, panBy | this / range | Zoom. |
drillDown(series, index), drillUp(levels), getDrilldown() | Promise / this / path | Drilldown. |
getResponsive(), getBaseOptions() | object | Responsive rules. |
setDataSource(source), getDataSource(), importCSV(text, mapping), importTable(table, mapping) | Promise / table / this | Data sources. |
getMapView, setMapView, zoomMapBy, panMapBy, resetMapView, zoomToRegion, projectPoint, invertPoint | value / this | Maps. |
addAnnotation, removeAnnotation, clearAnnotations, annotateExtremes | this / annotations | Annotations. |
snapshot(), clearSnapshot() | this | Ghost comparison. |
toggleDataView(show), toggleDataLabels(show), toggleLogScale(axis, on), getLogAxes() | this / axes | View switches. |
exportPNG, getImage, getSVG, exportSVG, getPDF, exportPDF, print | this / canvas / string / Promise | Image, vector, PDF, print. |
exportCSV(filename), getXLSX(options), exportXLSX(filename, options) | string / Promise | Data export. |
getSummary(), announceSummary(), focusPoint(), getFocusedPoint() | string / this / point | Accessibility. |
getNodePositions(), setNodePositions(positions) | positions / this | Network nodes. |
redraw(), getRenderInfo() | this / info | Drawing. |
undo(), redo(), canUndo(), canRedo() | this / boolean | Point drags. |
setStyle, getStyle, setPalette, getPalette, getColors | this / value | Look. |
explain(options), getInsights() | string / insights | Explanation. |
The dashboard methods are listed under Dashboards. The TypeScript declarations (vibefox-js-charts.d.ts) describe every option, payload and return type in detail: ChartOptions, ChartSeries, ChartPointObject, ChartEvents, ChartState, ChartDataSource, ChartDashboardOptions and others.
Troubleshooting
No styles
Link vibefox-js-charts.css next to the script. Without it the component works but is unstyled, and the console shows one warning "VibeFox JS stylesheet is not loaded". In a bundler, import @vibefox/js-charts/css. The framework wrappers do not add the CSS for you.
My CSS does not apply, or a page CSS framework changes the component
Your rules win over the library rules without !important because the library CSS is in @layer vfjs. If they still do not apply, check the class names: state classes have the library prefix (vfjs-chart-is-hidden, not is-hidden). The library never uses generic class names, so page CSS frameworks do not change it.
ES modules do not load from disk
Browsers load <script type="module"> only over http(s). Use a local web server, or use vibefox-js-charts.global.js, which also works from file://.
Content Security Policy
The library does not use eval or inline scripts and loads nothing from the network. It sets inline styles on its elements (sizes and positions), so a policy with style-src must allow them ('unsafe-inline' for style attributes). A data source with a url or a Google Sheets link is loaded with fetch, so connect-src must allow that address.
Text in the PDF is not in my font
The library ships no fonts. The PDF uses the standard PDF fonts; text outside them stays selectable but is drawn with a fallback. Pass your own font files with embedFonts (.ttf, .otf or .woff), or embedFonts: true to take the @font-face fonts of the page.
The chart is too small or empty
The chart fills its element. Give the element a height (CSS or an inline style); the chart takes it exactly, also a small one. Without one the chart is 400 px high (--vfjs-charts-min-height). The target element must exist when createChart runs (a selector that finds nothing throws an error). Check that every series has a type the data fits (for example { name, value } points for a pie).
Colors do not change
The option colors wins over palettes and styles, and a palette wins over the colors of a style. Remove colors to let the palette work.
A CSV or Google Sheet does not load
Data from another site needs CORS on that server (published Google Sheets CSV links have it). Listen to dataError for the reason.
Large data is slow
Keep largeData on, give sorted x values for lines, avoid data labels on every point, and try largeData: { webgl: true } for lines and scatter plots with hundreds of thousands of points.
Limitations
- Sankey diagrams do not draw circular links; the triple overlap of a Venn diagram is not fitted exactly; with x-range and line series in one chart the shared tooltip shows only the line series.
- Sunburst labels are horizontal (no curved text);
levelShadeneeds hex or rgb colors. - The navigator shows heatmap and x-range charts without their series; the range selector and the scrollbar are not exported; a chart that mixes series with and without axes has no navigator; responsive rules change chart options, not series.
- WebGL draws circles only (no marker shapes, patterns or dashes), lines without round joins, and not on log axes; areas and columns are not drawn with WebGL; stacked series and category / log x axes have no large data mode; the data table of a large series lists every point.
- X-range, bullet, box plot, histogram, heatmap, radar / polar and pie-like points cannot be dragged; a point is not moved to another category; undo keeps point drags only.
- Maps: spherical projections only; clipping only at the horizon of the orthographic projection; no legend toggles of color classes.
- Dashboards: no drag-and-drop of tiles in the built-in grid layout; the export draws no filter controls (only a line with the active filters).
- Rendering without a DOM: ready-made
styleclasses are CSS only (pass their variables invars); no navigator, range selector or breadcrumbs; text widths are approximate without ameasurecontext. - Text to chart: English and Russian rules only (other languages through your model); relative dates such as "last 3 months" are not understood.
- Framework wrappers: functions in options are compared by reference; removing a prop does not reset the option to its default; Vue watches object props shallowly.
