survey-analytics icon indicating copy to clipboard operation
survey-analytics copied to clipboard

StatisticsTable not able to render rating & boolean question types

Open vitexikora opened this issue 1 year ago • 1 comments

StatisticsTable should be able to visualize both rating & boolean types, since they are also a closed selection of values and thus similar to dropdown. Currently it throws an exception ("this.valuesSource() is undefined"): obrazek obrazek

Ticket in support: T20124

vitexikora avatar Oct 03 '24 14:10 vitexikora

Hello, In the meantime, a visualizer is assigned to a question based on a question type. To support a StatisticsTable visualizer for Rating and Boolean question types it will be required to rewrite this logic and resolve a visualizer not by a question type but by the actual question data.

We will consider this feature in the future. In the meantime, please consider using a Radiogroup question to implement single-select questions. For the record: you can set the colCount to 0 to display radiogroup items in a row.

Should you have any further question, please let me know.

JaneSjs avatar Oct 10 '24 07:10 JaneSjs

Actually, I have the following code:

<script setup>
import 'survey-analytics/survey.analytics.css'

import { QuestionHtmlModel, Model } from 'survey-core'
import { VisualizationPanel } from 'survey-analytics'
import { onMounted } from 'vue'

const surveyJson = window.SurveySchema.content
const surveyResults = window.SurveyResponses.map(response => response.content)

const vizPanelOptions = {
  allowHideQuestions: false
}

onMounted(_ => {
  const survey = new Model(surveyJson)
  const vizPanel = new VisualizationPanel(
    survey.getAllQuestions(),
    surveyResults,
    vizPanelOptions
  )
  vizPanel.render('surveyVizPanel')
})
</script>

<template>
  <div id="surveyVizPanel" />
</template>

And I get the same error for radio group. If I filter out radio groups, everything is fine.

AdrienGiboire avatar Jun 02 '25 09:06 AdrienGiboire