charton API / @chart-on/core / index / createSeasonality
Function: createSeasonality()
createSeasonality(
chart,options?):Seasonality
Defined in: packages/core/src/seasonality/view.ts:122
Overlay each year's path through the same calendar window on chart: one line per year, mapped onto the position in the window, and optionally the average path with the range of the years. The time axis shows the window's calendar (or trading-day numbers with align: 'trading'), and the crosshair and legend show each year's value at that position.
The view owns the chart's time axis, so give it a chart of its own: one without a loaded symbol or main series data. Daily bars come from symbol through the chart's data source (or source), paging back far enough for the years asked for, or from bars.
Parameters
chart
options?
SeasonalityOptions = {}
Returns
Example
const chart = createChart(el, { plugins: [dataSource()] });
chart.setDataSource(source);
const view = createSeasonality(chart, { symbol: 'ABC', years: 5, normalize: 'percent', average: 'mean' });
await view.ready;