!!!###!!!title=Progress——VisActor/VGraph tutorial documents!!!###!!!!!!###!!!description=Custom nodes are one of the biggest pain points in developing graph visualization applications. vGraph summarizes common custom node components from business and abstracts them into configurable tool methods to help everyone solve some visual effects that are not easy to implement.As the name suggests, progress bars are often used to visually display the progress of ongoing events, completion rates, etc. vGraph encapsulates two styles of progress bars, a normal progress bar and a circular progress bar, and also adds the ability to update animations, achieving a visual experience comparable to a native UI. You can refer to the example of a [progress bar node](/vgraph/demo/nodes/progreessNode).```javascriptimport { ProgressUtils, Layer } from '@visactor/vgraph';// container is the label container, which is generally the Layer parameter passed in by the node's custom method `shape`const container = new Layer({...});// Generate the progress barconst progressLayer = ProgressUtils.init(container, progressOptions);// Update the progress bar, recommended to be executed in the node's custom method `updateShapes`ProgressUtils.update(progressLayer, updateOptions);```!!!###!!!

Progress Bar Tool

Custom nodes are one of the biggest pain points in developing graph visualization applications. vGraph summarizes common custom node components from business and abstracts them into configurable tool methods to help everyone solve some visual effects that are not easy to implement.

As the name suggests, progress bars are often used to visually display the progress of ongoing events, completion rates, etc. vGraph encapsulates two styles of progress bars, a normal progress bar and a circular progress bar, and also adds the ability to update animations, achieving a visual experience comparable to a native UI. You can refer to the example of a progress bar node.

import { ProgressUtils, Layer } from '@visactor/vgraph';

// container is the label container, which is generally the Layer parameter passed in by the node's custom method `shape`
const container = new Layer({...});

// Generate the progress bar
const progressLayer = ProgressUtils.init(container, progressOptions);

// Update the progress bar, recommended to be executed in the node's custom method `updateShapes`
ProgressUtils.update(progressLayer, updateOptions);

Progress Bar Initialization Configuration

FieldTypeDescription
xnumber[Required] The horizontal position of the progress bar. For a horizontal progress bar, it is the leftmost coordinate; for a circular progress bar, it is the horizontal coordinate of the center.
ynumber[Required] The vertical position of the progress bar. For a horizontal progress bar, it is the vertical coordinate of the center; for a circular progress bar, it is the vertical coordinate of the center.
percentnumber[Required] The progress data, which should be between 0 and 1.
widthnumber[Required] The length of the progress bar graphic.
lineWidthnumberThe width of the progress bar.
type'line' | 'circle'The type of the progress bar.
colorstringThe color of the progress bar.
trailColorstringThe color of the remaining progress bar.
lineCap'butt' | 'round' | 'square'The style of the line endpoints. The default is 'round'.
labelThe text configuration. By default, the text for a horizontal progress bar is on the right, while for a circular progress bar, it is in the center of the circle.
label.textstringThe displayed text.
label.fillStylestringThe color of the displayed text.
label.fontSizenumberThe font size of the displayed text.
label.fontWeightnumberThe font weight of the displayed text.
label.lineHeightnumberThe line height of the displayed text.
label.fontFamilynumberThe font family of the displayed text.
label.widthnumberThe maximum width of the displayed text.
label.textOverflow'ellipsis' | 'clip'The text overflow handling method. The default is 'ellipsis'.
label.triggerIdstringUsed with components like Tooltip.

Progress Bar Update Configuration

FieldTypeDescription
percentnumber[Required] The progress data, which should be between 0 and 1.
updateLabel(percent: number) => stringIf text is configured during initialization, this method can be used to update the text synchronously in the animation.
animateboolean | AnimateConfigsThe update animation configuration.
animate.durationnumberThe duration of the animation, in ms.
animate.easing'easelinear' | 'easeCubic' | 'easePoly' | 'easeQuad' | 'easeSin'The animation execution method.
animate.onFinish() => voidThe callback for when the animation is complete.