Documentation / @ripl/charts / createTrendChart
Function: createTrendChart() ​
createTrendChart<
TData>(target,options):TrendChart<TData>
Defined in: charts/src/charts/trend.ts:451
Factory function that creates a new TrendChart instance.
Type Parameters ​
| Type Parameter | Default type |
|---|---|
TData | unknown |
Parameters ​
| Parameter | Type |
|---|---|
target | string | HTMLElement | Context<Element, Record<string, unknown>> |
options | TrendChartOptions<TData> |
Returns ​
TrendChart<TData>
Example ​
ts
createTrendChart(target, {
data: [
{ month: 'Jan', revenue: 120, profit: 40, target: 100 },
{ month: 'Feb', revenue: 150, profit: 55, target: 130 },
],
key: 'month',
series: [
{ id: 'revenue', type: 'area', label: 'Revenue', value: 'revenue' },
{ id: 'profit', type: 'bar', label: 'Profit', value: 'profit' },
{ id: 'target', type: 'line', label: 'Target', value: 'target' },
],
overview: true,
});