Documentation / @ripl/charts / createForceDirectedChart
Function: createForceDirectedChart() ​
createForceDirectedChart<
TData>(target,options):ForceDirectedChart<TData>
Defined in: charts/src/charts/force-directed.ts:714
Factory function that creates a new ForceDirectedChart instance.
Type Parameters ​
| Type Parameter | Default type |
|---|---|
TData | unknown |
Parameters ​
| Parameter | Type |
|---|---|
target | string | HTMLElement | Context<Element, Record<string, unknown>> |
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' },
],
});