Percentage Progress Bar
To help respondents keep track of answered and unanswered questions, your survey can display a progress bar that indicates a percentage of survey completion. Follow the instructions below to implement the percentage progress bar in your application:
Create a custom component that renders the progress bar.
You can implement the progress bar based on a simple<div>
element. Fill this<div>
with color depending onSurveyModel
'sprogressValue
property value.Display a percentage value and a title.
A percentage value is already stored in theprogressValue
property. To store the title, you need to create a custom property—progressTitle
. CallSerializer
'saddProperty
method to add the property to the survey. Then, specify the property value in the survey JSON schema.Register the custom component so that it can be accessed by name.
In HTML/CSS/JavaScript projects, register the component inReactElementFactory
as shown in theindex.js
file.
In React, register the component inReactElementFactory
as shown in theSurveyComponent.jsx
file.
In Angular, register the component inAngularComponentFactory
as shown in theprogressbar-percentage.component.ts
file.
In Vue and Knockout, use techniques native to these libraries:Add the progress bar to the survey layout.
Call theaddLayoutElement
method. It accepts an object whose properties specify the element'sid
, acontainer
that determines the element's location, acomponent
that renders the element, anddata
to pass as component props. Refer to the method description for more information on these properties.