survey-analytics 2.2.6 → 2.3.0
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 +2 -1
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +7 -4
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +1 -1
- package/fesm/survey.analytics.mjs +80 -19
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.tabulator.mjs +1 -1
- package/package.json +2 -2
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +1 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/english.d.ts +1 -0
- package/survey-analytics.types/config.d.ts +1 -0
- package/survey-analytics.types/localizationManager.d.ts +1 -0
- package/survey-analytics.types/plotly/chart-adapter.d.ts +1 -0
- package/survey-analytics.types/plotly/setup.d.ts +1 -0
- package/survey-analytics.types/ranking.d.ts +4 -0
- package/survey-analytics.types/visualizationPanel.d.ts +4 -2
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +9 -6
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +1 -1
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +1 -1
- package/survey.analytics.js +103 -37
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +1 -1
- 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 +2 -1
- 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,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.3.0
|
|
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
|
*/
|
|
@@ -169,24 +169,6 @@ class PlotlySetup {
|
|
|
169
169
|
topMargin +
|
|
170
170
|
bottomMargin;
|
|
171
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
|
-
// });
|
|
190
172
|
if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
|
|
191
173
|
layout.xaxis.autorange = "reversed";
|
|
192
174
|
layout.yaxis.side = "right";
|
|
@@ -415,6 +397,75 @@ class PlotlySetup {
|
|
|
415
397
|
};
|
|
416
398
|
return { traces, layout, hasSeries: false };
|
|
417
399
|
}
|
|
400
|
+
static setupRadar(model, answersData) {
|
|
401
|
+
let { datasets, labels, colors, texts, seriesLabels, } = answersData;
|
|
402
|
+
const hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
403
|
+
const traces = [];
|
|
404
|
+
const traceConfig = {
|
|
405
|
+
type: "scatterpolar",
|
|
406
|
+
mode: "lines+markers",
|
|
407
|
+
fill: "toself",
|
|
408
|
+
line: {
|
|
409
|
+
width: 2
|
|
410
|
+
},
|
|
411
|
+
marker: {
|
|
412
|
+
size: 6
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
datasets.forEach((dataset, index) => {
|
|
416
|
+
const traceName = hasSeries ? seriesLabels[index] : "";
|
|
417
|
+
const trace = Object.assign({}, traceConfig, {
|
|
418
|
+
r: dataset,
|
|
419
|
+
theta: labels,
|
|
420
|
+
name: traceName,
|
|
421
|
+
text: texts[index],
|
|
422
|
+
hoverinfo: "r+theta+name",
|
|
423
|
+
customdata: labels,
|
|
424
|
+
hovertemplate: "%{theta}: %{r}" +
|
|
425
|
+
"<extra></extra>",
|
|
426
|
+
line: Object.assign(Object.assign({}, traceConfig.line), { color: colors[index % colors.length] }),
|
|
427
|
+
marker: Object.assign(Object.assign({}, traceConfig.marker), { color: colors[index % colors.length] })
|
|
428
|
+
});
|
|
429
|
+
traces.push(trace);
|
|
430
|
+
});
|
|
431
|
+
const layout = {
|
|
432
|
+
font: {
|
|
433
|
+
family: "Segoe UI, sans-serif",
|
|
434
|
+
size: 14,
|
|
435
|
+
weight: "normal",
|
|
436
|
+
color: "#404040",
|
|
437
|
+
},
|
|
438
|
+
polar: {
|
|
439
|
+
radialaxis: {
|
|
440
|
+
visible: true,
|
|
441
|
+
range: [0, Math.max(...datasets.map(s => Math.max(...s))) * 1.1],
|
|
442
|
+
tickfont: {
|
|
443
|
+
size: 12
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
angularaxis: {
|
|
447
|
+
tickfont: {
|
|
448
|
+
size: 12
|
|
449
|
+
},
|
|
450
|
+
ticktext: labels.map((label) => {
|
|
451
|
+
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength);
|
|
452
|
+
}),
|
|
453
|
+
tickvals: labels
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
showlegend: hasSeries,
|
|
457
|
+
colorway: colors,
|
|
458
|
+
plot_bgcolor: model.backgroundColor,
|
|
459
|
+
paper_bgcolor: model.backgroundColor,
|
|
460
|
+
margin: {
|
|
461
|
+
l: 50,
|
|
462
|
+
r: 50,
|
|
463
|
+
t: 50,
|
|
464
|
+
b: 50
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
return { traces, layout, hasSeries };
|
|
468
|
+
}
|
|
418
469
|
}
|
|
419
470
|
PlotlySetup.imageExportFormat = "png";
|
|
420
471
|
/**
|
|
@@ -436,6 +487,7 @@ PlotlySetup.setups = {
|
|
|
436
487
|
scatter: PlotlySetup.setupScatter,
|
|
437
488
|
gauge: PlotlySetup.setupGauge,
|
|
438
489
|
bullet: PlotlySetup.setupGauge,
|
|
490
|
+
radar: PlotlySetup.setupRadar,
|
|
439
491
|
};
|
|
440
492
|
PlotlySetup.getTruncatedLabel = (label, labelTruncateLength) => {
|
|
441
493
|
const truncateSymbols = "...";
|
|
@@ -527,6 +579,7 @@ const plotlyChartTypes = {
|
|
|
527
579
|
"matrix": MatrixPlotly.types,
|
|
528
580
|
"matrixDropdownGrouped": MatrixDropdownGroupedPlotly.types,
|
|
529
581
|
"pivot": PivotPlotly.types,
|
|
582
|
+
"ranking": [].concat(SelectBasePlotly.types).concat(["radar"]),
|
|
530
583
|
};
|
|
531
584
|
class PlotlyChartAdapter {
|
|
532
585
|
constructor(model) {
|
|
@@ -546,11 +599,19 @@ class PlotlyChartAdapter {
|
|
|
546
599
|
const chartType = this.model.chartType;
|
|
547
600
|
if (chartType === "pie" || chartType === "doughnut") {
|
|
548
601
|
traces.forEach((trace) => {
|
|
602
|
+
if (!trace)
|
|
603
|
+
return;
|
|
604
|
+
if (!trace.marker)
|
|
605
|
+
trace.marker = {};
|
|
549
606
|
trace.marker.colors = boolColors;
|
|
550
607
|
});
|
|
551
608
|
}
|
|
552
609
|
else if (chartType === "bar") {
|
|
553
610
|
traces.forEach((trace) => {
|
|
611
|
+
if (!trace)
|
|
612
|
+
return;
|
|
613
|
+
if (!trace.marker)
|
|
614
|
+
trace.marker = {};
|
|
554
615
|
trace.marker.color = boolColors;
|
|
555
616
|
});
|
|
556
617
|
}
|