survey-analytics 2.3.5 → 2.3.6
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 +1 -1
- package/fesm/shared2.mjs +27 -23
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +1 -1
- package/fesm/survey.analytics.mjs +9 -2
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.tabulator.mjs +1 -1
- package/package.json +2 -2
- package/survey-analytics.types/selectBase.d.ts +1 -0
- package/survey-analytics.types/visualizationManager.d.ts +2 -2
- package/survey-analytics.types/visualizationPanel.d.ts +1 -1
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +28 -24
- 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 +36 -25
- 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 +1 -1
- package/survey.analytics.tabulator.min.css +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"pre-push-check": "npm run lint && npm run test",
|
|
19
19
|
"pwinst": "playwright install chromium"
|
|
20
20
|
},
|
|
21
|
-
"version": "2.3.
|
|
21
|
+
"version": "2.3.6",
|
|
22
22
|
"name": "survey-analytics",
|
|
23
23
|
"description": "SurveyJS analytics Library.",
|
|
24
24
|
"main": "survey.analytics.js",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@types/plotly.js-dist-min": "^2.3.0",
|
|
93
93
|
"@types/tabulator-tables": "^6.2.3",
|
|
94
|
-
"survey-core": "2.3.
|
|
94
|
+
"survey-core": "2.3.6"
|
|
95
95
|
},
|
|
96
96
|
"husky": {
|
|
97
97
|
"hooks": {
|
|
@@ -60,6 +60,7 @@ export declare class SelectBase extends VisualizerBase implements IVisualizerWit
|
|
|
60
60
|
*/
|
|
61
61
|
get showOnlyPercentages(): boolean;
|
|
62
62
|
set showOnlyPercentages(val: boolean);
|
|
63
|
+
protected getShowPercentagesDefault(): boolean;
|
|
63
64
|
/**
|
|
64
65
|
* Gets and sets whether chart should show values and percentages.
|
|
65
66
|
*/
|
|
@@ -41,9 +41,9 @@ export declare class VisualizationManager {
|
|
|
41
41
|
static unregisterVisualizerForAll(constructor: VisualizerConstructor): void;
|
|
42
42
|
/**
|
|
43
43
|
* Returns all visualizer constructors for a specified question type.
|
|
44
|
-
* @param
|
|
44
|
+
* @param visualizerType A question [type](https://surveyjs.io/form-library/documentation/api-reference/question#getType).
|
|
45
45
|
*/
|
|
46
|
-
static getVisualizersByType(
|
|
46
|
+
static getVisualizersByType(visualizerType: string, fallbackVisualizerType?: string): VisualizerConstructor[];
|
|
47
47
|
/**
|
|
48
48
|
* Returns a constructor for an alternative visualizer selector.
|
|
49
49
|
* @see registerAltVisualizerSelector
|
package/survey.analytics.core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.3.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.3.6
|
|
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
|
*/
|
|
@@ -11676,9 +11676,8 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11676
11676
|
_this.emptyAnswersBtn = undefined;
|
|
11677
11677
|
_this.transposeDataBtn = undefined;
|
|
11678
11678
|
_this.topNSelector = undefined;
|
|
11679
|
-
_this._showPercentages = false;
|
|
11680
11679
|
_this._showOnlyPercentages = false;
|
|
11681
|
-
_this._percentagePrecision =
|
|
11680
|
+
_this._percentagePrecision = 2;
|
|
11682
11681
|
_this._answersOrder = "default";
|
|
11683
11682
|
_this._hideEmptyAnswers = false;
|
|
11684
11683
|
_this._topN = -1;
|
|
@@ -11700,7 +11699,6 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11700
11699
|
};
|
|
11701
11700
|
}
|
|
11702
11701
|
_this._supportSelection = true;
|
|
11703
|
-
_this._showPercentages = _this.options.showPercentages === true;
|
|
11704
11702
|
_this._showOnlyPercentages = _this.options.showOnlyPercentages === true;
|
|
11705
11703
|
if (_this.options.percentagePrecision) {
|
|
11706
11704
|
_this._percentagePrecision = _this.options.percentagePrecision;
|
|
@@ -11958,12 +11956,23 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11958
11956
|
enumerable: false,
|
|
11959
11957
|
configurable: true
|
|
11960
11958
|
});
|
|
11959
|
+
SelectBase.prototype.getShowPercentagesDefault = function () {
|
|
11960
|
+
if (this.options.showPercentages === undefined) {
|
|
11961
|
+
return ["pie", "doughnut"].indexOf(this.chartType) !== -1;
|
|
11962
|
+
}
|
|
11963
|
+
return this.options.showPercentages === true;
|
|
11964
|
+
};
|
|
11961
11965
|
Object.defineProperty(SelectBase.prototype, "showPercentages", {
|
|
11962
11966
|
/**
|
|
11963
11967
|
* Gets and sets whether chart should show values and percentages.
|
|
11964
11968
|
*/
|
|
11965
11969
|
get: function () {
|
|
11966
|
-
|
|
11970
|
+
if (this._showPercentages !== undefined) {
|
|
11971
|
+
return this._showPercentages;
|
|
11972
|
+
}
|
|
11973
|
+
else {
|
|
11974
|
+
return this.getShowPercentagesDefault();
|
|
11975
|
+
}
|
|
11967
11976
|
},
|
|
11968
11977
|
set: function (val) {
|
|
11969
11978
|
this._showPercentages = val;
|
|
@@ -12125,12 +12134,10 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
12125
12134
|
var percentages = [];
|
|
12126
12135
|
var percentagePrecision = this._percentagePrecision;
|
|
12127
12136
|
if (data.length < 2) {
|
|
12128
|
-
data.
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
return sum && (value / 100);
|
|
12133
|
-
});
|
|
12137
|
+
var sum = data[0].reduce(function (sum, val) { return sum + val; }, 0);
|
|
12138
|
+
percentages[0] = data[0].map(function (val) {
|
|
12139
|
+
var value = percentagePrecision ? +(val / sum * 100).toFixed(percentagePrecision) : Math.round(val / sum * 100);
|
|
12140
|
+
return sum && value;
|
|
12134
12141
|
});
|
|
12135
12142
|
}
|
|
12136
12143
|
else {
|
|
@@ -12142,7 +12149,7 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
12142
12149
|
for (var j = 0; j < data.length; j++) {
|
|
12143
12150
|
if (!Array.isArray(percentages[j]))
|
|
12144
12151
|
percentages[j] = [];
|
|
12145
|
-
var value = percentagePrecision ? +(
|
|
12152
|
+
var value = percentagePrecision ? +(data[j][i] / sum * 100).toFixed(percentagePrecision) : Math.round(data[j][i] / sum * 100);
|
|
12146
12153
|
percentages[j][i] = sum && value;
|
|
12147
12154
|
}
|
|
12148
12155
|
}
|
|
@@ -12170,7 +12177,7 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
12170
12177
|
*/
|
|
12171
12178
|
SelectBase.prototype.getAnswersData = function () {
|
|
12172
12179
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
12173
|
-
var seriesLabels, datasets, labels, colors,
|
|
12180
|
+
var seriesLabels, datasets, labels, colors, temp, texts, zippedArray, dict, unzippedArray, answersData;
|
|
12174
12181
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
12175
12182
|
switch (_a.label) {
|
|
12176
12183
|
case 0:
|
|
@@ -12180,14 +12187,13 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
12180
12187
|
datasets = (_a.sent());
|
|
12181
12188
|
labels = this.getLabels();
|
|
12182
12189
|
colors = this.getColors();
|
|
12183
|
-
texts = this.showPercentages ? this.getPercentages(datasets) : datasets;
|
|
12184
12190
|
if (this.transposeData) {
|
|
12185
12191
|
datasets = this.transpose(datasets);
|
|
12186
|
-
texts = this.transpose(texts);
|
|
12187
12192
|
temp = seriesLabels;
|
|
12188
12193
|
seriesLabels = labels;
|
|
12189
12194
|
labels = temp;
|
|
12190
12195
|
}
|
|
12196
|
+
texts = this.showPercentages ? this.getPercentages(datasets) : datasets;
|
|
12191
12197
|
if (this.answersOrder == "asc" || this.answersOrder == "desc") {
|
|
12192
12198
|
zippedArray = this.showPercentages
|
|
12193
12199
|
? _utils_index__WEBPACK_IMPORTED_MODULE_4__.DataHelper.zipArrays(labels, colors, texts[0])
|
|
@@ -13347,10 +13353,13 @@ var VisualizationManager = /** @class */ (function () {
|
|
|
13347
13353
|
};
|
|
13348
13354
|
/**
|
|
13349
13355
|
* Returns all visualizer constructors for a specified question type.
|
|
13350
|
-
* @param
|
|
13356
|
+
* @param visualizerType A question [type](https://surveyjs.io/form-library/documentation/api-reference/question#getType).
|
|
13351
13357
|
*/
|
|
13352
|
-
VisualizationManager.getVisualizersByType = function (
|
|
13353
|
-
var vDescrs = VisualizationManager.vizualizers[
|
|
13358
|
+
VisualizationManager.getVisualizersByType = function (visualizerType, fallbackVisualizerType) {
|
|
13359
|
+
var vDescrs = VisualizationManager.vizualizers[visualizerType];
|
|
13360
|
+
if (!!fallbackVisualizerType && (!vDescrs || vDescrs.length == 0)) {
|
|
13361
|
+
vDescrs = VisualizationManager.vizualizers[fallbackVisualizerType];
|
|
13362
|
+
}
|
|
13354
13363
|
if (!vDescrs) {
|
|
13355
13364
|
if (VisualizationManager.defaultVisualizer.suppressVisualizerStubRendering) {
|
|
13356
13365
|
return [];
|
|
@@ -15390,12 +15399,7 @@ var VisualizerFactory = /** @class */ (function () {
|
|
|
15390
15399
|
var type = question.getType();
|
|
15391
15400
|
var creators = [];
|
|
15392
15401
|
if (type === "text" && question.inputType) {
|
|
15393
|
-
|
|
15394
|
-
creators = _visualizationManager__WEBPACK_IMPORTED_MODULE_0__.VisualizationManager.getVisualizersByType(type);
|
|
15395
|
-
if (creators === undefined || creators.length == 0) {
|
|
15396
|
-
type = "text";
|
|
15397
|
-
creators = _visualizationManager__WEBPACK_IMPORTED_MODULE_0__.VisualizationManager.getVisualizersByType(type);
|
|
15398
|
-
}
|
|
15402
|
+
creators = _visualizationManager__WEBPACK_IMPORTED_MODULE_0__.VisualizationManager.getVisualizersByType(question.inputType, type);
|
|
15399
15403
|
}
|
|
15400
15404
|
else {
|
|
15401
15405
|
creators = _visualizationManager__WEBPACK_IMPORTED_MODULE_0__.VisualizationManager.getVisualizersByType(type);
|