- I know that i can hide q-type of html per filter function, but better would be to just display the html as default renderer or?
- the dropdown seems to be strange as it seem to have no translation and both values are the same, how can i hide it?
Hello Wolfgang,
The SurveyJS Dashboard visualizes survey responses. HTML questions are read-only questions - they don't receive any answers. Therefore, they should be basically excluded from visualization.
To exclude HTML questions from a dashboard, you can filter a list of questions which you pass to a visualization panel.
Consider this example:
JavaScriptlet questions = survey.getAllQuestions().filter((question) => question.getType() != "html");
const vizPanel = new VisualizationPanel(
questions,
surveyResults,
vizPanelOptions
);
Alternatively, register a custom visualizer and render HTML question's content within a dashboard. Please consider this example (View Demo):
JavaScriptfunction CustomHtmlVisualizer(question, data, options) {
var renderContent = function (contentContainer, visualizer) {
var qHtmlContainer = document.createElement("div");
qHtmlContainer.innerHTML = question.html;
contentContainer.appendChild(qHtmlContainer);
};
return new VisualizerBase(
question,
data,
{ renderContent: renderContent, dataProvider: options.dataProvider },
"htmlVisualizer"
);
}
VisualizationManager.registerVisualizer("html", CustomHtmlVisualizer);
I hope that either option works for you.
Regarding the second issue: to process it in the best manner, I created a separate ticket on your behalf.
Dropdown is not localized
Please refer to it for further correspondence.
Let me know if you have any questions regarding HTML visualization.
Thanks