VibeFox JS Charts — 데모
빠른 시작
일반 HTML
계획을 나타내는 열, 마커가 있는 실적 선과 그 평균선입니다. 차트에 마우스를 올리면 공용 툴팁이 표시되고, 열을 클릭할 수 있으며, 범례 항목을 클릭하면 계열을 숨길 수 있고, 플롯 영역에서 마우스 휠을 굴리면 확대/축소됩니다.
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 }) },
});핵심 개념
계열과 점
단순한 숫자로 지정한 점(목요일에는 null로 인해 빈 구간이 생김), 범주 이름이 있는 [x, y] 쌍, 그리고 자체 label과 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 },
] },
],
});이벤트
차트 아래 줄에는 마지막 이벤트와 그 페이로드가 표시됩니다. 점을 클릭하고, 범례 항목을 클릭하고, 플롯 영역에서 드래그해 확대/축소해 보십시오.
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); });상태 스냅샷
확대하고 계열을 숨긴 다음 Save state를 누르십시오. 그런 다음 보기를 변경하거나(또는 Reset zoom을 누른 후) Restore state를 누르십시오. 저장된 JSON은 차트 아래에 표시됩니다.
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');계열 유형
직교 좌표계 계열
목록에서 차트를 선택하십시오: 목표선이 있는 누적 열, 영역, 막대, 산점도와 버블, 히트맵, 워터폴, 상자 수염 그림, 히스토그램, 범위 막대, 그리고 x 범위 계열(행에 작업 표시)입니다.
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);원형 및 축이 없는 기타 계열
목록에서 차트를 선택하십시오: 게이지가 있는 도넛 차트, 원형 차트(조각을 클릭하면 해당 조각이 분리됨), 레이더 차트, 극좌표 차트, 방사형 막대 차트, 피라미드형 깔때기 차트, 트리맵, 선버스트 및 불릿 차트입니다.
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);관계, 텍스트 및 시간
목록에서 차트를 선택하십시오: 생키 다이어그램, 코드 다이어그램, 의존성 휠, 호 다이어그램, 네트워크(노드 드래그 가능), 워드 클라우드, 벤 다이어그램 및 타임라인입니다.
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);축
시간 x축과 두 개의 y축입니다: 왼쪽에는 가격, 오른쪽에는 자체 형식을 가진 거래량이 표시됩니다. Log scale을 누르면 왼쪽 축이 로그 눈금으로 전환되고, 다시 누르면 원래대로 돌아갑니다.
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 on / off를 누르면 열 레이블이 켜지거나 꺼집니다.
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());툴팁과 범례
십자선과 자체 형식을 가진 공용 툴팁 하나, 그리고 오른쪽의 범례입니다. 플롯 영역에 마우스를 올리십시오. 범례 항목에 마우스를 올리면 해당 계열이 강조되고, 클릭하면 계열이 숨겨집니다.
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] },
],
});주석과 통계선
목표선, 음영 처리된 캠페인 띠, 실적 계열의 표시된 최솟값과 최댓값, 그리고 평균선과 추세선(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);고스트 비교
점선 윤곽은 지난주 데이터로, 새 데이터를 설정하기 전에 snapshot()으로 보관해 둔 것입니다. 다시 비교하려면 Next week를 누르십시오.
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();확대/축소, 내비게이터, 범위 선택기
범위 선택기 버튼과 위쪽 날짜, 아래쪽 내비게이터 및 스크롤바가 있는 2년간의 일별 값입니다. 범위 버튼을 누르거나, 내비게이터에서 창을 드래그하거나, 플롯 영역에서 드래그해 확대/축소해 보십시오.
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' },
});드릴다운
Europe 항목을 클릭하면 해당 국가들이 drilldown.series에서 열립니다. America 항목을 클릭하면 해당 단계가 drilldown.load로 로드됩니다(여기서는 서버 대신 잠시 지연 후 응답하는 스텁입니다). 브레드크럼으로 이전 단계로 돌아갈 수 있습니다.
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 }] };
},
},
});실시간 데이터
0.5초마다 새 점이 추가되며, 창에는 마지막 120개의 점이 유지됩니다(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);데이터 소스
차트는 위에 있는 HTML 표를 읽습니다(watch: true가 설정된 dataSource.table). 표에서 숫자를 클릭해 값을 바꾸면 차트가 따라갑니다.
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'] },
});대용량 데이터
WebGL(largeData.webgl)로 그리고 보이는 창에 맞게 다운샘플링한 200,000개 점의 선입니다. 차트 아래 줄은 getRenderInfo()의 출력입니다. 휠로 확대하면 더 자세한 내용이 나타납니다. 라이브러리는 수백만 개의 점을 처리할 수 있으며, 데모에서는 페이지를 가볍게 유지합니다.
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();점 편집
열을 위아래로 드래그하십시오(0과 10 사이, 0.5 단위). 또는 차트에 포커스를 두고 Shift+화살표 키를 사용하십시오. Undo와 Redo(또는 Ctrl+Z / Ctrl+Y)로 드래그를 단계별로 되돌리거나 다시 실행합니다.
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());지도
가상의 작은 나라를 나타내는 코로플레스 지도(GeoJSON은 코드에 있음)로, 수도는 점으로, 경로가 함께 표시됩니다. 지역에 마우스를 올리고, 휠로 확대/축소하며, 드래그로 이동하고, 더블클릭하면 초기화됩니다. Zoom to North는 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());반응형 규칙
슬라이더를 움직여 차트의 너비를 바꾸십시오: 500 px 미만에서는 범례가 아래로 이동하고, x 레이블이 회전하며, 데이터 레이블이 숨겨집니다.
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'; };대시보드
하나의 구성에서 만든 KPI 타일, 차트 두 개, 필터 두 개입니다. 원형 차트의 조각을 클릭하면 열 차트와 KPI가 해당 지역만 표시합니다(교차 필터링). 제품 필터를 바꿔 보십시오.
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
});내보내기
버튼을 사용하면 차트를 PNG, SVG(벡터), PDF(벡터), CSV 및 Excel 파일로 다운로드하거나, 인쇄 대화상자를 열거나, 데이터를 접근성 표로 표시할 수 있습니다.
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());DOM 없이 렌더링
여기에는 차트 컴포넌트가 없습니다. renderToSVG()는 SVG 문자열을 반환하며(이미지로 표시됨), 같은 호출을 Node나 워커에서도 사용할 수 있습니다. New data를 누르면 다시 렌더링됩니다.
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();텍스트에서 차트 생성과 설명
요청을 입력하거나 목록에서 하나를 고른 다음 Make chart를 누르십시오. textToChart()가 내장 규칙으로 옵션을 만들며, 모델은 필요하지 않습니다. 차트 아래의 텍스트는 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();테마 및 스타일
테마
목록에서 테마를 고르십시오: light, dark, high-contrast 및 팩 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 변수
이 차트의 CSS 변수만 변경됩니다: 강조색과 계열 색상, 더 큰 글꼴, 점선 격자선, 둥근 모서리의 열.
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] },
],
});기본 제공 스타일과 팔레트
기본 제공 스타일(vivid, pastel, monochrome, dark, print)과 팔레트(색맹에도 안전한 팔레트 포함)를 고르십시오. print와 monochrome은 해칭, 점선, 마커 모양을 사용합니다.
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);밀도와 크기
컨테이너의 밀도(data-vfjs-density)와 크기 단위(--vfjs-size-unit)를 선택하십시오. 텍스트, 여백, 마커가 그에 따라 변합니다.
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);직접 작성한 CSS
페이지의 일반 CSS 규칙으로 범례와 제목의 스타일을 바꿀 수 있으며, 라이브러리 CSS가 @layer vfjs에 있어서 !important 없이도 라이브러리보다 우선 적용됩니다.
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] },
],
});현지화 및 RTL
언어
영어와 러시아어 사이에서 언어를 전환하십시오(언어 팩 vibefox-js-charts.ru.js는 라이브러리 뒤에 로드됨). 범위 선택기, 통계선, 시간 축의 월 이름과 숫자 형식이 함께 바뀝니다.
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);언어 추가
addLocale()로 추가한 부분 독일어 사전입니다. 범위 선택기와 통계선이 이를 사용하고, 월 이름은 브라우저에서 가져오며, 나머지는 영어로 대체됩니다.
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)]) }],
});오른쪽에서 왼쪽 방향(RTL)
옵션 rtl: true: 제목, 범례, 툴팁이 오른쪽에서 왼쪽 방향을 따르고, 플롯은 x가 계속 오른쪽으로 증가합니다.
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] },
],
});접근성
키보드
세 번째 점은 코드(focusPoint())로 포커스를 받습니다. 차트를 클릭하거나(또는 Tab으로 이동한 뒤) 화살표 키, Home / End, + / −로 확대/축소하고, Enter로 점을 클릭하십시오.
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 });스크린 리더
차트 아래의 텍스트는 스크린 리더가 받는 설명, 즉 getSummary()입니다. Speak summary를 누르면 요약이 스크린 리더에 전달되고, Data table은 데이터를 접근성 HTML 표로 보여 줍니다.
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());다른 VibeFox JS 라이브러리와 함께 사용
link()로 컴포넌트 연결
link()로 연결된 두 차트입니다. 위쪽 차트를 확대하면(플롯 영역에서 드래그하거나 내비게이터 사용) 아래쪽 차트에도 같은 범위가 표시됩니다.
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 도구
"show as bar", "pie" 또는 "title Revenue 2026"과 같은 요청을 입력하고 Ask를 누르십시오. 여기서 model 함수는 도구 호출로 응답하는 작은 스텁입니다. 실제 애플리케이션에서는 요청을 모델로 보냅니다. 로그에 도구 호출이 표시됩니다.
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;
};