Documentation / @ripl/charts / createForceDirectedChart
Function: createForceDirectedChart()
createForceDirectedChart<
TData>(target,options):ForceDirectedChart<TData>
Defined in: charts/src/charts/force-directed.ts:678
Factory function that creates a new ForceDirectedChart instance.
Type Parameters
| Type Parameter | Default type |
|---|---|
TData | unknown |
Parameters
| Parameter | Type |
|---|---|
target | string | Context<Element, Record<string, unknown>> | HTMLElement |
options | ForceDirectedChartOptions<TData> |
Returns
ForceDirectedChart<TData>
Example
ts
createForceDirectedChart(target, {
nodes: [
{ id: 'a', label: 'A' },
{ id: 'b', label: 'B' },
{ id: 'c', label: 'C' },
],
links: [
{ source: 'a', target: 'b' },
{ source: 'a', target: 'c' },
],
});