import type { DataItem } from "../../core/render/Component"; import type { Percent } from "../../core/util/Percent"; import type { HierarchyLink } from "./HierarchyLink"; import type * as d3Hierarchy from "d3-hierarchy"; import { LinkedHierarchy, ILinkedHierarchySettings, ILinkedHierarchyDataItem, ILinkedHierarchyPrivate, ILinkedHierarchyEvents } from "./LinkedHierarchy"; import * as d3Force from "d3-force"; /** * @ignore */ export interface IForceDirectedDataObject { name?: string; value?: number; children?: IForceDirectedDataObject[]; dataItem?: DataItem; } export interface IForceDirectedDataItem extends ILinkedHierarchyDataItem { /** * Data items of the child nodes. */ children: Array>; /** * Data item of the parent node. */ parent: DataItem; /** * @ignore */ d3ForceNode: d3Force.SimulationNodeDatum; /** * Fixed X position of the node, from `xField`. */ x: number | undefined; /** * Fixed Y position of the node, from `yField`. */ y: number | undefined; } export interface IForceDirectedSettings extends ILinkedHierarchySettings { /** * Room in pixels kept free around each node. It applies to both nodes of a * pair, so neighbouring nodes stay at least twice this far apart. * * @default 0 */ nodePadding?: number; /** * Pull of every node toward the center of the chart; a negative value * pushes nodes away from it. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default 0.8 */ centerStrength?: number; /** * Force between all nodes, scaled by each node's radius: a negative value * pushes them apart, a positive one pulls them together. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default -14 */ manyBodyStrength?: number; /** * A force that attracts (or pushes back) nodes that are linked together * via `linkWithField`. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default 0.5 */ linkWithStrength?: number | undefined; /** * Resistance acting against node speed. * * The greater the value, the more "sluggish" the nodes will be. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default 0.5 */ velocityDecay?: number; /** * Length of how long initial force simulation would run in frames. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default 500 */ initialFrames?: number; /** * If set to a number will wait X number of frames before revealing * the tree. * * Can be used to hide initial animations where nodes settle into their * places. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Layout_and_force_simulation} for more info * @default 10 */ showOnFrame?: number; /** * Radius of the circle of the node with the smallest value, in pixels or * percent of the series' average side ((width + height) / 2). * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Sizing_nodes} for more info * @default 1% */ minRadius?: number | Percent; /** * Radius of the circle of the node with the largest value, in pixels or * percent of the series' average side ((width + height) / 2). * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Sizing_nodes} for more info * @default 8% */ maxRadius?: number | Percent; /** * Field in data that holds a fixed X position for the node, in pixels or * percent of the series' width. Such a node doesn't move along X. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Fixed_nodes} for more info */ xField?: string; /** * Field in data that holds a fixed Y position for the node, in pixels or * percent of the series' height. Such a node doesn't move along Y. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/#Fixed_nodes} for more info */ yField?: string; } export interface IForceDirectedPrivate extends ILinkedHierarchyPrivate { } export interface IForceDirectedEvents extends ILinkedHierarchyEvents { } /** * A force-directed tree: node circles sized by value, which a force * simulation spreads out. Nodes can be dragged. * * @see {@link https://www.amcharts.com/docs/v5/charts/hierarchy/force-directed/} for more info * @important */ export declare class ForceDirected extends LinkedHierarchy { protected _tag: string; /** * @ignore */ readonly d3forceSimulation: d3Force.Simulation<{}, d3Force.SimulationLinkDatum>; /** * @ignore */ readonly collisionForce: d3Force.ForceCollide; /** * @ignore */ linkForce: d3Force.ForceLink>; static className: string; static classNames: Array; _settings: IForceDirectedSettings; _privateSettings: IForceDirectedPrivate; _dataItemSettings: IForceDirectedDataItem; _events: IForceDirectedEvents; protected _nodes: Array; protected _links: Array; protected _afterNew(): void; protected _tick: number; protected _nodesDirty: boolean; _prepareChildren(): void; /** * @ignore */ restartSimulation(alpha: number): void; _handleRadiusChange(): void; protected processDataItem(dataItem: DataItem): void; protected _updateValues(d3HierarchyNode: d3Hierarchy.HierarchyNode): void; protected _updateVisuals(): void; _updateChildren(): void; _updateForces(): void; protected _animatePositions(_dataItem: DataItem): void; _clearDirty(): void; /** * @ignore */ updateNodePositions(): void; /** * @ignore */ updateLinkWith(dataItems: Array>): void; /** * @ignore */ protected getDistance(linkDatum: any): number; /** * @ignore */ protected getStrength(linkDatum: any): number; protected _updateNode(dataItem: DataItem): void; protected _updateRadius(dataItem: DataItem): void; protected _processLink(link: HierarchyLink, source: DataItem, target: DataItem): void; protected _disposeLink(link: HierarchyLink): void; protected _handleUnlink(): void; protected _onDataClear(): void; } //# sourceMappingURL=ForceDirected.d.ts.map