Methods
The object createProChart() returns (the Vue and React components hand over the same object in created):
| Member | Description |
|---|---|
chart |
The current chart (a Chart of @kumo-charts/core), on which the top bar and the drawing tools act; null until it is ready |
charts |
Every chart shown in the multi-chart layout, the current one included; only the current chart shows when the container is narrow |
setSymbol(id, target?) |
Switches the symbol of the current chart, and of every chart when the symbol is linked. The symbol is found with resolveSymbol first; when it cannot be found, it rejects and does not switch |
setTimeframe(timeframe, target?) |
Switches the timeframe of the current chart, which must be one of the timeframes offered |
setChartType(type, settings?, target?) |
The chart type, see "Chart types"; settings are the settings of a kind of bars that has them (as tick bars), as setChartType('tick', { count: 500 }), with those not given kept as they are |
applyOptions(options) |
Changes options after the chart shows, see the section before |
addIndicator(type, input?, target?) |
Adds an indicator to the current chart and returns its id; input (ProChartIndicatorInput) can give id, params, source, visible, lines, levels, autoscale and pane (see below) |
updateIndicator(id, patch, target?) |
Changes an indicator: params and lines are merged key by key, and the others replaced |
removeIndicator(id, target?) |
Removes an indicator |
registerIndicator(indicator) |
Registers an indicator of your own, see "Custom indicators" |
unregisterIndicator(type) |
Takes down an indicator the page registered: the dialog no longer lists it, and its indicators on the chart are no longer drawn but stay in the state, drawn again when registered again |
registerDrawing(drawing) |
Registers a drawing tool of your own, see "Custom drawing tools" |
unregisterDrawing(type) |
Takes down a drawing tool the page registered: the drawing toolbar no longer has it, and such drawings on the chart are no longer drawn but stay in the state, drawn again when registered again |
addComparison(symbol, input?, target?) |
Compares a symbol on the current chart and returns its id; input (ProChartComparisonInput) can give id, placement (percent by default, scale, pane), style, color, width and visible, see "Comparing symbols" |
updateComparison(id, patch, target?) |
Changes a compared symbol: the settings given are replaced, and the rest stay |
removeComparison(id, target?) |
Takes a compared symbol away |
getAlerts(symbol?) |
The alerts of every symbol (or of one), each with its symbol and status (whether the page is watching it), see "Alerts" |
addAlert(alert, symbol?) |
Adds an alert to a symbol and returns its id; without a symbol, the current chart's |
updateAlert(id, patch), removeAlert(id) |
Changes an alert (ProChartAlertPatch: the settings given are replaced, and the rest stay), and removes one |
setRemoteAlerts(statuses) |
Hands alerts over to be judged elsewhere (by your server, say, to alert with the page closed too): the page no longer watches and shows the statuses given; null hands them back to the page (see "Alerts") |
reportAlert(id, { time, price }) |
An alert judged elsewhere fired: the message pops up, the sound plays and the alert event is emitted (remote: true), as for one the page fired itself |
describeAlert(id) |
The title and body the page says when the alert fires ({ title, body }, in the chart's current language), for notifications sent elsewhere to say the same |
setLayout(grid) |
The multi-chart layout: single, columns (side by side), rows (stacked), three (one large on the left, two small on the right), three-right (two small on the left, one large on the right), four, six-wide (two rows of three), six-tall (three rows of two), six-left (one large on the left, five small on the right) and six-top (one large on top, five small below) |
setLinks({ symbol, timeframe, crosshair, time, drawings }) |
Whether the other charts follow the current one when it switches the symbol or the timeframe, moves the crosshair, goes to a time, and whether they share drawings (on: charts of the same symbol share one set of drawings; off: each draws its own); only what is given changes |
setActiveChart(index) |
Makes chart index of the layout (from 0) the current one |
setFavoriteTimeframes(timeframes) |
The timeframes shown right in the top bar, the rest in the timeframe menu |
setFavoriteChartTypes(types) |
The chart types shown beside the chart type button of the top bar, as starring them in the menu does |
setFavoriteDrawingTools(types) |
The drawing tools in the bar of favorite drawing tools, as starring them in the tool lists does; empty, the bar is not shown |
setAlertSound(sound) |
The main switch and volume of alert sounds: { on?, volume? }, with volume from 0 to 1 and what is not given unchanged |
startReplay(time?, target?), stopReplay(target?) |
Replays from the bar at time, with the charts of the same symbol together; without time, as clicking the replay button, the user picks the start on the chart |
openDialog(dialog), closeDialog() |
Opens the window of symbol search (symbolSearch), comparing symbols (compare), indicators (indicators), chart settings (chartSettings), exporting the chart's data (exportData) or the list of shortcuts (shortcuts) |
notify(text) |
Shows a notice above the chart, which the user can close |
getChartView(target?) |
What a chart shows, as kept in the state: the symbol, the timeframe, the chart type and the settings of each kind of bars, indicators, compared symbols, the price scale, the latest price, and the pane heights the user dragged (paneHeights) |
getLayout() |
The layout: grid (how many charts), active (the current chart) and links (what of the current chart the others follow) |
getState() |
The whole state (ChartState), as saved to storage, see "Saving the state" |
setState(state) |
Shows a state getState() gave: the chart is rebuilt by it |
getDrawings(target?) |
The drawings of a chart on a symbol, with target as { chart?, symbol? }, the current chart and its symbol without it; drawings belong to charts, and those of symbols not shown are kept too |
addDrawing(drawing, symbol?) |
Adds a drawing to a symbol and returns its id, see "Drawing through methods" below |
updateDrawing(id, patch, symbol?) |
Changes a drawing: points, text, timeframes and the like are replaced whole, and style is merged field by field |
removeDrawing(id, symbol?) |
Removes a drawing, along with the alerts on it |
on(event, listener) |
Listens to an event, and returns a function that stops listening |
destroy() |
Takes the chart off the page and stops its market data subscriptions; calls still queued are rejected along with it |
Except chart, charts, on and destroy, the methods return Promises:
- Calls made before it is ready are queued, and run in the order called once it is ready, so calling right after creating it is fine. When the result is not needed, just call them. Calls still queued at
destroy()are rejected, like the calls after it:The pro chart was destroyed: create another one. - Misuse rejects the Promise, with an error message that says what is wrong and what can be written, as
There is no indicator "RSII": the types are MA, EMA, …orThe timeframe "7m" is not offered: the timeframes are 1m, 5m, …. The parameters, source and reference lines of indicators are checked by the library'scheckIndicatorInput()(volume profiles too), with the error messages of the library'schart.indicators.add(), asparams.period must be at least 1, received 0.. A misspelled field in the settings (asparam) rejects too, rather than quietly doing nothing. - Methods act on the current chart (the one highlighted in the top bar) by default. Methods with a
targetcan work on another chart of the layout without changing the current one:{ chart: 1 }is the second (from 0), asaddIndicator('RSI', {}, { chart: 1 }).
const id = await chart.addIndicator('RSI', { params: { period: 6 } });
await chart.updateIndicator(id, { lines: { rsi: { color: '#f59e0b', width: 2 } } });
chart.setLayout('columns');
chart.startReplay(Date.UTC(2026, 0, 5)); // replay from the bar of 2026-01-05The pane an indicator is drawn in is set by pane: null (the default) goes by the indicator's type, with main-pane indicators on the bars, others in a pane of their own, and volume below the bars; 'main' draws it on the bars (an indicator that would have a pane of its own then uses its own scale over the bars, without squashing them); 'new' gives it a pane of its own; and the id of another indicator before it on the chart shares that indicator's pane. Once the indicator shared with is removed, it goes by its type. The heights the user drags pane borders to are kept in the state, and are the same next time.
const rsi = await chart.addIndicator('RSI');
await chart.addIndicator('KDJ', { pane: rsi }); // in the same pane as RSI
await chart.updateIndicator('vol-1', { pane: 'new' }); // volume in a pane of its ownUsers can move them in the interface too: with the pointer on the indicator's row in the legend, the "⋯" button at its end opens a menu whose "Move to" has "Main chart" (not there when it is already on the bars), "New pane" (not there when it already has a pane to itself), and each indicator in the other panes, written by its name in the legend as "Same pane as MACD 12 26 9". Moved into the pane of an indicator after it, its order on the chart moves after that indicator along with it, whatever the order was. The indicators that shared its pane stay there, with the pane's position and the height the user dragged unchanged: when it was first in its pane, the indicators left move before it in the chart's order, and the pane is then noted by the first indicator left (with its height in paneHeights moving over); one moved to a new pane always gets a new one at the bottom. The outcome of a move is kept in the state as when pane is changed with updateIndicator(), and pane heights are remembered as before. Volume profiles are drawn on the bars without a pane, and have no such menu.
chart and charts are Charts of the library, whose methods can be used directly (converting coordinates, screenshots, markers, …). Indicators and drawings must be changed through the methods above: an indicator added straight onto chart is unknown to the pro chart, and is taken away at the next sync.
Charts get rebuilt: switching the multi-chart layout, setState(), or a container narrow enough to show only the current chart replaces the Chart there with a new one. For the page's own markers or lines on each chart, listen to chartReady, emitted when each chart is made (the first too), with the chart's position in the layout, its new Chart, and the symbol and timeframe it shows:
chart.on('chartReady', ({ instance, symbol }) => {
instance.markers.set(myTrades(symbol)); // the page's own trade markers
});A chart keeps its Chart when it changes symbol or timeframe; update what you drew along with symbolChange and timeframeChange. When the symbol, the timeframe or the kind of bars changes, the chart stays at its time and zoom: while watching the latest bar, the new latest bar shows where the old one was (with the same space on the right); while looking back through history, the time at the right edge stays, and when the new data does not reach back far enough, history is loaded first and then the chart goes back to that time.
Drawing through methods
Drawings belong to charts: the drawings of each chart (each tab) are kept in the chart's state by the symbol the chart showed when they were drawn (ChartView.drawings), so a chart that changes symbol and changes back still has its drawings. The charts of a layout share drawings by default (with links.drawings on, "Same drawings on every chart" in the layout menu of the top bar): charts showing the same symbol share one set, kept in the state of the first chart of the layout, and drawing, changing, undoing and redoing are the same from any of them; charts showing other symbols use those symbols' own. With "Same drawings on every chart" off, each chart draws its own: turning it off gives each chart a copy of the drawings then, and turning it on merges the drawings of the charts into the first chart (one drawing per id). A newly opened chart copies the state of the chart it came from (with its drawings), and then each draws its own. Alerts are still kept by symbol, and the drawings they watch are looked up in the charts (copies of one drawing in several charts have the same id and count as one).
The target of addDrawing() and the other methods is { chart?, symbol? }, with chart the chart's position in the layout and symbol the symbol, the current chart and the symbol it shows without them:
- When the chart is showing the symbol, the change is made on the chart, as one the user made, and can be undone;
- otherwise it is checked by the chart's rules and kept in the chart, to appear when it shows the symbol.
Drawings have the format of the library's chart.drawings.add() (type, points, style, text, timeframes, …, see the library's docs on drawings), with an id made up when none is given. Coordinates are set exactly at the time and price given, without snapping.
const id = await chart.addDrawing({
type: 'horizontal-line',
points: [{ time: Date.UTC(2026, 0, 5), price: 1688 }],
style: { color: '#e5484d', lineStyle: 'dashed' },
text: 'Resistance'
});
await chart.updateDrawing(id, { style: { extendRight: true } });
await chart.addDrawing({ type: 'rectangle', points: [/* … */] }, { chart: 1, symbol: '000001.SZ' }); // the second chart, another symbolEvery change (drawn or changed by the user, or changed through methods) emits drawingsChange, with all the drawings of the chart on the symbol.