Question T6390
Visible to All Users

Bar chart for ratings

created 4 years ago (modified 4 years ago)

Hi,

When generating the analytics for rating type questions is it possible to show the number of times each rating number has been selected rather than just showing the average rating based on all results?

Can this be done? or would I have to use a different question type like radio buttons?

Thanks

Greg

Answers approved by surveyjs Support

created 4 years ago

Hello,

It's a bug. We've fixed the issue via this commit. The fix will be available with the next minor update.

Thanks,
Dmitry
SurveyJS Team

    Comments (1)

      Hi Dmitry,

      That’s brilliant many thanks for the update!

      Thanks

      Greg

      created 4 years ago

      Hello,

      Similar question was discussed in this thread - https://surveyjs.answerdesk.io/ticket/details/t5424

      Thanks, Serge
      SurveyJS Team

        Comments (2)

          Exactly what I needed!

          Thanks Serge

            Hi Serge,

            I have implemented this as dicussed in the ticket you have linked. One side effect I have noticed is that for the rating questions that have the comment property enabled; the comments appear to be rendered twice in the visualizer (see attached image).

            Any idea how we could prevent this duplication

            Here is a copy of my JS

            JavaScript
            //Survey JS class RatingPlotly extends SurveyAnalytics.SelectBasePlotly { valuesSource() { return this.question.visibleRateValues; } } SurveyAnalytics.VisualizationManager.registerVisualizer("rating", RatingPlotly); SurveyAnalytics.localization.locales["en"]["visualizer_selectBase"] = "Plotly"; SurveyAnalytics.localization.locales["en"]["visualizer_number"] = "Average"; var survey = new Survey.Model(@Html.Raw(Model.CadetModule.Survey.SurveyJson)); var allQuestions = survey.getAllQuestions(); var summary = document.getElementById("summary"); summary.innerHTML = ""; var table = document.getElementById("table"); table.innerHTML = "" var data = @Html.Raw(Model.Results); console.log(data); var visPanel = new SurveyAnalytics.VisualizationPanel( allQuestions.filter(q => q.getType() !== "html"), data, ); //used to filter out html question types from table view var columns = allQuestions.filter(function(question) { return question.getType() !== "html"; }).map(function (question) { return { name: question.name, displayName: (question.title || "").trim() || question.name, dataType: question.getType() !== "file" ? 0 : 1, isVisible: true, isPublic: true, location: 0, // column }; }); var surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(survey, data, undefined, columns); visPanel.showHeader = true; surveyAnalyticsTabulator.render(table) $("#graphLoadingIndicator").hide(); visPanel.render(summary); $("#tableLoadingIndicator").hide();