VibeFox JS Charts — Demo
Quick start
Plain HTML
Columns of the plan, a line of the fact with markers and its average line. Hover the chart for the shared tooltip, click a column, click a legend item to hide a series, scroll the mouse wheel over the plot to zoom.
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) => chart.setOptions({ subtitle: 'Clicked: ' + e.series.name + ', ' + e.point }) },
});Core concepts
Series and points
Points as plain numbers (with a null gap on Thursday), as [x, y] pairs with category names, and as objects with their own label and color.
VibeFoxJSCharts.createChart('#app', {
categories: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
series: [
{ name: 'Numbers', type: 'column', data: [5, 7, 6, null, 8, 9, 4] },
{ name: 'Pairs', type: 'line', markers: true, data: [['Mon', 3], ['Wed', 5], ['Fri', 4], ['Sun', 7]] },
{ name: 'Objects', type: 'line', markers: true, data: [
{ y: 2 }, { y: 3 }, { y: 2.5 }, { y: 4 },
{ y: 10, label: 'Best day', color: '#dc2626' },
{ y: 6 }, { y: 5 },
] },
],
});Events
The line under the chart shows the last event and its payload. Click a point, click a legend item, drag on the plot to zoom.
const output = document.createElement('p');
document.getElementById('app').after(output);
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'],
series: [
{ name: 'Visitors', type: 'line', markers: true, data: [42, 45, 51, 49, 58, 63, 61, 67] },
{ name: 'Orders', type: 'column', data: [12, 14, 13, 17, 19, 18, 22, 24] },
],
});
output.textContent = 'Events appear here.';
chart.on('pointClick', (e) => { output.textContent = 'pointClick: ' + e.series.name + ', index ' + e.index + ', value ' + e.point; });
chart.on('seriesToggle', (e) => { output.textContent = 'seriesToggle: ' + e.id + ', hidden ' + e.hidden; });
chart.on('zoomChange', (e) => { output.textContent = 'zoomChange: ' + e.start.toFixed(2) + ' … ' + e.end.toFixed(2); });State snapshots
Zoom in, hide a series and press Save state; then change the view (or press Reset zoom) and press Restore state. The saved JSON is shown under the chart.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const output = document.createElement('p');
document.getElementById('app').after(output);
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [
{ id: 'north', name: 'North', data: [5, 6, 7, 8, 7, 9, 10, 9, 11, 12, 11, 13] },
{ id: 'south', name: 'South', data: [3, 4, 2, 5, 6, 5, 7, 6, 8, 7, 9, 10] },
],
});
let saved = null;
addButton('Save state', () => { saved = chart.getState(); output.textContent = JSON.stringify(saved); });
addButton('Restore state', () => saved && chart.setState(saved));
addButton('Reset zoom', () => { chart.resetZoom(); chart.showSeries('north'); chart.showSeries('south'); });
chart.setZoom(0.25, 0.75);
chart.hideSeries('south');Series types
Cartesian series
Pick a chart in the list: stacked columns with a target line, areas, bars, scatter and bubbles, a heatmap, a waterfall, box plots, a histogram, ranges and an x-range (tasks on rows).
const charts = {
'Stacked columns and a line': {
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 },
],
},
'Area and step line': {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'],
series: [
{ name: 'Storage, TB', type: 'area', smooth: true, fillOpacity: 0.3, data: [12, 13, 15, 15, 17, 18, 20, 21] },
{ name: 'Plan, TB', type: 'line', step: true, data: [12, 12, 16, 16, 16, 20, 20, 24] },
],
},
'Bars': {
categories: ['Laptops', 'Phones', 'Tablets', 'Monitors', 'Printers'],
series: [{ name: 'Sales', type: 'bar', data: [1240, 980, 760, 640, 410], borderRadius: 3 }],
},
'Scatter and bubbles': {
xAxis: { title: 'Ad spend' }, yAxis: { title: 'Leads' },
tooltip: { shared: false },
series: [
{ name: 'Campaigns', type: 'scatter', data: [[12, 210], [18, 340], [25, 300], [31, 420], [40, 500], [44, 380], [52, 610]] },
{ name: 'Markets', type: 'bubble', data: [[20, 520, 30], [35, 250, 60], [48, 450, 20]] },
],
},
'Heatmap': {
xAxis: { categories: ['09:00', '11:00', '13:00', '15:00', '17:00'] },
yAxis: { categories: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] },
series: [{ name: 'Tickets', type: 'heatmap', showValues: true, cellGap: 2,
data: Array.from({ length: 25 }, (_, i) => [i % 5, Math.floor(i / 5), (i * 37) % 23 + 2]) }],
},
'Waterfall': {
categories: ['Start', 'Sales', 'Services', 'Salaries', 'Rent', 'Result'],
series: [{ name: 'Cash', type: 'waterfall', data: [120, 80, 35, -90, -30, { sum: 'total' }] }],
},
'Box plot': {
categories: ['Team A', 'Team B', 'Team C'],
series: [{ name: 'Response time', type: 'boxplot', showMean: true, data: [
[12, 18, 22, 27, 35],
{ values: [10, 14, 15, 15, 16, 18, 19, 21, 22, 40] },
[8, 11, 13, 16, 20],
] }],
},
'Histogram': {
series: [{ name: 'Order value', type: 'histogram', bins: 10,
data: Array.from({ length: 300 }, (_, i) => 50 + ((i * 7919) % 101) * 0.6 + ((i * 104729) % 61) * 0.7) }],
},
'Ranges': {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Temperature', type: 'rangeArea', data: [[-5, 3], [-3, 6], [1, 11], [5, 16], [9, 21], [13, 25]] },
{ name: 'Price', type: 'rangeColumn', data: [[2, 6], [3, 8], [4, 9], [6, 12], [7, 14], [9, 18]] },
],
},
'X-range': {
series: [{ name: 'Tasks', type: 'xrange', data: [
{ x: '2026-01-01', x2: '2026-01-12', y: 'Design', partialFill: 1 },
{ x: '2026-01-08', x2: '2026-01-28', y: 'Build', partialFill: 0.6 },
{ x: '2026-01-20', x2: '2026-02-05', y: 'Test', partialFill: 0.2 },
{ x: '2026-02-02', x2: '2026-02-10', y: 'Release' },
] }],
},
};
const picker = document.createElement('select');
for (const name of Object.keys(charts)) picker.add(new Option(name));
document.getElementById('app').before(picker);
let chart = null;
const show = (name) => {
chart?.destroy();
chart = VibeFoxJSCharts.createChart('#app', charts[name]);
};
picker.onchange = () => show(picker.value);
show(picker.value);Pie and other series without axes
Pick a chart in the list: a donut with a gauge, a pie (click a slice to pull it out), radar, polar, radial bars, a funnel with a pyramid, a treemap, a sunburst and bullet charts.
const tree = [
{ name: 'Europe', children: [{ name: 'Germany', value: 84 }, { name: 'France', value: 68 }, { name: 'Italy', value: 59 }] },
{ name: 'Asia', children: [{ name: 'Japan', value: 124 }, { name: 'Korea', value: 52 }] },
{ name: 'Oceania', children: [{ name: 'Australia', value: 27 }, { name: 'New Zealand', value: 5 }] },
];
const charts = {
'Donut and gauge': { 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': { series: [{ type: 'pie', name: 'Traffic', selectable: true, data: [
{ name: 'Direct', value: 24 }, { name: 'Search', value: 38 }, { name: 'Social', value: 18 }, { name: 'Email', value: 12 }, { name: 'Other', value: 8 },
] }] },
'Radar': {
categories: ['Speed', 'Quality', 'Price', 'Support', 'Design', 'Docs'],
series: [
{ name: 'Product A', type: 'radar', max: 100, data: [88, 92, 85, 78, 90, 70] },
{ name: 'Product B', type: 'radar', data: [80, 75, 90, 85, 70, 85] },
],
},
'Polar': {
categories: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'],
series: [
{ name: 'Wind, days', type: 'polar', mode: 'column', data: [8, 5, 3, 4, 6, 9, 12, 10] },
{ name: 'Gusts', type: 'polar', mode: 'line', data: [4, 3, 2, 2, 3, 6, 8, 6] },
],
},
'Radial bars': { series: [{ type: 'radialBar', name: 'Goals', max: 100, rounded: true, data: [
{ name: 'Running', value: 82 }, { name: 'Swimming', value: 54 }, { name: 'Cycling', value: 67 },
] }] },
'Funnel and pyramid': { series: [
{ type: 'funnel', name: 'Sales funnel', data: [{ name: 'Visits', value: 1000 }, { name: 'Leads', value: 600 }, { name: 'Offers', value: 320 }, { name: 'Deals', value: 200 }] },
{ type: 'pyramid', name: 'Pyramid', data: [{ name: 'Base', value: 50 }, { name: 'Middle', value: 30 }, { name: 'Top', value: 10 }] },
] },
'Treemap': { series: [{ type: 'treemap', name: 'Population, M', data: tree }] },
'Sunburst': { series: [{ type: 'sunburst', name: 'Population, M', data: tree }] },
'Bullet': {
categories: ['Revenue', 'Profit', 'Orders'],
series: [{ type: 'bullet', name: 'KPI', data: [
{ y: 270, target: 250, ranges: [150, 225, 300] },
{ y: 180, target: 260, ranges: [150, 225, 300] },
{ y: 240, target: 230, ranges: [150, 225, 300] },
] }],
},
};
const picker = document.createElement('select');
for (const name of Object.keys(charts)) picker.add(new Option(name));
document.getElementById('app').before(picker);
let chart = null;
const show = (name) => {
chart?.destroy();
chart = VibeFoxJSCharts.createChart('#app', charts[name]);
};
picker.onchange = () => show(picker.value);
show(picker.value);Relations, text and time
Pick a chart in the list: a sankey diagram, a chord diagram, a dependency wheel, an arc diagram, a network (drag its nodes), a word cloud, a Venn diagram and a timeline.
const links = [['Coal', 'Power', 40], ['Gas', 'Power', 25], ['Solar', 'Power', 15], ['Power', 'Homes', 35], ['Power', 'Industry', 30], ['Power', 'Losses', 15], ['Gas', 'Homes', 10]];
const charts = {
'Sankey': { series: [{ type: 'sankey', name: 'Energy', data: links, linkColor: 'mix' }] },
'Chord': { series: [{ type: 'chord', name: 'Trade', nodes: ['Europe', 'Asia', 'America', 'Africa'],
matrix: [[0, 5, 4, 2], [6, 0, 5, 1], [3, 4, 0, 1], [2, 1, 1, 0]] }] },
'Dependency wheel': { series: [{ type: 'dependencyWheel', name: 'Modules',
data: [['core', 'ui', 5], ['core', 'data', 4], ['data', 'ui', 3], ['ui', 'app', 6], ['data', 'app', 2], ['auth', 'app', 2], ['core', 'auth', 2]] }] },
'Arc': { series: [{ type: 'arc', name: 'Calls', data: [['A', 'B', 3], ['A', 'D', 2], ['B', 'C', 1], ['C', 'E', 4], ['A', 'E', 1], ['D', 'F', 2], ['B', 'F', 3]] }] },
'Network': { series: [{ type: 'network', name: 'Team', draggable: true,
nodes: [{ id: 'Ann', group: 'Web' }, { id: 'Bob', group: 'Web' }, { id: 'Cid', group: 'Data' }, { id: 'Dan', group: 'Data' }, { id: 'Eve', group: 'Ops' }, { id: 'Fay', group: 'Ops' }],
data: [['Ann', 'Bob'], ['Ann', 'Cid'], ['Bob', 'Cid'], ['Cid', 'Dan'], ['Dan', 'Eve'], ['Eve', 'Fay'], ['Fay', 'Dan'], ['Ann', 'Eve']] }] },
'Word cloud': { series: [{ type: 'wordcloud', name: 'Words', data: [
['charts', 20], ['data', 16], ['canvas', 12], ['zoom', 10], ['legend', 9], ['tooltip', 9], ['export', 8], ['maps', 8],
['series', 7], ['axes', 7], ['themes', 6], ['labels', 6], ['drilldown', 5], ['dashboard', 5], ['realtime', 4], ['webgl', 4], ['pdf', 3], ['svg', 3],
] }] },
'Venn': { series: [{ type: 'venn', name: 'Skills', data: [
{ sets: ['JavaScript'], value: 10 }, { sets: ['Design'], value: 7 }, { sets: ['Data'], value: 6 },
{ sets: ['JavaScript', 'Design'], value: 3 }, { sets: ['JavaScript', 'Data'], value: 2 }, { sets: ['Design', 'Data'], value: 1.5 },
] }] },
'Timeline': { series: [{ type: 'timeline', name: 'Milestones', data: [
{ x: '2026-01-10', name: 'Start', description: 'Kick-off' }, { x: '2026-03-01', name: 'Beta', description: 'First users' },
{ x: '2026-05-20', name: 'Release', description: 'Version 1.0' }, { x: '2026-09-01', name: 'Update', description: 'Version 1.1' },
] }] },
};
const picker = document.createElement('select');
for (const name of Object.keys(charts)) picker.add(new Option(name));
document.getElementById('app').before(picker);
let chart = null;
const show = (name) => {
chart?.destroy();
chart = VibeFoxJSCharts.createChart('#app', charts[name]);
};
picker.onchange = () => show(picker.value);
show(picker.value);Axes
A time x axis and two y axes: the price on the left, the volume on the right with its own format. Press Log scale to switch the left axis to a logarithmic scale and back.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const price = [10, 12, 11, 15, 18, 26, 31, 45, 52, 80, 95, 120];
const volume = [5000, 8000, 6500, 7000, 9000, 12000, 11000, 15000, 14000, 18000, 21000, 19000];
const month = (i) => '2026-' + String(i + 1).padStart(2, '0') + '-01';
const chart = VibeFoxJSCharts.createChart('#app', {
xAxis: { type: 'time' },
yAxis: [{ title: 'Price' }, { title: 'Volume', position: 'right', format: (v) => v / 1000 + 'k' }],
series: [
{ name: 'Price', markers: true, data: price.map((v, i) => [month(i), v]) },
{ name: 'Volume', type: 'column', yAxisIndex: 1, data: volume.map((v, i) => [month(i), v]) },
],
});
addButton('Log scale', () => chart.toggleLogScale(0));Labels, tooltips, legend and annotations
Data labels
Labels with a template outside the columns and percent labels of the pie slices. Press Labels on / off to switch the column labels.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const chart = VibeFoxJSCharts.createChart('#app', {
seriesLayout: 'row',
categories: ['North', 'South', 'East', 'West'],
series: [
{ name: 'Revenue', type: 'column', data: [42, 28, 35, 19],
dataLabels: { show: true, format: '{y} k', position: 'outside' } },
{ name: 'Share', type: 'pie', data: [{ name: 'North', value: 42 }, { name: 'South', value: 28 }, { name: 'East', value: 35 }, { name: 'West', value: 19 }],
dataLabels: { show: true, format: '{percent}' } },
],
});
addButton('Labels on / off', () => chart.toggleDataLabels());Tooltip and legend
One shared tooltip with a crosshair and its own format, the legend on the right. Hover the plot; hover a legend item to highlight its series, click it to hide the series.
VibeFoxJSCharts.createChart('#app', {
title: 'Website traffic',
subtitle: 'Thousands of visits per month',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'],
legend: { position: 'right' },
tooltip: {
shared: true,
crosshair: 'xy',
format: ({ title, rows }) => '<b>' + title + '</b><br>' + rows.map((r) => r.name + ': ' + r.value + ' k').join('<br>'),
},
series: [
{ name: 'Search', type: 'line', smooth: true, data: [32, 35, 38, 36, 42, 45, 44, 48, 52] },
{ name: 'Social', type: 'line', smooth: true, data: [18, 22, 21, 26, 25, 30, 33, 31, 36] },
{ name: 'Direct', type: 'line', smooth: true, data: [12, 12, 14, 13, 15, 16, 15, 17, 18] },
],
});Annotations and statistics lines
A goal line, a shaded campaign band, the marked minimum and maximum of the fact series, and its average and trend lines (stats).
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'],
series: [
{ name: 'Plan', type: 'column', data: [10, 12, 9, 14, 15, 13, 16, 17] },
{ name: 'Fact', type: 'line', markers: true, data: [8, 14, 11, 13, 17, 16, 15, 19], stats: ['avg', 'trend'] },
],
});
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
The dashed outline is last week, kept with snapshot() before the new data was set. Press Next week to compare again.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
const weeks = [[42, 48, 51, 47, 55, 38, 30], [45, 52, 49, 53, 60, 41, 33], [40, 44, 47, 50, 52, 45, 39], [48, 55, 58, 54, 63, 47, 36]];
let week = 0;
const series = (w) => [{ id: 'visits', name: 'Visits, k', type: 'column', data: weeks[w] }];
const chart = VibeFoxJSCharts.createChart('#app', { categories: days, series: series(0) });
const next = () => {
week = (week + 1) % weeks.length;
chart.snapshot();
chart.setData(series(week));
};
addButton('Next week', next);
next();Zoom, navigator and range selector
Two years of daily values with the range selector buttons and dates above, the navigator and the scrollbar below. Press a range button, drag the window in the navigator, or drag on the plot to zoom.
const start = Date.UTC(2025, 0, 1);
const day = 24 * 3600 * 1000;
const data = Array.from({ length: 730 }, (_, i) =>
[start + i * day, Math.round(200 + i * 0.4 + Math.sin(i / 15) * 40 + Math.sin(i / 3) * 12)]);
const chart = VibeFoxJSCharts.createChart('#app', {
xAxis: { type: 'time' },
series: [{ name: 'Active users', type: 'area', fillOpacity: 0.2, data }],
navigator: { enabled: true },
scrollbar: { enabled: true },
rangeSelector: { enabled: true, selected: '6M' },
});Drilldown
Click Europe: its countries open from drilldown.series. Click America: the level is loaded by drilldown.load (here a stub with a short delay instead of a server). The breadcrumbs lead back.
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) => {
await new Promise((resolve) => setTimeout(resolve, 300)); // your server request here
return { type: 'pie', name: ctx.point.name, data: [{ name: 'USA', value: 15 }, { name: 'Canada', value: 5 }] };
},
},
});Real-time data
A new point every half second; the window keeps the last 120 points (realtime.maxPoints).
let t = Date.now() - 60 * 500;
let v = 50;
const next = () => {
t += 500;
v = Math.max(5, Math.min(95, v + (Math.random() - 0.5) * 12));
return [t, Math.round(v)];
};
const chart = VibeFoxJSCharts.createChart('#app', {
xAxis: { type: 'time' },
realtime: { maxPoints: 120 },
series: [{ id: 'cpu', name: 'CPU, %', type: 'area', fillOpacity: 0.25, data: Array.from({ length: 60 }, next) }],
});
setInterval(() => chart.appendData('cpu', [next()]), 500);Data sources
The chart reads the HTML table above it (dataSource.table with watch: true). Click a number in the table and change it: the chart follows.
const table = document.createElement('table');
table.id = 'sales';
table.contentEditable = 'true';
table.innerHTML = '<thead><tr><th>Month</th><th>North</th><th>South</th></tr></thead><tbody>'
+ '<tr><td>Jan</td><td>5</td><td>3</td></tr><tr><td>Feb</td><td>6</td><td>4</td></tr>'
+ '<tr><td>Mar</td><td>7</td><td>2</td></tr><tr><td>Apr</td><td>8</td><td>5</td></tr></tbody>';
document.getElementById('app').before(table);
VibeFoxJSCharts.createChart('#app', {
dataSource: { table: '#sales', watch: true, type: 'column', x: 'Month', y: ['North', 'South'] },
});Large data
A line of 200 000 points drawn through WebGL (largeData.webgl) and downsampled to the visible window; the line under the chart is getRenderInfo(). Zoom in with the wheel: more detail appears. The library handles millions of points; the demo keeps the page light.
const output = document.createElement('p');
document.getElementById('app').after(output);
const points = Array.from({ length: 200000 }, (_, i) =>
[i, Math.sin(i / 5000) * 100 + Math.sin(i / 300) * 20 + ((i * 7919) % 100) / 10]);
const chart = VibeFoxJSCharts.createChart('#app', {
series: [{ name: 'Signal', type: 'line', data: points }],
largeData: { webgl: true },
});
const info = () => {
const r = chart.getRenderInfo()[0];
output.textContent = r.points + ' points, ' + r.drawn + ' drawn, method ' + r.method + ', renderer ' + r.renderer;
};
chart.on('zoomChange', info);
info();Editing points
Drag a column up or down (steps of 0.5 between 0 and 10), or focus the chart and use Shift+arrows. Undo and Redo (or Ctrl+Z / Ctrl+Y) step through the drags.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const output = document.createElement('p');
document.getElementById('app').after(output);
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['A', 'B', 'C', 'D', 'E'],
yAxis: { min: 0, max: 10 },
series: [{ name: 'Budget', type: 'column', data: [5, 7, 3, 6, 4], draggable: { min: 0, max: 10, step: 0.5 } }],
});
chart.on('pointDrop', (e) => { output.textContent = 'New value of ' + chart.getOption('categories')[e.index] + ': ' + e.value.y; });
addButton('Undo', () => chart.undo());
addButton('Redo', () => chart.redo());Maps
A choropleth of a small made-up country (its GeoJSON is in the code), with capitals as points and a route. Hover a region, scroll to zoom, drag to pan, double-click to reset; Zoom to North calls zoomToRegion().
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
// your GeoJSON (here: six made-up regions); TopoJSON works too
const T = [[0, 52], [4.2, 52.6], [8.1, 52.3], [12, 51.6]];
const M = [[-0.4, 48.2], [4.6, 47.7], [7.6, 48.5], [12.5, 48]];
const B = [[0.3, 44], [4, 43.6], [8.4, 44.2], [11.6, 44.5]];
const region = (id, name, low, high, i) => ({ type: 'Feature', id, properties: { name },
geometry: { type: 'Polygon', coordinates: [[low[i], low[i + 1], high[i + 1], high[i], low[i]]] } });
const geo = { type: 'FeatureCollection', features: [
region('NW', 'Northwest', M, T, 0), region('N', 'North', M, T, 1), region('NE', 'Northeast', M, T, 2),
region('SW', 'Southwest', B, M, 0), region('S', 'South', B, M, 1), region('SE', 'Southeast', B, M, 2),
] };
const chart = VibeFoxJSCharts.createChart('#app', {
map: { data: geo },
colorAxis: { type: 'sequential', steps: 5, title: 'Population (M)' },
series: [
{ type: 'map', name: 'Population', joinBy: 'id', data: [
{ id: 'NW', value: 4.2 }, { id: 'N', value: 9.8 }, { id: 'NE', value: 6.1 },
{ id: 'SW', value: 2.4 }, { id: 'S', value: 7.3 }, { id: 'SE', value: 3.5 },
] },
{ type: 'mappoint', name: 'Cities', data: [
{ name: 'Northport', lon: 6.2, lat: 50.4 }, { name: 'Southfield', lon: 6, lat: 46 }, { name: 'Eastbay', lon: 10.5, lat: 49.5 },
] },
{ type: 'mapline', name: 'Route', data: [{ from: [6.2, 50.4], to: [10.5, 49.5] }, { from: [6.2, 50.4], to: [6, 46] }] },
],
});
addButton('Zoom to North', () => chart.zoomToRegion(0, 'N'));
addButton('Reset', () => chart.resetMapView());Responsive rules
Move the slider to change the width of the chart: below 500 px the legend moves to the bottom, the x labels turn and the data labels are hidden.
const output = document.createElement('p');
document.getElementById('app').after(output);
const app = document.getElementById('app');
const slider = document.createElement('input');
slider.type = 'range'; slider.min = 300; slider.max = 900; slider.value = 900;
app.before(slider);
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['January', 'February', 'March', 'April', 'May', 'June'],
legend: { position: 'right' },
dataLabels: true,
series: [
{ name: 'Laptops', type: 'column', data: [12, 15, 11, 18, 21, 19] },
{ name: 'Phones', type: 'column', data: [22, 19, 24, 27, 25, 30] },
],
responsive: { rules: [
{ condition: { maxWidth: 500 }, options: { legend: { position: 'bottom' }, xAxis: { labelRotation: 45 }, dataLabels: false } },
] },
});
chart.on('responsiveChange', (e) => { output.textContent = 'Width ' + Math.round(e.width) + ' px, rules active: ' + e.active.length; });
slider.oninput = () => { app.style.maxWidth = slider.value + 'px'; };Dashboards
KPI tiles, two charts and two filters from one configuration. Click a slice of the pie: the column chart and the KPIs show only that region (cross-filtering); change the product filter.
const regions = ['North', 'South', 'East', 'West'];
const products = ['Laptops', 'Phones', 'Tablets'];
const data = [];
for (let m = 1; m <= 12; m++) {
for (let r = 0; r < regions.length; r++) {
for (let p = 0; p < products.length; p++) {
data.push({ date: '2026-' + String(m).padStart(2, '0') + '-15', region: regions[r], product: products[p],
amount: 50 + ((m * 37 + r * 53 + p * 71) % 90) + m * 4 });
}
}
}
const dash = VibeFoxJSCharts.createChartDashboard('#app', {
title: 'Sales 2026',
data,
kpis: [
{ id: 'total', title: 'Revenue', field: 'amount', aggregate: 'sum', format: { compact: true }, sparkline: { field: 'date', by: 'month' } },
{ id: 'avg', title: 'Average order', field: 'amount', aggregate: 'avg' },
{ id: 'count', title: 'Orders', field: 'amount', aggregate: 'count' },
],
charts: [
{ id: 'byRegion', title: 'By region', type: 'pie', x: 'region', y: 'amount', aggregate: 'sum' },
{ id: 'byMonth', title: 'By month', type: 'column', x: { field: 'date', by: 'month' }, y: 'amount', series: 'product', stacked: true },
],
filters: [
{ id: 'product', field: 'product', type: 'multiselect' },
{ id: 'region', field: 'region', type: 'select' },
],
layout: { breakpoints: { 0: 6 } }, // six columns at every width
});Export
The buttons download the chart as PNG, SVG (vectors), PDF (vectors), CSV and Excel files, open the print dialog, or show the data as an accessible table.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
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', markers: true, data: [8, 14, 11, 13, 17, 16] },
],
});
addButton('PNG', () => chart.exportPNG('sales.png'));
addButton('SVG', () => chart.exportSVG('sales.svg'));
addButton('PDF', () => chart.exportPDF('sales.pdf', { pageSize: 'A4', orientation: 'landscape' }));
addButton('CSV', () => chart.exportCSV('sales.csv'));
addButton('Excel', () => chart.exportXLSX('sales.xlsx', { sheets: 'series' }));
addButton('Print', () => chart.print());
addButton('Data table', () => chart.toggleDataView());Rendering without a DOM
No chart component here: renderToSVG() returned an SVG string (shown as an image), the same call works in Node or a worker. Press New data to render it again.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const img = document.createElement('img');
img.alt = 'Rendered chart';
document.getElementById('app').append(img);
let n = 0;
const render = () => {
n++;
const svg = VibeFoxJSCharts.renderToSVG({
title: 'Report ' + n,
categories: ['A', 'B', 'C', 'D', 'E'],
series: [{ name: 'Value', type: 'column', data: [3, 5, 2, 6, 4].map((v, i) => v + ((n * (i + 2)) % 4)) }],
}, { width: 600, height: 300, theme: 'light' });
img.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg);
};
addButton('New data', render);
render();Text to chart and explanations
Type a request (or pick one) and press Make chart: textToChart() builds the options with built-in rules, no model needed. The text under the chart is explain().
const output = document.createElement('p');
document.getElementById('app').after(output);
const rows = [
{ month: 'Jan', region: 'North', product: 'Laptops', sales: 120 }, { month: 'Jan', region: 'South', product: 'Phones', sales: 80 },
{ month: 'Feb', region: 'North', product: 'Phones', sales: 150 }, { month: 'Feb', region: 'East', product: 'Tablets', sales: 60 },
{ month: 'Mar', region: 'South', product: 'Laptops', sales: 170 }, { month: 'Mar', region: 'West', product: 'Phones', sales: 90 },
{ month: 'Apr', region: 'East', product: 'Laptops', sales: 140 }, { month: 'Apr', region: 'West', product: 'Tablets', sales: 75 },
{ month: 'May', region: 'North', product: 'Tablets', sales: 110 }, { month: 'May', region: 'South', product: 'Phones', sales: 130 },
];
const input = document.createElement('input');
input.size = 40;
input.value = 'sales by region as pie';
input.setAttribute('list', 'requests');
const list = document.createElement('datalist');
list.id = 'requests';
for (const r of ['sales by region as pie', 'sales by month as line', 'sales by product as bar', 'sales by month and region stacked column']) list.append(new Option(r));
const button = document.createElement('button');
button.textContent = 'Make chart';
document.getElementById('app').before(input, list, button);
let chart = null;
const make = () => {
chart?.destroy();
chart = VibeFoxJSCharts.createChart('#app', VibeFoxJSCharts.textToChart(input.value, rows));
output.textContent = chart.explain();
};
button.onclick = make;
make();Theming and styling
Themes
Pick a theme in the list: light, dark, high-contrast and themes of the pack vibefox-js-themes.css (ocean, sunset, glass-dark, paper, graphite-dark).
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', markers: true, data: [8, 14, 11, 13, 17, 16] },
{ name: 'Last year', type: 'line', dash: [6, 4], data: [7, 9, 10, 11, 12, 12] },
],
});
const picker = document.createElement('select');
for (const name of ['light', 'dark', 'high-contrast', 'ocean', 'sunset', 'glass-dark', 'paper', 'graphite-dark']) picker.add(new Option(name));
picker.onchange = () => chart.setTheme(picker.value);
document.getElementById('app').before(picker);CSS variables
Only CSS variables of this chart are changed: the accent and series colors, a larger font, dashed grid lines and rounded columns.
const app = document.getElementById('app');
app.style.cssText = '--vfjs-charts-font-size: 14px; --vfjs-charts-grid-dash: 4 3; --vfjs-charts-bar-radius: 6px;'
+ '--vfjs-charts-color-0: #0f766e; --vfjs-charts-color-1: #f59e0b; --vfjs-charts-title-fg: #0f766e;';
VibeFoxJSCharts.createChart('#app', {
title: 'Styled with CSS variables',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Plan', type: 'column', data: [10, 12, 9, 14, 15, 13] },
{ name: 'Fact', type: 'line', markers: true, data: [8, 14, 11, 13, 17, 16] },
],
});Ready-made styles and palettes
Pick a ready-made style (vivid, pastel, monochrome, dark, print) and a palette (also the ones safe for color blindness). Print and monochrome use hatches, dashes and marker shapes.
const chart = VibeFoxJSCharts.createChart('#app', {
categories: ['Q1', 'Q2', 'Q3', 'Q4'],
series: [
{ name: 'North', type: 'column', data: [5, 6, 7, 8] },
{ name: 'South', type: 'column', data: [3, 4, 2, 5] },
{ name: 'East', type: 'column', data: [4, 5, 6, 4] },
{ name: 'Target', type: 'line', markers: true, data: [6, 7, 8, 9] },
{ name: 'Last year', type: 'line', markers: true, data: [4, 4, 5, 6] },
],
});
const style = document.createElement('select');
const palette = document.createElement('select');
style.add(new Option('style: default', ''));
for (const name of VibeFoxJSCharts.CHART_STYLES) style.add(new Option('style: ' + name, name));
palette.add(new Option('palette: default', ''));
for (const name of VibeFoxJSCharts.CHART_PALETTES) palette.add(new Option('palette: ' + name, name));
style.onchange = () => chart.setStyle(style.value || null);
palette.onchange = () => chart.setPalette(palette.value || null);
document.getElementById('app').before(style, palette);Density and size
Pick a density for the container (data-vfjs-density) and a size unit (--vfjs-size-unit): texts, paddings and markers follow.
const app = document.getElementById('app');
app.style.height = '400px';
const chart = VibeFoxJSCharts.createChart('#app', {
title: 'Density',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Plan', type: 'column', data: [10, 12, 9, 14, 15, 13] },
{ name: 'Fact', type: 'line', markers: true, data: [8, 14, 11, 13, 17, 16] },
],
});
const density = document.createElement('select');
for (const name of ['normal', 'compact', 'comfortable']) density.add(new Option('density: ' + name, name));
density.onchange = () => { app.dataset.vfjsDensity = density.value; };
const unit = document.createElement('select');
for (const px of ['1px', '0.8px', '1.25px']) unit.add(new Option('--vfjs-size-unit: ' + px, px));
unit.onchange = () => app.style.setProperty('--vfjs-size-unit', unit.value);
app.before(density, unit);Your own CSS
Plain CSS rules of the page restyle the legend and the title; they win over the library without !important because the library CSS is in @layer vfjs.
const css = document.createElement('style');
css.textContent = '.vfjs-chart-legend-item { font-weight: 600; text-transform: uppercase; }'
+ ' .vfjs-chart-header { text-align: start; border-bottom: 2px solid #0f766e; }';
document.head.append(css);
VibeFoxJSCharts.createChart('#app', {
title: 'My styled chart',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Plan', type: 'column', data: [10, 12, 9, 14, 15, 13] },
{ name: 'Fact', type: 'line', markers: true, data: [8, 14, 11, 13, 17, 16] },
],
});Localization and RTL
Languages
Switch the language between English and Russian (the language pack vibefox-js-charts.ru.js is loaded after the library): the range selector, the statistics lines, the month names of the time axis and the number format follow.
const start = Date.UTC(2025, 0, 1);
const day = 24 * 3600 * 1000;
const chart = VibeFoxJSCharts.createChart('#app', {
locale: 'en',
xAxis: { type: 'time' },
rangeSelector: { enabled: true, selected: '6M' },
series: [{ name: 'Orders', type: 'line', stats: ['avg', 'min', 'max'],
data: Array.from({ length: 365 }, (_, i) => [start + i * day, Math.round(12000 + Math.sin(i / 20) * 3000 + i * 10)]) }],
});
const picker = document.createElement('select');
picker.add(new Option('English', 'en'));
picker.add(new Option('Русский', 'ru'));
picker.onchange = () => chart.setOptions({ locale: picker.value });
document.getElementById('app').before(picker);Adding a language
A partial German dictionary added with addLocale(): the range selector and the statistics lines use it, the month names come from the browser, the rest falls back to English.
VibeFoxJSCharts.addLocale('de', {
chartRangeAll: 'Alle',
chartRangeAllTitle: 'Alle Daten',
chartRangeFrom: 'Von',
chartRangeTo: 'Bis',
chartRangeShortM: 'M',
chartRangeShortY: 'J',
chartStatAvg: 'Durchschnitt',
chartStatMin: 'Minimum',
chartStatMax: 'Maximum',
});
const start = Date.UTC(2025, 0, 1);
const day = 24 * 3600 * 1000;
VibeFoxJSCharts.createChart('#app', {
locale: 'de',
xAxis: { type: 'time' },
rangeSelector: { enabled: true, selected: '6M' },
series: [{ name: 'Bestellungen', type: 'line', stats: ['avg', 'min', 'max'],
data: Array.from({ length: 365 }, (_, i) => [start + i * day, Math.round(12000 + Math.sin(i / 20) * 3000 + i * 10)]) }],
});Right-to-left
The option rtl: true: the title, the legend and the tooltip follow the right-to-left direction; the plot keeps x growing to the right.
VibeFoxJSCharts.createChart('#app', {
rtl: true,
title: 'المبيعات',
subtitle: 'Sales by quarter',
categories: ['Q1', 'Q2', 'Q3', 'Q4'],
series: [
{ name: 'الشمال', type: 'column', data: [5, 6, 7, 8] },
{ name: 'الجنوب', type: 'column', data: [3, 4, 2, 5] },
],
});Accessibility
Keyboard
The third point is focused from code (focusPoint()). Click the chart (or Tab to it) and use the arrow keys, Home / End, + / − to zoom, Enter to click a point.
const chart = VibeFoxJSCharts.createChart('#app', {
title: 'Use the keyboard',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'],
series: [
{ name: 'Visitors', type: 'line', markers: true, data: [42, 45, 51, 49, 58, 63, 61, 67] },
{ name: 'Orders', type: 'line', markers: true, data: [12, 14, 13, 17, 19, 18, 22, 24] },
],
});
chart.focusPoint(0, 2, { focus: false });Screen readers
The text under the chart is getSummary(), the description screen readers get. Speak summary announces it to a screen reader; Data table shows the data as an accessible HTML table.
function addButton(text, onClick) {
const b = document.createElement('button');
b.textContent = text;
b.onclick = onClick;
document.getElementById('app').before(b);
}
const output = document.createElement('p');
document.getElementById('app').after(output);
const chart = VibeFoxJSCharts.createChart('#app', {
title: 'Revenue and costs',
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
series: [
{ name: 'Revenue', type: 'column', data: [120, 135, 128, 150, 162, 171] },
{ name: 'Costs', type: 'line', markers: true, data: [90, 95, 99, 101, 108, 110] },
],
});
output.textContent = chart.getSummary();
addButton('Speak summary', () => chart.announceSummary());
addButton('Data table', () => chart.toggleDataView());Using with other VibeFox JS libraries
Connecting components with link()
Two charts joined with link(): zoom the upper chart (drag on its plot or use its navigator) and the lower chart shows the same range.
const app = document.getElementById('app');
const upper = document.createElement('div');
const lower = document.createElement('div');
upper.style.height = '260px';
lower.style.height = '200px';
app.append(upper, lower);
const start = Date.UTC(2026, 0, 1);
const day = 24 * 3600 * 1000;
const days = Array.from({ length: 180 }, (_, i) => start + i * day);
const overview = VibeFoxJSCharts.createChart(upper, {
title: 'Price', xAxis: { type: 'time' }, navigator: { enabled: true },
series: [{ name: 'Price', type: 'line', data: days.map((t, i) => [t, Math.round(100 + i * 0.3 + Math.sin(i / 9) * 12)]) }],
});
const detail = VibeFoxJSCharts.createChart(lower, {
title: 'Volume', xAxis: { type: 'time' }, zoom: { enabled: false },
series: [{ name: 'Volume', type: 'column', data: days.map((t, i) => [t, 500 + ((i * 7919) % 400)]) }],
});
VibeFoxJSCharts.link(overview, 'zoomChange', detail, 'setXRange');
overview.setZoom(0.5, 0.8);AI tools
Type a request such as "show as bar", "pie" or "title Revenue 2026" and press Ask. The model function here is a small stub that answers with a tool call; in your application it sends the request to your model. The log shows the tool calls.
const output = document.createElement('p');
document.getElementById('app').after(output);
const chart = VibeFoxJSCharts.createChart('#app', {
title: 'Sales',
categories: ['North', 'South', 'East', 'West'],
series: [{ name: 'Sales', type: 'column', data: [42, 28, 35, 19] }],
});
const kit = VibeFoxJSCharts.createToolKit({ sales: chart });
// stub of your model: reads the last user message and answers with a tool call or a text
async function model(request) {
const last = request.messages[request.messages.length - 1];
if (last.role === 'tool') return { text: 'Done.' };
const text = last.content.toLowerCase();
const type = ['bar', 'pie', 'line', 'area', 'column', 'donut'].find((t) => text.includes(t));
const title = text.startsWith('title ') ? last.content.slice(6) : null;
if (title) return { toolCalls: [{ name: 'sales_chart_set_options', arguments: { title } }] };
if (type) {
const values = [42, 28, 35, 19];
const data = type === 'pie' || type === 'donut' ? ['North', 'South', 'East', 'West'].map((name, i) => ({ name, value: values[i] })) : values;
return { toolCalls: [{ name: 'sales_chart_set_options', arguments: { series: [{ name: 'Sales', type, data }] } }] };
}
return { toolCalls: [{ name: 'sales_chart_explain', arguments: {} }] };
}
const input = document.createElement('input');
input.size = 30;
input.value = 'show as bar';
const button = document.createElement('button');
button.textContent = 'Ask';
document.getElementById('app').before(input, button);
output.textContent = 'Tools: ' + kit.describe().map((t) => t.name).join(', ');
button.onclick = async () => {
const answer = await kit.ask(input.value, { model });
output.textContent = answer.calls.map((c) => c.name + ' ' + JSON.stringify(c.args) + ' → ' + JSON.stringify(c.result)).join('; ') || answer.text;
};