Hello Team,
We use rating
questions to gather … well, ratings of staff. We can do this with the default rating
setup:
JSON{
"type": "rating",
"name": "question1",
"rateCount": 5,
"rateMax": 5
}
This works well with SurveyJS Analytics, as we can use the Gauge representation of average rating.
We also want to give option to not rate someone. We have achieved this by entering rate values manualy:
JSON{
"type": "rating",
"name": "question1",
"autoGenerate": false,
"rateCount": 6,
"rateValues": [1, 2, 3,
4,
5,
{
"value": "NA",
"text": "I do not want to rate this one"
}
],
"rateMax": 6
}
This gives us a nice visual representation in the survey, however we end up with a broken representation in SurveyJS Analytics.
I can imagine that the underlying average()
doesn't work well with NA
values being present among numbers, but can't figure out a solution.
Is there a better way to allow None
rating?
Hello Longenesis,
Would you please clarify the desired behavior? Do you wish to use the default Gauge visualizer for Rating answers and exclude NA answers from visualization?
Hi Jane,
Yes, we want to exclude
NA
values from visualization.Hello Longenesis,
A SurveyJS Dashboard accepts a configuration object with a collection of survey questions and question responses.
To exclude
NA
values from visualization, you can simply remove corresponding survey responses from an array of survey answers before passing it to a visualizer.values = values.filter(value => value.question1 != 'NA');
Example
Please let me know if this option works for you.
Thanks Jane. While the example works, it does not solve our problem.
First, we don't know the question ID beforehand, second - the provided solution removes the entire answer if one specific question is answered with
NA
.What would work - to process the list of answers to remove non-numeric answers to
rating
questions. However, I don't know how to do that since the list of answers does not include question types.Hello Longenesis,
Thank you for the update. I'll discuss possible options with the team. Please stay tuned.
Thanks
Hello,
Thank you for your patience. A Gauge chart excludes
undefined
values from visualization. So, you may wish to customize a user response and use theundefined
value instead of aNA
string.Please let me know if this option can help you.
Thanks Jane. How do I use
undefined
value in rating questions?I tried
{ "type": "rating", "name": "question1", "autoGenerate": false, "rateCount": 3, "rateValues": [ 1, 2, { "value": null, "text": "No rating" } ] }
and
{ "type": "rating", "name": "question1", "autoGenerate": false, "rateCount": 3, "rateValues": [ 1, 2, { "value": "", "text": "No rating" } ] }
In both cases SurveyCreator fixes the JSON to
{ "type": "rating", "name": "question1", "autoGenerate": false, "rateCount": 3, "rateValues": [ 1, 2, "No rating" ] }
Hello,
I am afraid will not be able to provide you with a solution right now for undefined value. SurveyJS treats undefined value as unset value for all questions. We have unit tests checking that value property of item value object is not undefined.
You can decide that value X you will treat as undefined and make it a defaultValue as well. It will work. End-user will not be able to unset this value in rating question and only set it back.
Thank you,
Andrew
SurveyJS Team