survey-analytics 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm/shared.mjs +10 -2
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +412 -31
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +158 -150
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.tabulator.mjs +1 -1
- package/package.json +8 -8
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +2 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +2 -0
- package/survey-analytics-tabulator.types/utils/index.d.ts +1 -1
- package/survey-analytics.types/alternativeVizualizersWrapper.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/english.d.ts +2 -0
- package/survey-analytics.types/entries/summary.core.d.ts +1 -0
- package/survey-analytics.types/localizationManager.d.ts +2 -0
- package/survey-analytics.types/matrix.d.ts +0 -1
- package/survey-analytics.types/pivot.d.ts +62 -0
- package/survey-analytics.types/plotly/histogram.d.ts +0 -1
- package/survey-analytics.types/plotly/index.d.ts +1 -0
- package/survey-analytics.types/plotly/pivot.d.ts +12 -0
- package/survey-analytics.types/plotly/selectBase.d.ts +0 -1
- package/survey-analytics.types/selectBase.d.ts +1 -1
- package/survey-analytics.types/utils/index.d.ts +1 -1
- package/survey-analytics.types/visualizationManager.d.ts +3 -0
- package/survey-analytics.types/visualizerBase.d.ts +2 -1
- package/survey.analytics.core.css +7 -1
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.js +487 -34
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +2 -2
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +7 -1
- package/survey.analytics.css.map +1 -1
- package/survey.analytics.js +682 -180
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +2 -2
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.min.js.LICENSE.txt +1 -1
- package/survey.analytics.tabulator.css +1 -1
- package/survey.analytics.tabulator.js +10 -2
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +1 -1
- package/survey.analytics.tabulator.min.js +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.2.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.2.3
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export { D as DocumentHelper, l as localization, s as surveyStrings } from './shared.mjs';
|
|
8
|
-
export { A as AlternativeVisualizersWrapper, B as BooleanModel, D as DataProvider, H as HistogramModel, M as Matrix, n as NpsAdapter, o as NpsVisualizer, m as NpsVisualizerWidget, N as NumberModel, P as PostponeHelper, S as SelectBase, l as StatisticsTable, k as StatisticsTableAdapter, j as Text, T as TextTableAdapter, b as VisualizationManager, g as VisualizationMatrixDropdown, f as VisualizationMatrixDynamic, c as VisualizationPanel, e as VisualizationPanelDynamic, a as VisualizerBase, V as VisualizerFactory, i as WordCloud, W as WordCloudAdapter, d as defaultStatisticsCalculator, h as hideEmptyAnswersInData, t as textHelper } from './shared2.mjs';
|
|
8
|
+
export { A as AlternativeVisualizersWrapper, B as BooleanModel, D as DataProvider, H as HistogramModel, M as Matrix, n as NpsAdapter, o as NpsVisualizer, m as NpsVisualizerWidget, N as NumberModel, p as PivotModel, P as PostponeHelper, S as SelectBase, l as StatisticsTable, k as StatisticsTableAdapter, j as Text, T as TextTableAdapter, b as VisualizationManager, g as VisualizationMatrixDropdown, f as VisualizationMatrixDynamic, c as VisualizationPanel, e as VisualizationPanelDynamic, a as VisualizerBase, V as VisualizerFactory, i as WordCloud, W as WordCloudAdapter, d as defaultStatisticsCalculator, h as hideEmptyAnswersInData, t as textHelper } from './shared2.mjs';
|
|
9
9
|
import 'survey-core';
|
|
10
10
|
//# sourceMappingURL=survey.analytics.core.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.2.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.2.3
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { Event, ItemValue } from 'survey-core';
|
|
8
8
|
import { l as localization, D as DocumentHelper, a as DataHelper } from './shared.mjs';
|
|
9
9
|
export { s as surveyStrings } from './shared.mjs';
|
|
10
|
-
import { b as VisualizationManager, S as SelectBase, _ as __awaiter, M as Matrix, B as BooleanModel, d as defaultStatisticsCalculator, H as HistogramModel, N as NumberModel } from './shared2.mjs';
|
|
10
|
+
import { b as VisualizationManager, S as SelectBase, _ as __awaiter, M as Matrix, B as BooleanModel, d as defaultStatisticsCalculator, H as HistogramModel, N as NumberModel, p as PivotModel } from './shared2.mjs';
|
|
11
11
|
export { A as AlternativeVisualizersWrapper, D as DataProvider, n as NpsAdapter, o as NpsVisualizer, m as NpsVisualizerWidget, P as PostponeHelper, l as StatisticsTable, k as StatisticsTableAdapter, j as Text, T as TextTableAdapter, g as VisualizationMatrixDropdown, f as VisualizationMatrixDynamic, c as VisualizationPanel, e as VisualizationPanelDynamic, a as VisualizerBase, V as VisualizerFactory, i as WordCloud, W as WordCloudAdapter, h as hideEmptyAnswersInData, t as textHelper } from './shared2.mjs';
|
|
12
12
|
import Plotly from 'plotly.js-dist-min';
|
|
13
13
|
|
|
@@ -17,38 +17,44 @@ class PlotlySetup {
|
|
|
17
17
|
}
|
|
18
18
|
static setupPie(model, answersData) {
|
|
19
19
|
let { datasets, labels, colors, texts, seriesLabels, } = answersData;
|
|
20
|
-
let traces = [];
|
|
21
20
|
const hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
21
|
+
const layoutColumns = 2;
|
|
22
|
+
let traces = [];
|
|
22
23
|
const traceConfig = {
|
|
23
24
|
type: model.chartType,
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
labels: labels,
|
|
26
|
+
customdata: labels,
|
|
27
|
+
text: labels.map((label) => {
|
|
26
28
|
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength);
|
|
27
29
|
}),
|
|
28
|
-
hoverinfo: "
|
|
29
|
-
|
|
30
|
-
marker: {},
|
|
30
|
+
hoverinfo: "label+value+percent",
|
|
31
|
+
textposition: "inside",
|
|
31
32
|
};
|
|
32
|
-
traceConfig.hoverinfo = "label+value+percent";
|
|
33
|
-
traceConfig.marker.colors = colors;
|
|
34
|
-
traceConfig.textposition = "inside";
|
|
35
33
|
if (model.chartType === "doughnut") {
|
|
36
34
|
traceConfig.type = "pie";
|
|
37
35
|
traceConfig.hole = 0.4;
|
|
38
36
|
}
|
|
39
37
|
if (!hasSeries) {
|
|
38
|
+
traceConfig.mode = "markers",
|
|
39
|
+
traceConfig.marker = { color: colors };
|
|
40
40
|
traceConfig.marker.symbol = "circle";
|
|
41
41
|
traceConfig.marker.size = 16;
|
|
42
42
|
}
|
|
43
43
|
datasets.forEach((dataset, index) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const isNotEmpty = dataset.some((value) => value != 0);
|
|
45
|
+
if (isNotEmpty) {
|
|
46
|
+
traces.push(Object.assign({}, traceConfig, {
|
|
47
|
+
values: dataset,
|
|
48
|
+
domain: {
|
|
49
|
+
column: traces.length % layoutColumns,
|
|
50
|
+
row: Math.floor(traces.length / layoutColumns),
|
|
51
|
+
},
|
|
52
|
+
title: { position: "bottom center", text: seriesLabels[index] }
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
49
55
|
});
|
|
50
56
|
const radius = labels.length < 10 ? labels.length * 50 + 100 : 550;
|
|
51
|
-
const height = radius * Math.
|
|
57
|
+
const height = (radius + 25) * Math.ceil(traces.length / layoutColumns);
|
|
52
58
|
const layout = {
|
|
53
59
|
font: {
|
|
54
60
|
family: "Segoe UI, sans-serif",
|
|
@@ -71,21 +77,7 @@ class PlotlySetup {
|
|
|
71
77
|
};
|
|
72
78
|
if (hasSeries) {
|
|
73
79
|
layout.annotations = [];
|
|
74
|
-
|
|
75
|
-
traces[index].title = { position: "bottom center", text: label };
|
|
76
|
-
});
|
|
77
|
-
traces = traces.filter(t => !(t.values.length === 1 && t.values[0] === 0));
|
|
78
|
-
traces.forEach((label, index) => {
|
|
79
|
-
traces[index].domain = {
|
|
80
|
-
column: index % 2,
|
|
81
|
-
row: Math.floor(index / 2),
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
layout.grid = {
|
|
85
|
-
rows: Math.round(traces.length / 2),
|
|
86
|
-
columns: 2,
|
|
87
|
-
};
|
|
88
|
-
layout.height = radius * Math.round(traces.length / 2) + 25;
|
|
80
|
+
layout.grid = { rows: Math.ceil(traces.length / layoutColumns), columns: layoutColumns };
|
|
89
81
|
}
|
|
90
82
|
return { traces, layout, hasSeries };
|
|
91
83
|
}
|
|
@@ -94,36 +86,45 @@ class PlotlySetup {
|
|
|
94
86
|
let topMargin = 30;
|
|
95
87
|
let bottomMargin = 30;
|
|
96
88
|
let { datasets, labels, colors, texts, seriesLabels, } = answersData;
|
|
97
|
-
const traces = [];
|
|
98
89
|
const hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
99
|
-
const
|
|
90
|
+
const traces = [];
|
|
100
91
|
const traceConfig = {
|
|
101
|
-
type: model.chartType,
|
|
102
|
-
y:
|
|
103
|
-
|
|
104
|
-
customdata: hasSeries ? seriesLabels : labels,
|
|
92
|
+
type: model.chartType === "line" ? "line" : "bar",
|
|
93
|
+
y: labels,
|
|
94
|
+
customdata: labels,
|
|
105
95
|
hoverinfo: "text",
|
|
106
96
|
orientation: "h",
|
|
107
|
-
mode: "markers",
|
|
108
97
|
textposition: "none",
|
|
109
|
-
width: 0.5,
|
|
110
|
-
bargap: 0.5,
|
|
111
|
-
marker: {},
|
|
112
98
|
};
|
|
113
|
-
|
|
99
|
+
if (!hasSeries) {
|
|
100
|
+
traceConfig.width = 0.5;
|
|
101
|
+
traceConfig.bargap = 0.5;
|
|
102
|
+
traceConfig.mode = "markers",
|
|
103
|
+
traceConfig.marker = { color: colors };
|
|
104
|
+
}
|
|
114
105
|
datasets.forEach((dataset, index) => {
|
|
115
|
-
|
|
106
|
+
const traceName = hasSeries ? seriesLabels[index] : labels[index];
|
|
107
|
+
const percentString = model.showPercentages ? "%" : "";
|
|
108
|
+
const trace = Object.assign({}, traceConfig, {
|
|
116
109
|
x: dataset,
|
|
110
|
+
name: traceName,
|
|
111
|
+
width: hasSeries && model.chartType !== "stackedbar" ? 0.5 / seriesLabels.length : 0.5,
|
|
117
112
|
text: texts[index],
|
|
118
|
-
hovertext:
|
|
119
|
-
|
|
113
|
+
hovertext: labels.map((label, labelIndex) => {
|
|
114
|
+
if (model.showOnlyPercentages) {
|
|
115
|
+
return `${texts[index][labelIndex]}${percentString}`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
return hasSeries ? `${traceName} : ${label}, ${texts[index][labelIndex]}${percentString}` : `${texts[index][labelIndex]}${percentString}, ${label}`;
|
|
119
|
+
}
|
|
120
120
|
}),
|
|
121
121
|
});
|
|
122
122
|
if (model.showPercentages) {
|
|
123
123
|
let texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
124
124
|
trace.textposition = "inside";
|
|
125
125
|
trace.texttemplate = texttemplate;
|
|
126
|
-
trace.
|
|
126
|
+
trace.width = hasSeries && model.chartType !== "stackedbar" ? 0.7 / seriesLabels.length : 0.9;
|
|
127
|
+
trace.bargap = hasSeries && model.chartType !== "stackedbar" ? 0.3 / seriesLabels.length : 0.1;
|
|
127
128
|
}
|
|
128
129
|
traces.push(trace);
|
|
129
130
|
});
|
|
@@ -143,60 +144,49 @@ class PlotlySetup {
|
|
|
143
144
|
},
|
|
144
145
|
colorway: colors,
|
|
145
146
|
hovermode: "closest",
|
|
147
|
+
plot_bgcolor: model.backgroundColor,
|
|
148
|
+
paper_bgcolor: model.backgroundColor,
|
|
149
|
+
showlegend: hasSeries,
|
|
150
|
+
barmode: hasSeries && model.chartType == "stackedbar" ? "stack" : "group",
|
|
151
|
+
xaxis: {
|
|
152
|
+
rangemode: "nonnegative",
|
|
153
|
+
automargin: true,
|
|
154
|
+
},
|
|
146
155
|
yaxis: {
|
|
147
156
|
automargin: true,
|
|
148
157
|
type: "category",
|
|
149
158
|
orientation: "h",
|
|
150
159
|
tickmode: "array",
|
|
151
|
-
tickvals:
|
|
152
|
-
ticktext:
|
|
160
|
+
tickvals: labels,
|
|
161
|
+
ticktext: labels.map((label) => {
|
|
153
162
|
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength) + " ";
|
|
154
163
|
}),
|
|
155
164
|
},
|
|
156
|
-
xaxis: {
|
|
157
|
-
rangemode: "nonnegative",
|
|
158
|
-
automargin: true,
|
|
159
|
-
// dtick: 1
|
|
160
|
-
},
|
|
161
|
-
plot_bgcolor: model.backgroundColor,
|
|
162
|
-
paper_bgcolor: model.backgroundColor,
|
|
163
|
-
showlegend: false,
|
|
164
165
|
};
|
|
165
|
-
if (hasSeries) {
|
|
166
|
-
layout.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
(seriesLabels.length + 1) * lineHeight +
|
|
171
|
-
topMargin +
|
|
172
|
-
bottomMargin;
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
layout.height =
|
|
176
|
-
(labels.length + 1) * lineHeight * seriesLabels.length +
|
|
177
|
-
topMargin +
|
|
178
|
-
bottomMargin;
|
|
179
|
-
}
|
|
180
|
-
labels.forEach((label, index) => {
|
|
181
|
-
traces[index].marker.color = undefined;
|
|
182
|
-
traces[index].name = label;
|
|
183
|
-
if (model.chartType === "stackedbar") {
|
|
184
|
-
traces[index].type = "bar";
|
|
185
|
-
traces[index].width = 0.5;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
traces[index].width =
|
|
189
|
-
(model.showPercentages ? 0.7 : 0.5) / traces.length;
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
traces.forEach((trace, traceIndex) => {
|
|
193
|
-
const percentString = model.showPercentages ? "%" : "";
|
|
194
|
-
traces[traceIndex].hovertext = [];
|
|
195
|
-
yFullTexts.forEach((yFullText, yFullTextIndex) => {
|
|
196
|
-
traces[traceIndex].hovertext.push(`${trace.y[yFullTextIndex]} : ${trace.name}, ${trace.text[yFullTextIndex]}${percentString}`);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
166
|
+
if (hasSeries && model.chartType !== "stackedbar") {
|
|
167
|
+
layout.height =
|
|
168
|
+
(labels.length * seriesLabels.length + 1) * lineHeight +
|
|
169
|
+
topMargin +
|
|
170
|
+
bottomMargin;
|
|
199
171
|
}
|
|
172
|
+
// labels.forEach((label, index) => {
|
|
173
|
+
// traces[index].marker.color = undefined;
|
|
174
|
+
// traces[index].name = label;
|
|
175
|
+
// if (model.chartType === "stackedbar") {
|
|
176
|
+
// traces[index].type = "bar";
|
|
177
|
+
// traces[index].width = 0.5;
|
|
178
|
+
// } else {
|
|
179
|
+
// traces[index].width =
|
|
180
|
+
// (model.showPercentages ? 0.7 : 0.5) / traces.length;
|
|
181
|
+
// }
|
|
182
|
+
// });
|
|
183
|
+
// traces.forEach((trace, traceIndex) => {
|
|
184
|
+
// const percentString = model.showPercentages ? "%" : "";
|
|
185
|
+
// traces[traceIndex].hovertext = [];
|
|
186
|
+
// yFullTexts.forEach((yFullText, yFullTextIndex) => {
|
|
187
|
+
// traces[traceIndex].hovertext.push(`${trace.y[yFullTextIndex]} : ${trace.name}, ${trace.text[yFullTextIndex]}${percentString}`);
|
|
188
|
+
// });
|
|
189
|
+
// });
|
|
200
190
|
if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
|
|
201
191
|
layout.xaxis.autorange = "reversed";
|
|
202
192
|
layout.yaxis.side = "right";
|
|
@@ -213,9 +203,11 @@ class PlotlySetup {
|
|
|
213
203
|
let topMargin = 30;
|
|
214
204
|
let bottomMargin = 30;
|
|
215
205
|
let { datasets, labels, colors, texts, seriesLabels, } = answersData;
|
|
216
|
-
|
|
206
|
+
const hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
207
|
+
if (model.type !== "histogram" && model.type !== "pivot") {
|
|
217
208
|
labels = [].concat(labels).reverse();
|
|
218
|
-
|
|
209
|
+
seriesLabels = [].concat(seriesLabels).reverse();
|
|
210
|
+
colors = [].concat(colors.slice(0, hasSeries ? seriesLabels.length : labels.length)).reverse();
|
|
219
211
|
const ts = [];
|
|
220
212
|
texts.forEach(text => {
|
|
221
213
|
ts.push([].concat(text).reverse());
|
|
@@ -228,7 +220,37 @@ class PlotlySetup {
|
|
|
228
220
|
datasets = ds;
|
|
229
221
|
}
|
|
230
222
|
const traces = [];
|
|
231
|
-
const
|
|
223
|
+
const traceConfig = {
|
|
224
|
+
type: model.chartType === "line" ? "line" : "bar",
|
|
225
|
+
x: labels,
|
|
226
|
+
customdata: hasSeries ? seriesLabels : labels,
|
|
227
|
+
hoverinfo: hasSeries ? undefined : "x+y",
|
|
228
|
+
orientation: "v",
|
|
229
|
+
textposition: "none",
|
|
230
|
+
};
|
|
231
|
+
if (model.type === "histogram" || !hasSeries) {
|
|
232
|
+
traceConfig.width = 0.5;
|
|
233
|
+
traceConfig.bargap = 0.5;
|
|
234
|
+
traceConfig.mode = "markers",
|
|
235
|
+
traceConfig.marker = { color: colors };
|
|
236
|
+
}
|
|
237
|
+
datasets.forEach((dataset, index) => {
|
|
238
|
+
var trace = Object.assign({}, traceConfig, {
|
|
239
|
+
y: dataset,
|
|
240
|
+
name: hasSeries ? seriesLabels[index] : labels[index],
|
|
241
|
+
text: texts[index],
|
|
242
|
+
});
|
|
243
|
+
if (model.showPercentages) {
|
|
244
|
+
let texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
245
|
+
trace.textposition = "inside";
|
|
246
|
+
trace.texttemplate = texttemplate;
|
|
247
|
+
if (!hasSeries) {
|
|
248
|
+
trace.width = 0.9;
|
|
249
|
+
trace.bargap = 0.1;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
traces.push(trace);
|
|
253
|
+
});
|
|
232
254
|
const layout = {
|
|
233
255
|
font: {
|
|
234
256
|
family: "Segoe UI, sans-serif",
|
|
@@ -245,34 +267,21 @@ class PlotlySetup {
|
|
|
245
267
|
hovermode: "closest",
|
|
246
268
|
plot_bgcolor: model.backgroundColor,
|
|
247
269
|
paper_bgcolor: model.backgroundColor,
|
|
248
|
-
showlegend:
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
270
|
+
showlegend: hasSeries,
|
|
271
|
+
yaxis: {
|
|
272
|
+
rangemode: "nonnegative",
|
|
273
|
+
automargin: true,
|
|
274
|
+
},
|
|
275
|
+
xaxis: {
|
|
276
|
+
automargin: true,
|
|
277
|
+
type: "category",
|
|
278
|
+
tickmode: "array",
|
|
279
|
+
tickvals: labels,
|
|
280
|
+
ticktext: labels.map((label) => {
|
|
281
|
+
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength) + " ";
|
|
282
|
+
}),
|
|
283
|
+
},
|
|
259
284
|
};
|
|
260
|
-
traceConfig.marker.color = colors;
|
|
261
|
-
datasets.forEach((dataset, index) => {
|
|
262
|
-
var trace = Object.assign({}, traceConfig, {
|
|
263
|
-
x: labels,
|
|
264
|
-
y: model.showPercentages ? texts[index].map(y => y / 100) : dataset,
|
|
265
|
-
text: texts[index],
|
|
266
|
-
});
|
|
267
|
-
if (model.showPercentages) {
|
|
268
|
-
let texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
269
|
-
trace.textposition = "inside";
|
|
270
|
-
trace.texttemplate = texttemplate;
|
|
271
|
-
trace.width = 0.9;
|
|
272
|
-
trace.bargap = 0.1;
|
|
273
|
-
}
|
|
274
|
-
traces.push(trace);
|
|
275
|
-
});
|
|
276
285
|
if (model.showPercentages && model.showOnlyPercentages) {
|
|
277
286
|
layout.yaxis = {
|
|
278
287
|
automargin: true,
|
|
@@ -532,20 +541,6 @@ class SelectBasePlotly extends SelectBase {
|
|
|
532
541
|
this._chartAdapter.update(chartNode);
|
|
533
542
|
}
|
|
534
543
|
}
|
|
535
|
-
getCalculatedValuesCore() {
|
|
536
|
-
const statistics = super.getCalculatedValuesCore();
|
|
537
|
-
const series = this.getSeriesValues();
|
|
538
|
-
const values = this.getValues();
|
|
539
|
-
if (series.length > 1) {
|
|
540
|
-
const preparedData = [];
|
|
541
|
-
values.forEach((val, valueIndex) => {
|
|
542
|
-
const seriesData = series.map((seriesValue, seriesIndex) => statistics[seriesIndex][valueIndex]);
|
|
543
|
-
preparedData.push(seriesData);
|
|
544
|
-
});
|
|
545
|
-
return preparedData;
|
|
546
|
-
}
|
|
547
|
-
return statistics;
|
|
548
|
-
}
|
|
549
544
|
}
|
|
550
545
|
SelectBasePlotly.types = ["bar", "vbar", "pie", "doughnut"];
|
|
551
546
|
SelectBasePlotly.displayModeBar = undefined;
|
|
@@ -754,20 +749,6 @@ class HistogramPlotly extends HistogramModel {
|
|
|
754
749
|
return container;
|
|
755
750
|
});
|
|
756
751
|
}
|
|
757
|
-
getCalculatedValuesCore() {
|
|
758
|
-
const statistics = super.getCalculatedValuesCore();
|
|
759
|
-
const series = this.getSeriesValues();
|
|
760
|
-
const values = this.getValues();
|
|
761
|
-
if (series.length > 1) {
|
|
762
|
-
const preparedData = [];
|
|
763
|
-
values.forEach((val, valueIndex) => {
|
|
764
|
-
const seriesData = series.map((seriesValue, seriesIndex) => statistics[seriesIndex][valueIndex]);
|
|
765
|
-
preparedData.push(seriesData);
|
|
766
|
-
});
|
|
767
|
-
return preparedData;
|
|
768
|
-
}
|
|
769
|
-
return statistics;
|
|
770
|
-
}
|
|
771
752
|
getValueType() {
|
|
772
753
|
return this.valueType;
|
|
773
754
|
}
|
|
@@ -900,5 +881,32 @@ VisualizationManager.registerVisualizer("number", GaugePlotly);
|
|
|
900
881
|
VisualizationManager.registerVisualizer("rating", GaugePlotly);
|
|
901
882
|
VisualizationManager.registerVisualizer("expression", GaugePlotly);
|
|
902
883
|
|
|
903
|
-
|
|
884
|
+
class PivotPlotly extends PivotModel {
|
|
885
|
+
constructor(questions, data, options, name) {
|
|
886
|
+
super(questions, data, options, name);
|
|
887
|
+
this.chartTypes = PivotPlotly.types;
|
|
888
|
+
this._chartType = this.chartTypes[0];
|
|
889
|
+
this._chartAdapter = new PlotlyChartAdapter(this);
|
|
890
|
+
}
|
|
891
|
+
destroyContent(container) {
|
|
892
|
+
this._chartAdapter.destroy(container.children[0]);
|
|
893
|
+
super.destroyContent(container);
|
|
894
|
+
}
|
|
895
|
+
renderContentAsync(container) {
|
|
896
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
897
|
+
const chartNode = DocumentHelper.createElement("div");
|
|
898
|
+
container.innerHTML = "";
|
|
899
|
+
container.appendChild(chartNode);
|
|
900
|
+
yield this._chartAdapter.create(chartNode);
|
|
901
|
+
return container;
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
getValueType() {
|
|
905
|
+
return this.valueType;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
PivotPlotly.types = ["vbar", "bar", "line", "stackedbar", "pie", "doughnut"]; // ["vbar", "bar"];
|
|
909
|
+
VisualizationManager.registerPivotVisualizer(PivotPlotly);
|
|
910
|
+
|
|
911
|
+
export { BooleanModel, BooleanPlotly, DocumentHelper, GaugePlotly, HistogramModel, HistogramPlotly, Matrix, MatrixDropdownGroupedPlotly, MatrixPlotly, NumberModel, PivotModel, PivotPlotly, PlotlyBoolChartAdapter, PlotlyChartAdapter, PlotlyGaugeAdapter, PlotlySetup, RankingPlotly, SelectBase, SelectBasePlotly, VisualizationManager, defaultStatisticsCalculator, localization };
|
|
904
912
|
//# sourceMappingURL=survey.analytics.mjs.map
|