-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dashboard.tsx
30 lines (24 loc) · 941 Bytes
/
Dashboard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use client'
import { useEffect, useState } from "react";
import { data, json } from "../../data/dashboard_data";
import { VisualizationPanel, VisualizationManager, WordCloud } from "survey-analytics";
import "survey-analytics/survey.analytics.css";
import { Model } from "survey-core";
// const WordCloud = require("wordcloud");
// (window as any)["WordCloud"] = WordCloud;
// VisualizationManager.unregisterVisualizerForAll(WordCloud);
export default function Dashboard() {
let [vizPanel, setVizPanel] = useState<VisualizationPanel>();
if (!vizPanel) {
const survey = new Model(json);
vizPanel = new VisualizationPanel(survey.getAllQuestions(), data);
setVizPanel(vizPanel);
}
useEffect(() => {
vizPanel?.render("surveyVizPanel");
return () => {
vizPanel?.clear();
}
}, [vizPanel]);
return <div id="surveyVizPanel" style={{"margin": "auto", "width": "100%", "maxWidth": "1400px"}}></div>;
}