Visualize Survey Data from SurveyJS Demo Service
SurveyJS provides a demo service that allows you to create test surveys and forms, store their JSON schemas in our database, and collect test results. This example shows how you can use the Dashboard library to visualize survey data collected through the service.
SurveyJS Demo Service is meant as a demonstration of what you can build with SurveyJS products. SurveyJS assumes no responsibility for any consequence of misusing or violating any sensitive data communicated via the service. In real-world applications, we strongly recommend storing survey results and JSON schemas in your own database.
To configure SurveyJS Dashboard for work with SurveyJS Demo Service, follow the steps below:
Create an empty
SurveyModel
instance.Load your survey JSON schema from the SurveyJS storage.
Implement a function that loads a survey JSON schema with a specifiedsurveyId
and assigns it to theSurveyModel
instance (see theloadSurvey()
function in code).Fetch survey results from SurveyJS Demo Service.
SurveyJS Demo Service exposes multiple public and private API endpoints. To fetch survey results, make a request to thegetSurveyPublicResults
API. Append your survey ID to the endpoint URL (see thedataurl.js
file in code).Create and render a Visualization Panel.
Add a<div>
element with anid
attribute to your page. To instantiate a Visualization Panel, pass survey questions, survey results from step 3, and optional settings to theVisualizationPanel
constructor. Call therender(containerId)
method on the instance to render the Visualization Panel in thediv
element.