survey-analytics 2.2.2 → 2.2.4
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 +748 -262
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +315 -538
- 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/boolean.d.ts +0 -1
- package/survey-analytics.types/entries/summary.core.d.ts +3 -1
- package/survey-analytics.types/histogram.d.ts +1 -1
- 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 +64 -0
- package/survey-analytics.types/plotly/chart-adapter.d.ts +13 -0
- package/survey-analytics.types/plotly/index.d.ts +2 -7
- package/survey-analytics.types/plotly/legacy.d.ts +33 -0
- package/survey-analytics.types/plotly/setup.d.ts +5 -3
- package/survey-analytics.types/{plotly/ranking.d.ts → ranking.d.ts} +2 -2
- package/survey-analytics.types/selectBase.d.ts +3 -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 +13 -1
- package/survey.analytics.core.css +7 -1
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.js +659 -51
- 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 +1048 -817
- 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
- package/survey-analytics.types/plotly/boolean.d.ts +0 -16
- package/survey-analytics.types/plotly/histogram.d.ts +0 -13
- package/survey-analytics.types/plotly/matrix.d.ts +0 -11
- package/survey-analytics.types/plotly/matrixdropdown-grouped.d.ts +0 -11
- package/survey-analytics.types/plotly/rating.d.ts +0 -20
- package/survey-analytics.types/plotly/selectBase.d.ts +0 -26
package/survey.analytics.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.2.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.2.4
|
|
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
|
*/
|
|
@@ -7007,6 +7007,12 @@ var AlternativeVisualizersWrapper = /** @class */ (function (_super) {
|
|
|
7007
7007
|
this.visualizer.setState(state.state);
|
|
7008
7008
|
}
|
|
7009
7009
|
};
|
|
7010
|
+
AlternativeVisualizersWrapper.prototype.getValues = function () {
|
|
7011
|
+
return this.visualizer.getValues();
|
|
7012
|
+
};
|
|
7013
|
+
AlternativeVisualizersWrapper.prototype.getLabels = function () {
|
|
7014
|
+
return this.visualizer.getLabels();
|
|
7015
|
+
};
|
|
7010
7016
|
AlternativeVisualizersWrapper.prototype.getCalculatedValues = function () {
|
|
7011
7017
|
return this.visualizer.getCalculatedValues();
|
|
7012
7018
|
};
|
|
@@ -7314,6 +7320,8 @@ var englishStrings = {
|
|
|
7314
7320
|
npsPromoters: "Promoters",
|
|
7315
7321
|
npsPassives: "Passives",
|
|
7316
7322
|
npsDetractors: "Detractors",
|
|
7323
|
+
axisXSelectorTitle: "X axis:",
|
|
7324
|
+
axisYSelectorTitle: "Y axis:"
|
|
7317
7325
|
};
|
|
7318
7326
|
// Uncomment the lines below if you create a custom dictionary.
|
|
7319
7327
|
// Replace "en" with a custom locale code (for example, "fr" or "de"),
|
|
@@ -8435,6 +8443,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8435
8443
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
8436
8444
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
8437
8445
|
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
8446
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
8447
|
+
|
|
8438
8448
|
|
|
8439
8449
|
|
|
8440
8450
|
|
|
@@ -8498,6 +8508,7 @@ var BooleanModel = /** @class */ (function (_super) {
|
|
|
8498
8508
|
return BooleanModel;
|
|
8499
8509
|
}(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
|
|
8500
8510
|
|
|
8511
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("boolean", BooleanModel);
|
|
8501
8512
|
|
|
8502
8513
|
|
|
8503
8514
|
/***/ }),
|
|
@@ -8659,17 +8670,19 @@ function questionContainsValue(questionValue, filterValue) {
|
|
|
8659
8670
|
__webpack_require__.r(__webpack_exports__);
|
|
8660
8671
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8661
8672
|
/* harmony export */ AlternativeVisualizersWrapper: () => (/* reexport safe */ _alternativeVizualizersWrapper__WEBPACK_IMPORTED_MODULE_27__.AlternativeVisualizersWrapper),
|
|
8662
|
-
/* harmony export */ BooleanModel: () => (/* reexport safe */
|
|
8673
|
+
/* harmony export */ BooleanModel: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_18__.BooleanModel),
|
|
8663
8674
|
/* harmony export */ DataProvider: () => (/* reexport safe */ _dataProvider__WEBPACK_IMPORTED_MODULE_14__.DataProvider),
|
|
8664
|
-
/* harmony export */ DocumentHelper: () => (/* reexport safe */
|
|
8665
|
-
/* harmony export */ HistogramModel: () => (/* reexport safe */
|
|
8666
|
-
/* harmony export */ Matrix: () => (/* reexport safe */
|
|
8675
|
+
/* harmony export */ DocumentHelper: () => (/* reexport safe */ _utils_index__WEBPACK_IMPORTED_MODULE_35__.DocumentHelper),
|
|
8676
|
+
/* harmony export */ HistogramModel: () => (/* reexport safe */ _histogram__WEBPACK_IMPORTED_MODULE_19__.HistogramModel),
|
|
8677
|
+
/* harmony export */ Matrix: () => (/* reexport safe */ _matrix__WEBPACK_IMPORTED_MODULE_17__.Matrix),
|
|
8667
8678
|
/* harmony export */ NpsAdapter: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsAdapter),
|
|
8668
8679
|
/* harmony export */ NpsVisualizer: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsVisualizer),
|
|
8669
8680
|
/* harmony export */ NpsVisualizerWidget: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsVisualizerWidget),
|
|
8670
|
-
/* harmony export */ NumberModel: () => (/* reexport safe */
|
|
8681
|
+
/* harmony export */ NumberModel: () => (/* reexport safe */ _number__WEBPACK_IMPORTED_MODULE_20__.NumberModel),
|
|
8682
|
+
/* harmony export */ PivotModel: () => (/* reexport safe */ _pivot__WEBPACK_IMPORTED_MODULE_34__.PivotModel),
|
|
8671
8683
|
/* harmony export */ PostponeHelper: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_21__.PostponeHelper),
|
|
8672
|
-
/* harmony export */
|
|
8684
|
+
/* harmony export */ RankingModel: () => (/* reexport safe */ _ranking__WEBPACK_IMPORTED_MODULE_33__.RankingModel),
|
|
8685
|
+
/* harmony export */ SelectBase: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.SelectBase),
|
|
8673
8686
|
/* harmony export */ StatisticsTable: () => (/* reexport safe */ _statistics_table__WEBPACK_IMPORTED_MODULE_31__.StatisticsTable),
|
|
8674
8687
|
/* harmony export */ StatisticsTableAdapter: () => (/* reexport safe */ _statistics_table__WEBPACK_IMPORTED_MODULE_31__.StatisticsTableAdapter),
|
|
8675
8688
|
/* harmony export */ Text: () => (/* reexport safe */ _text__WEBPACK_IMPORTED_MODULE_30__.Text),
|
|
@@ -8684,7 +8697,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8684
8697
|
/* harmony export */ WordCloud: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloud),
|
|
8685
8698
|
/* harmony export */ WordCloudAdapter: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloudAdapter),
|
|
8686
8699
|
/* harmony export */ defaultStatisticsCalculator: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_21__.defaultStatisticsCalculator),
|
|
8687
|
-
/* harmony export */ hideEmptyAnswersInData: () => (/* reexport safe */
|
|
8700
|
+
/* harmony export */ hideEmptyAnswersInData: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.hideEmptyAnswersInData),
|
|
8688
8701
|
/* harmony export */ localization: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.localization),
|
|
8689
8702
|
/* harmony export */ surveyStrings: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.surveyStrings),
|
|
8690
8703
|
/* harmony export */ textHelper: () => (/* reexport safe */ _wordcloud_stopwords_index__WEBPACK_IMPORTED_MODULE_29__.textHelper)
|
|
@@ -8705,11 +8718,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8705
8718
|
/* harmony import */ var _analytics_localization_finnish__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../analytics-localization/finnish */ "./src/analytics-localization/finnish.ts");
|
|
8706
8719
|
/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../dataProvider */ "./src/dataProvider.ts");
|
|
8707
8720
|
/* harmony import */ var _visualizerFactory__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../visualizerFactory */ "./src/visualizerFactory.ts");
|
|
8708
|
-
/* harmony import */ var
|
|
8709
|
-
/* harmony import */ var
|
|
8710
|
-
/* harmony import */ var
|
|
8711
|
-
/* harmony import */ var
|
|
8712
|
-
/* harmony import */ var
|
|
8721
|
+
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../selectBase */ "./src/selectBase.ts");
|
|
8722
|
+
/* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../matrix */ "./src/matrix.ts");
|
|
8723
|
+
/* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../boolean */ "./src/boolean.ts");
|
|
8724
|
+
/* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../histogram */ "./src/histogram.ts");
|
|
8725
|
+
/* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../number */ "./src/number.ts");
|
|
8713
8726
|
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../visualizerBase */ "./src/visualizerBase.ts");
|
|
8714
8727
|
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
8715
8728
|
/* harmony import */ var _visualizationPanel__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../visualizationPanel */ "./src/visualizationPanel.ts");
|
|
@@ -8722,7 +8735,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8722
8735
|
/* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../text */ "./src/text.ts");
|
|
8723
8736
|
/* harmony import */ var _statistics_table__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../statistics-table */ "./src/statistics-table.ts");
|
|
8724
8737
|
/* harmony import */ var _nps__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../nps */ "./src/nps.ts");
|
|
8725
|
-
/* harmony import */ var
|
|
8738
|
+
/* harmony import */ var _ranking__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../ranking */ "./src/ranking.ts");
|
|
8739
|
+
/* harmony import */ var _pivot__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../pivot */ "./src/pivot.ts");
|
|
8740
|
+
/* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../utils/index */ "./src/utils/index.ts");
|
|
8726
8741
|
|
|
8727
8742
|
//localization
|
|
8728
8743
|
|
|
@@ -8757,6 +8772,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8757
8772
|
|
|
8758
8773
|
|
|
8759
8774
|
|
|
8775
|
+
|
|
8776
|
+
|
|
8760
8777
|
|
|
8761
8778
|
|
|
8762
8779
|
|
|
@@ -8829,6 +8846,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8829
8846
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
8830
8847
|
/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataProvider */ "./src/dataProvider.ts");
|
|
8831
8848
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
8849
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
8850
|
+
|
|
8832
8851
|
|
|
8833
8852
|
|
|
8834
8853
|
|
|
@@ -8842,6 +8861,7 @@ var HistogramModel = /** @class */ (function (_super) {
|
|
|
8842
8861
|
_this._continiousData = undefined;
|
|
8843
8862
|
_this._cachedIntervals = undefined;
|
|
8844
8863
|
_this._intervalPrecision = 2;
|
|
8864
|
+
_this._transposeData = false;
|
|
8845
8865
|
if (_this.options.intervalPrecision !== undefined) {
|
|
8846
8866
|
_this._intervalPrecision = _this.options.intervalPrecision;
|
|
8847
8867
|
}
|
|
@@ -9019,11 +9039,17 @@ var HistogramModel = /** @class */ (function (_super) {
|
|
|
9019
9039
|
}
|
|
9020
9040
|
return statistics;
|
|
9021
9041
|
};
|
|
9042
|
+
HistogramModel.prototype.getValueType = function () {
|
|
9043
|
+
return this.valueType;
|
|
9044
|
+
};
|
|
9022
9045
|
HistogramModel.IntervalsCount = 10;
|
|
9023
9046
|
HistogramModel.UseIntervalsFrom = 10;
|
|
9024
9047
|
return HistogramModel;
|
|
9025
9048
|
}(_selectBase__WEBPACK_IMPORTED_MODULE_3__.SelectBase));
|
|
9026
9049
|
|
|
9050
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("date", HistogramModel);
|
|
9051
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("number", HistogramModel, 100);
|
|
9052
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("rating", HistogramModel, 100);
|
|
9027
9053
|
|
|
9028
9054
|
|
|
9029
9055
|
/***/ }),
|
|
@@ -9383,13 +9409,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9383
9409
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
9384
9410
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
9385
9411
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
9412
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
9413
|
+
|
|
9386
9414
|
|
|
9387
9415
|
|
|
9388
9416
|
|
|
9389
9417
|
var Matrix = /** @class */ (function (_super) {
|
|
9390
9418
|
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(Matrix, _super);
|
|
9391
9419
|
function Matrix(question, data, options, name) {
|
|
9392
|
-
|
|
9420
|
+
var _this = _super.call(this, question, data, options, name || "matrix") || this;
|
|
9421
|
+
_this._transposeData = true;
|
|
9422
|
+
return _this;
|
|
9393
9423
|
// this.getAnswersData();
|
|
9394
9424
|
}
|
|
9395
9425
|
Object.defineProperty(Matrix.prototype, "matrixQuestion", {
|
|
@@ -9472,20 +9502,10 @@ var Matrix = /** @class */ (function (_super) {
|
|
|
9472
9502
|
}
|
|
9473
9503
|
return result;
|
|
9474
9504
|
};
|
|
9475
|
-
Matrix.prototype.getCalculatedValuesCore = function () {
|
|
9476
|
-
var statistics = _super.prototype.getCalculatedValuesCore.call(this);
|
|
9477
|
-
var series = this.getSeriesValues();
|
|
9478
|
-
var values = this.getValues();
|
|
9479
|
-
var preparedData = [];
|
|
9480
|
-
values.forEach(function (val, valueIndex) {
|
|
9481
|
-
var seriesData = series.map(function (seriesName, seriesIndex) { return statistics[seriesIndex][valueIndex]; });
|
|
9482
|
-
preparedData.push(seriesData);
|
|
9483
|
-
});
|
|
9484
|
-
return preparedData;
|
|
9485
|
-
};
|
|
9486
9505
|
return Matrix;
|
|
9487
9506
|
}(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
|
|
9488
9507
|
|
|
9508
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("matrix", Matrix);
|
|
9489
9509
|
|
|
9490
9510
|
|
|
9491
9511
|
/***/ }),
|
|
@@ -9504,6 +9524,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9504
9524
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
9505
9525
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
9506
9526
|
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
|
|
9527
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
9528
|
+
|
|
9507
9529
|
|
|
9508
9530
|
|
|
9509
9531
|
|
|
@@ -9511,7 +9533,6 @@ var MatrixDropdownGrouped = /** @class */ (function (_super) {
|
|
|
9511
9533
|
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixDropdownGrouped, _super);
|
|
9512
9534
|
function MatrixDropdownGrouped(question, data, options, name) {
|
|
9513
9535
|
return _super.call(this, question, data, options, name || "matrixDropdownGrouped") || this;
|
|
9514
|
-
// this.getAnswersData();
|
|
9515
9536
|
}
|
|
9516
9537
|
Object.defineProperty(MatrixDropdownGrouped.prototype, "matrixQuestion", {
|
|
9517
9538
|
get: function () {
|
|
@@ -9556,16 +9577,12 @@ var MatrixDropdownGrouped = /** @class */ (function (_super) {
|
|
|
9556
9577
|
getSeriesValues: function () { return rows; },
|
|
9557
9578
|
getSeriesLabels: function () { return rows; },
|
|
9558
9579
|
});
|
|
9559
|
-
|
|
9560
|
-
values.forEach(function (val, valueIndex) {
|
|
9561
|
-
var seriesData = series.map(function (seriesName, seriesIndex) { return statistics[seriesIndex][0][valueIndex]; });
|
|
9562
|
-
preparedData.push(seriesData);
|
|
9563
|
-
});
|
|
9564
|
-
return preparedData;
|
|
9580
|
+
return statistics.map(function (s) { return s[0]; });
|
|
9565
9581
|
};
|
|
9566
9582
|
return MatrixDropdownGrouped;
|
|
9567
9583
|
}(_selectBase__WEBPACK_IMPORTED_MODULE_1__.SelectBase));
|
|
9568
9584
|
|
|
9585
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("matrixdropdown-grouped", MatrixDropdownGrouped);
|
|
9569
9586
|
|
|
9570
9587
|
|
|
9571
9588
|
/***/ }),
|
|
@@ -9795,6 +9812,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9795
9812
|
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
|
|
9796
9813
|
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
9797
9814
|
/* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/index */ "./src/utils/index.ts");
|
|
9815
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
9816
|
+
|
|
9798
9817
|
|
|
9799
9818
|
|
|
9800
9819
|
|
|
@@ -9804,6 +9823,11 @@ var NumberModel = /** @class */ (function (_super) {
|
|
|
9804
9823
|
function NumberModel(question, data, options, name) {
|
|
9805
9824
|
if (options === void 0) { options = {}; }
|
|
9806
9825
|
var _this = _super.call(this, question, data, options, name || "number") || this;
|
|
9826
|
+
if (_visualizerBase__WEBPACK_IMPORTED_MODULE_1__.VisualizerBase.chartAdapterType) {
|
|
9827
|
+
_this._chartAdapter = new _visualizerBase__WEBPACK_IMPORTED_MODULE_1__.VisualizerBase.chartAdapterType(_this);
|
|
9828
|
+
_this.chartTypes = _this._chartAdapter.getChartTypes();
|
|
9829
|
+
_this.chartType = _this.chartTypes[0];
|
|
9830
|
+
}
|
|
9807
9831
|
_this.registerToolbarItem("changeChartType", function () {
|
|
9808
9832
|
if (_this.chartTypes.length > 1) {
|
|
9809
9833
|
return _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
|
|
@@ -9921,601 +9945,455 @@ var NumberModel = /** @class */ (function (_super) {
|
|
|
9921
9945
|
return NumberModel;
|
|
9922
9946
|
}(_visualizerBase__WEBPACK_IMPORTED_MODULE_1__.VisualizerBase));
|
|
9923
9947
|
|
|
9948
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("number", NumberModel, 200);
|
|
9949
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("rating", NumberModel, 200);
|
|
9950
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("expression", NumberModel);
|
|
9924
9951
|
|
|
9925
9952
|
|
|
9926
9953
|
/***/ }),
|
|
9927
9954
|
|
|
9928
|
-
/***/ "./src/
|
|
9929
|
-
|
|
9930
|
-
!*** ./src/
|
|
9931
|
-
|
|
9955
|
+
/***/ "./src/pivot.ts":
|
|
9956
|
+
/*!**********************!*\
|
|
9957
|
+
!*** ./src/pivot.ts ***!
|
|
9958
|
+
\**********************/
|
|
9932
9959
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9933
9960
|
|
|
9934
9961
|
"use strict";
|
|
9935
9962
|
__webpack_require__.r(__webpack_exports__);
|
|
9936
9963
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9937
|
-
/* harmony export */
|
|
9938
|
-
/* harmony export */ PlotlyBoolChartAdapter: () => (/* binding */ PlotlyBoolChartAdapter)
|
|
9964
|
+
/* harmony export */ PivotModel: () => (/* binding */ PivotModel)
|
|
9939
9965
|
/* harmony export */ });
|
|
9940
9966
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
9941
|
-
/* harmony import */ var
|
|
9942
|
-
/* harmony import */ var
|
|
9943
|
-
/* harmony import */ var
|
|
9944
|
-
/* harmony import */ var
|
|
9967
|
+
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
9968
|
+
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
9969
|
+
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
9970
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils/index.ts");
|
|
9971
|
+
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
|
|
9972
|
+
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
9973
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
9974
|
+
|
|
9975
|
+
|
|
9945
9976
|
|
|
9946
9977
|
|
|
9947
9978
|
|
|
9948
9979
|
|
|
9949
9980
|
|
|
9950
|
-
var
|
|
9951
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(
|
|
9952
|
-
function
|
|
9953
|
-
|
|
9981
|
+
var PivotModel = /** @class */ (function (_super) {
|
|
9982
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PivotModel, _super);
|
|
9983
|
+
function PivotModel(questions, data, options, name) {
|
|
9984
|
+
var _this = _super.call(this, null, data, options, name || "pivot") || this;
|
|
9985
|
+
_this.questions = questions;
|
|
9986
|
+
_this.valueType = "enum";
|
|
9987
|
+
_this._cachedValues = undefined;
|
|
9988
|
+
_this._continiousData = undefined;
|
|
9989
|
+
_this._cachedIntervals = undefined;
|
|
9990
|
+
_this._intervalPrecision = 2;
|
|
9991
|
+
_this.axisYSelectors = [];
|
|
9992
|
+
_this.axisYQuestionNames = [];
|
|
9993
|
+
_this.questionsY = [];
|
|
9994
|
+
_this.questions = _this.questions.filter(function (question) { return ["matrixdropdown", "matrixdynamic", "matrix", "file", "signature", "multipletext", "comment", "html", "image"].indexOf(question.getType()) === -1; });
|
|
9995
|
+
if (_this.options.intervalPrecision !== undefined) {
|
|
9996
|
+
_this._intervalPrecision = _this.options.intervalPrecision;
|
|
9997
|
+
}
|
|
9998
|
+
_this.axisXQuestionName = _this.questions.length > 0 ? _this.questions[0].name : undefined;
|
|
9999
|
+
_this.registerToolbarItem("axisXSelector", function () {
|
|
10000
|
+
return _this.axisXSelector = _utils__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.questions.map(function (question) {
|
|
10001
|
+
return {
|
|
10002
|
+
value: question.name,
|
|
10003
|
+
text: question.title || question.name,
|
|
10004
|
+
};
|
|
10005
|
+
}), function (option) { return _this.axisXQuestionName === option.value; }, function (e) { _this.axisXQuestionName = e.target.value; _this.setupPivot(); }, _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("axisXSelectorTitle"));
|
|
10006
|
+
});
|
|
10007
|
+
_this.registerToolbarItem("axisYSelector0", _this.createYSelecterGenerator());
|
|
10008
|
+
_this.setupPivot();
|
|
10009
|
+
return _this;
|
|
9954
10010
|
}
|
|
9955
|
-
|
|
9956
|
-
var
|
|
9957
|
-
var
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
10011
|
+
PivotModel.prototype.createYSelecterGenerator = function () {
|
|
10012
|
+
var _this = this;
|
|
10013
|
+
var selectorIndex = this.axisYSelectors.length;
|
|
10014
|
+
return function () {
|
|
10015
|
+
var selector = _this.axisYSelectors[selectorIndex];
|
|
10016
|
+
if (!selector) {
|
|
10017
|
+
selector = _this.createAxisYSelector(selectorIndex);
|
|
10018
|
+
_this.axisYSelectors.push(selector);
|
|
10019
|
+
}
|
|
10020
|
+
return selector;
|
|
10021
|
+
};
|
|
10022
|
+
};
|
|
10023
|
+
PivotModel.prototype.setAxisQuestions = function () {
|
|
10024
|
+
var axisQuestionNames = [];
|
|
10025
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10026
|
+
axisQuestionNames[_i] = arguments[_i];
|
|
9963
10027
|
}
|
|
9964
|
-
if (
|
|
9965
|
-
|
|
9966
|
-
trace.marker.colors = boolColors;
|
|
9967
|
-
});
|
|
10028
|
+
if (axisQuestionNames.length < 1) {
|
|
10029
|
+
return;
|
|
9968
10030
|
}
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
10031
|
+
this.axisXQuestionName = axisQuestionNames[0];
|
|
10032
|
+
this.axisYQuestionNames = axisQuestionNames.splice(1);
|
|
10033
|
+
this.setupPivot();
|
|
10034
|
+
};
|
|
10035
|
+
PivotModel.prototype.onAxisYSelectorChanged = function (index, value) {
|
|
10036
|
+
this.axisYQuestionNames[index] = value;
|
|
10037
|
+
if (index < this.axisYSelectors.length - 1) {
|
|
10038
|
+
if (!value) {
|
|
10039
|
+
for (var i = index + 1; i < this.axisYSelectors.length; ++i) {
|
|
10040
|
+
this.unregisterToolbarItem("axisYSelector" + i);
|
|
10041
|
+
}
|
|
10042
|
+
this.axisYSelectors = this.axisYSelectors.slice(0, index + 1);
|
|
10043
|
+
this.axisYQuestionNames = this.axisYQuestionNames.slice(0, index + 1);
|
|
10044
|
+
this.updateToolbar();
|
|
10045
|
+
}
|
|
10046
|
+
}
|
|
10047
|
+
else {
|
|
10048
|
+
if (!!value) {
|
|
10049
|
+
this.registerToolbarItem("axisYSelector" + this.axisYSelectors.length, this.createYSelecterGenerator());
|
|
10050
|
+
this.updateToolbar();
|
|
10051
|
+
}
|
|
9973
10052
|
}
|
|
10053
|
+
this.setupPivot();
|
|
9974
10054
|
};
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
_this.
|
|
9983
|
-
|
|
9984
|
-
_this._chartAdapter = new PlotlyBoolChartAdapter(_this);
|
|
9985
|
-
return _this;
|
|
9986
|
-
}
|
|
9987
|
-
BooleanPlotly.prototype.destroyContent = function (container) {
|
|
9988
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
9989
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10055
|
+
PivotModel.prototype.createAxisYSelector = function (selectorIndex) {
|
|
10056
|
+
var _this = this;
|
|
10057
|
+
var selector = _utils__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector([{ value: "", text: "Not selected" }].concat(this.questions.map(function (question) {
|
|
10058
|
+
return {
|
|
10059
|
+
value: question.name,
|
|
10060
|
+
text: question.title || question.name,
|
|
10061
|
+
};
|
|
10062
|
+
})), function (option) { return _this.axisYQuestionNames[selectorIndex] === option.value; }, function (e) { _this.onAxisYSelectorChanged(selectorIndex, e.target.value); }, selectorIndex ? undefined : _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("axisYSelectorTitle"));
|
|
10063
|
+
return selector;
|
|
9990
10064
|
};
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
return
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
_a.sent();
|
|
10001
|
-
container.innerHTML = "";
|
|
10002
|
-
container.appendChild(chartNode);
|
|
10003
|
-
return [2 /*return*/, container];
|
|
10004
|
-
}
|
|
10005
|
-
});
|
|
10006
|
-
});
|
|
10065
|
+
PivotModel.prototype.getQuestionValueType = function (question) {
|
|
10066
|
+
var questionType = question.getType();
|
|
10067
|
+
if (questionType === "text" && (question["inputType"] === "date" || question["inputType"] === "datetime")) {
|
|
10068
|
+
return "date";
|
|
10069
|
+
}
|
|
10070
|
+
else if (questionType === "text" || questionType === "rating" || questionType === "expression" || questionType === "range") {
|
|
10071
|
+
return "number";
|
|
10072
|
+
}
|
|
10073
|
+
return "enum";
|
|
10007
10074
|
};
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
"use strict";
|
|
10024
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10025
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10026
|
-
/* harmony export */ HistogramPlotly: () => (/* binding */ HistogramPlotly)
|
|
10027
|
-
/* harmony export */ });
|
|
10028
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10029
|
-
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
10030
|
-
/* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../histogram */ "./src/histogram.ts");
|
|
10031
|
-
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
|
|
10032
|
-
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
var HistogramPlotly = /** @class */ (function (_super) {
|
|
10039
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(HistogramPlotly, _super);
|
|
10040
|
-
function HistogramPlotly(question, data, options, name) {
|
|
10041
|
-
var _this = _super.call(this, question, data, options, name) || this;
|
|
10042
|
-
_this.chartTypes = HistogramPlotly.types;
|
|
10043
|
-
_this._chartType = _this.chartTypes[0];
|
|
10044
|
-
_this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
|
|
10045
|
-
return _this;
|
|
10046
|
-
}
|
|
10047
|
-
HistogramPlotly.prototype.destroyContent = function (container) {
|
|
10048
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
10049
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10075
|
+
PivotModel.prototype.setupPivot = function () {
|
|
10076
|
+
var _this = this;
|
|
10077
|
+
var questionX = this.questions.filter(function (q) { return q.name === _this.axisXQuestionName; })[0];
|
|
10078
|
+
if (!questionX) {
|
|
10079
|
+
return;
|
|
10080
|
+
}
|
|
10081
|
+
this.question = questionX;
|
|
10082
|
+
this.valueType = this.getQuestionValueType(questionX);
|
|
10083
|
+
this.questionsY = this.axisYQuestionNames.map(function (name) {
|
|
10084
|
+
var questionY = _this.questions.filter(function (q) { return q.name === name; })[0];
|
|
10085
|
+
if (!!questionY) {
|
|
10086
|
+
return _this.getQuestionValueType(questionY) === "enum" ? new _selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase(questionY, []) : new _visualizerBase__WEBPACK_IMPORTED_MODULE_4__.VisualizerBase(questionY, []);
|
|
10087
|
+
}
|
|
10088
|
+
}).filter(function (q) { return !!q; });
|
|
10089
|
+
this.onDataChanged();
|
|
10050
10090
|
};
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
switch (_a.label) {
|
|
10056
|
-
case 0:
|
|
10057
|
-
chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
|
|
10058
|
-
container.innerHTML = "";
|
|
10059
|
-
container.appendChild(chartNode);
|
|
10060
|
-
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
10061
|
-
case 1:
|
|
10062
|
-
_a.sent();
|
|
10063
|
-
return [2 /*return*/, container];
|
|
10064
|
-
}
|
|
10065
|
-
});
|
|
10066
|
-
});
|
|
10091
|
+
PivotModel.prototype.reset = function () {
|
|
10092
|
+
this._continiousData = undefined;
|
|
10093
|
+
this._cachedValues = undefined;
|
|
10094
|
+
this._cachedIntervals = undefined;
|
|
10067
10095
|
};
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
var values = this.getValues();
|
|
10072
|
-
if (series.length > 1) {
|
|
10073
|
-
var preparedData_1 = [];
|
|
10074
|
-
values.forEach(function (val, valueIndex) {
|
|
10075
|
-
var seriesData = series.map(function (seriesValue, seriesIndex) { return statistics[seriesIndex][valueIndex]; });
|
|
10076
|
-
preparedData_1.push(seriesData);
|
|
10077
|
-
});
|
|
10078
|
-
return preparedData_1;
|
|
10096
|
+
PivotModel.prototype.getContiniousValue = function (value) {
|
|
10097
|
+
if (this.valueType === "date") {
|
|
10098
|
+
return Date.parse(value);
|
|
10079
10099
|
}
|
|
10080
|
-
return
|
|
10100
|
+
return parseFloat(value);
|
|
10081
10101
|
};
|
|
10082
|
-
|
|
10083
|
-
|
|
10102
|
+
PivotModel.prototype.getString = function (value) {
|
|
10103
|
+
if (this.valueType === "date") {
|
|
10104
|
+
return new Date(value).toLocaleDateString();
|
|
10105
|
+
}
|
|
10106
|
+
return "" + value;
|
|
10084
10107
|
};
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("date", HistogramPlotly);
|
|
10090
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("number", HistogramPlotly);
|
|
10091
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("rating", HistogramPlotly);
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
/***/ }),
|
|
10095
|
-
|
|
10096
|
-
/***/ "./src/plotly/index.ts":
|
|
10097
|
-
/*!*****************************!*\
|
|
10098
|
-
!*** ./src/plotly/index.ts ***!
|
|
10099
|
-
\*****************************/
|
|
10100
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10101
|
-
|
|
10102
|
-
"use strict";
|
|
10103
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10104
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10105
|
-
/* harmony export */ BooleanPlotly: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_3__.BooleanPlotly),
|
|
10106
|
-
/* harmony export */ GaugePlotly: () => (/* reexport safe */ _rating__WEBPACK_IMPORTED_MODULE_7__.GaugePlotly),
|
|
10107
|
-
/* harmony export */ HistogramPlotly: () => (/* reexport safe */ _histogram__WEBPACK_IMPORTED_MODULE_6__.HistogramPlotly),
|
|
10108
|
-
/* harmony export */ MatrixDropdownGroupedPlotly: () => (/* reexport safe */ _matrixdropdown_grouped__WEBPACK_IMPORTED_MODULE_5__.MatrixDropdownGroupedPlotly),
|
|
10109
|
-
/* harmony export */ MatrixPlotly: () => (/* reexport safe */ _matrix__WEBPACK_IMPORTED_MODULE_2__.MatrixPlotly),
|
|
10110
|
-
/* harmony export */ PlotlyBoolChartAdapter: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_3__.PlotlyBoolChartAdapter),
|
|
10111
|
-
/* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_1__.PlotlyChartAdapter),
|
|
10112
|
-
/* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _rating__WEBPACK_IMPORTED_MODULE_7__.PlotlyGaugeAdapter),
|
|
10113
|
-
/* harmony export */ PlotlySetup: () => (/* reexport safe */ _setup__WEBPACK_IMPORTED_MODULE_0__.PlotlySetup),
|
|
10114
|
-
/* harmony export */ RankingPlotly: () => (/* reexport safe */ _ranking__WEBPACK_IMPORTED_MODULE_4__.RankingPlotly),
|
|
10115
|
-
/* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_1__.SelectBasePlotly)
|
|
10116
|
-
/* harmony export */ });
|
|
10117
|
-
/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
|
|
10118
|
-
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
|
|
10119
|
-
/* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./matrix */ "./src/plotly/matrix.ts");
|
|
10120
|
-
/* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./boolean */ "./src/plotly/boolean.ts");
|
|
10121
|
-
/* harmony import */ var _ranking__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ranking */ "./src/plotly/ranking.ts");
|
|
10122
|
-
/* harmony import */ var _matrixdropdown_grouped__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./matrixdropdown-grouped */ "./src/plotly/matrixdropdown-grouped.ts");
|
|
10123
|
-
/* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./histogram */ "./src/plotly/histogram.ts");
|
|
10124
|
-
/* harmony import */ var _rating__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rating */ "./src/plotly/rating.ts");
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
/***/ }),
|
|
10136
|
-
|
|
10137
|
-
/***/ "./src/plotly/matrix.ts":
|
|
10138
|
-
/*!******************************!*\
|
|
10139
|
-
!*** ./src/plotly/matrix.ts ***!
|
|
10140
|
-
\******************************/
|
|
10141
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10142
|
-
|
|
10143
|
-
"use strict";
|
|
10144
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10145
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10146
|
-
/* harmony export */ MatrixPlotly: () => (/* binding */ MatrixPlotly)
|
|
10147
|
-
/* harmony export */ });
|
|
10148
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10149
|
-
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
10150
|
-
/* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../matrix */ "./src/matrix.ts");
|
|
10151
|
-
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
|
|
10152
|
-
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
var MatrixPlotly = /** @class */ (function (_super) {
|
|
10159
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixPlotly, _super);
|
|
10160
|
-
function MatrixPlotly(question, data, options, name) {
|
|
10161
|
-
var _this = _super.call(this, question, data, options, name) || this;
|
|
10162
|
-
_this.chartTypes = MatrixPlotly.types;
|
|
10163
|
-
_this._chartType = _this.chartTypes[0];
|
|
10164
|
-
_this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
|
|
10165
|
-
return _this;
|
|
10166
|
-
}
|
|
10167
|
-
MatrixPlotly.prototype.destroyContent = function (container) {
|
|
10168
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
10169
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10108
|
+
PivotModel.prototype.toPrecision = function (value) {
|
|
10109
|
+
var base = Math.pow(10, this._intervalPrecision);
|
|
10110
|
+
return Math.round(base * value) / base;
|
|
10170
10111
|
};
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
var
|
|
10174
|
-
return
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10112
|
+
PivotModel.prototype.getSelectedItemByText = function (itemText) {
|
|
10113
|
+
if (this.hasCustomIntervals || this.getContiniousValues().length > PivotModel.UseIntervalsFrom) {
|
|
10114
|
+
var interval = this.intervals.filter(function (interval) { return interval.label === itemText; })[0];
|
|
10115
|
+
return new survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue(interval, interval !== undefined ? interval.label : "");
|
|
10116
|
+
}
|
|
10117
|
+
var labels = this.getLabels();
|
|
10118
|
+
var labelIndex = labels.indexOf(itemText);
|
|
10119
|
+
return new survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue(this.getValues()[labelIndex], labels[labelIndex]);
|
|
10120
|
+
};
|
|
10121
|
+
/**
|
|
10122
|
+
* Updates visualizer data.
|
|
10123
|
+
*/
|
|
10124
|
+
PivotModel.prototype.updateData = function (data) {
|
|
10125
|
+
this.reset();
|
|
10126
|
+
_super.prototype.updateData.call(this, data);
|
|
10127
|
+
};
|
|
10128
|
+
PivotModel.prototype.onDataChanged = function () {
|
|
10129
|
+
this.reset();
|
|
10130
|
+
_super.prototype.onDataChanged.call(this);
|
|
10131
|
+
};
|
|
10132
|
+
PivotModel.prototype.getContiniousValues = function () {
|
|
10133
|
+
var _this = this;
|
|
10134
|
+
if (this._cachedValues === undefined) {
|
|
10135
|
+
this._continiousData = [];
|
|
10136
|
+
if (this.valueType === "enum") {
|
|
10137
|
+
this._cachedValues = [];
|
|
10138
|
+
return this._cachedValues;
|
|
10139
|
+
}
|
|
10140
|
+
var hash_1 = {};
|
|
10141
|
+
this.data.forEach(function (dataItem) {
|
|
10142
|
+
var answerData = dataItem[_this.name];
|
|
10143
|
+
if (answerData !== undefined) {
|
|
10144
|
+
// TODO: _continiousData should be sorted in order to speed-up statistics calculation in the getData function
|
|
10145
|
+
_this._continiousData.push({ continious: _this.getContiniousValue(answerData), row: dataItem });
|
|
10146
|
+
hash_1[answerData] = { value: answerData, row: dataItem };
|
|
10184
10147
|
}
|
|
10185
10148
|
});
|
|
10186
|
-
|
|
10149
|
+
this._cachedValues = Object.keys(hash_1).map(function (key) { return ({ original: hash_1[key].value, continious: _this.getContiniousValue(key), row: hash_1[key].row }); });
|
|
10150
|
+
this._cachedValues.sort(function (a, b) { return a.continious - b.continious; });
|
|
10151
|
+
}
|
|
10152
|
+
return this._cachedValues;
|
|
10187
10153
|
};
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
}(_matrix__WEBPACK_IMPORTED_MODULE_2__.Matrix));
|
|
10191
|
-
|
|
10192
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("matrix", MatrixPlotly);
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
/***/ }),
|
|
10196
|
-
|
|
10197
|
-
/***/ "./src/plotly/matrixdropdown-grouped.ts":
|
|
10198
|
-
/*!**********************************************!*\
|
|
10199
|
-
!*** ./src/plotly/matrixdropdown-grouped.ts ***!
|
|
10200
|
-
\**********************************************/
|
|
10201
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10202
|
-
|
|
10203
|
-
"use strict";
|
|
10204
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10205
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10206
|
-
/* harmony export */ MatrixDropdownGroupedPlotly: () => (/* binding */ MatrixDropdownGroupedPlotly)
|
|
10207
|
-
/* harmony export */ });
|
|
10208
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10209
|
-
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
10210
|
-
/* harmony import */ var _matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../matrixDropdownGrouped */ "./src/matrixDropdownGrouped.ts");
|
|
10211
|
-
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
|
|
10212
|
-
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
var MatrixDropdownGroupedPlotly = /** @class */ (function (_super) {
|
|
10219
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixDropdownGroupedPlotly, _super);
|
|
10220
|
-
function MatrixDropdownGroupedPlotly(question, data, options, name) {
|
|
10221
|
-
var _this = _super.call(this, question, data, options, name) || this;
|
|
10222
|
-
_this.chartTypes = MatrixDropdownGroupedPlotly.types;
|
|
10223
|
-
_this._chartType = _this.chartTypes[0];
|
|
10224
|
-
_this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
|
|
10225
|
-
return _this;
|
|
10226
|
-
}
|
|
10227
|
-
MatrixDropdownGroupedPlotly.prototype.destroyContent = function (container) {
|
|
10228
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
10229
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10230
|
-
};
|
|
10231
|
-
MatrixDropdownGroupedPlotly.prototype.renderContentAsync = function (container) {
|
|
10232
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10233
|
-
var chartNode;
|
|
10234
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
10235
|
-
switch (_a.label) {
|
|
10236
|
-
case 0:
|
|
10237
|
-
chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
|
|
10238
|
-
container.innerHTML = "";
|
|
10239
|
-
container.appendChild(chartNode);
|
|
10240
|
-
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
10241
|
-
case 1:
|
|
10242
|
-
_a.sent();
|
|
10243
|
-
return [2 /*return*/, container];
|
|
10244
|
-
}
|
|
10245
|
-
});
|
|
10246
|
-
});
|
|
10247
|
-
};
|
|
10248
|
-
MatrixDropdownGroupedPlotly.types = ["stackedbar", "bar", "pie", "doughnut"];
|
|
10249
|
-
return MatrixDropdownGroupedPlotly;
|
|
10250
|
-
}(_matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_2__.MatrixDropdownGrouped));
|
|
10251
|
-
|
|
10252
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("matrixdropdown-grouped", MatrixDropdownGroupedPlotly);
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
/***/ }),
|
|
10256
|
-
|
|
10257
|
-
/***/ "./src/plotly/ranking.ts":
|
|
10258
|
-
/*!*******************************!*\
|
|
10259
|
-
!*** ./src/plotly/ranking.ts ***!
|
|
10260
|
-
\*******************************/
|
|
10261
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10262
|
-
|
|
10263
|
-
"use strict";
|
|
10264
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10265
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10266
|
-
/* harmony export */ RankingPlotly: () => (/* binding */ RankingPlotly)
|
|
10267
|
-
/* harmony export */ });
|
|
10268
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10269
|
-
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
10270
|
-
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
var RankingPlotly = /** @class */ (function (_super) {
|
|
10275
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(RankingPlotly, _super);
|
|
10276
|
-
function RankingPlotly() {
|
|
10277
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10278
|
-
}
|
|
10279
|
-
RankingPlotly.prototype.getQuestionResults = function () {
|
|
10280
|
-
var name = this.question.name;
|
|
10281
|
-
return this.data.map(function (dataItem) { return dataItem[name]; });
|
|
10154
|
+
PivotModel.prototype.isSupportAnswersOrder = function () {
|
|
10155
|
+
return false;
|
|
10282
10156
|
};
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
var data = [];
|
|
10286
|
-
data.length = choices.length;
|
|
10287
|
-
data.fill(0);
|
|
10288
|
-
return data;
|
|
10157
|
+
PivotModel.prototype.isSupportMissingAnswers = function () {
|
|
10158
|
+
return false;
|
|
10289
10159
|
};
|
|
10290
|
-
|
|
10160
|
+
Object.defineProperty(PivotModel.prototype, "needUseRateValues", {
|
|
10161
|
+
get: function () {
|
|
10162
|
+
return this.question.getType() == "rating" && Array.isArray(this.question["rateValues"]) && this.question["rateValues"].length > 0;
|
|
10163
|
+
},
|
|
10164
|
+
enumerable: false,
|
|
10165
|
+
configurable: true
|
|
10166
|
+
});
|
|
10167
|
+
PivotModel.prototype.getSeriesValues = function () {
|
|
10291
10168
|
var _this = this;
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10169
|
+
if (!this.questionsY || this.questionsY.length === 0) {
|
|
10170
|
+
return this.options.seriesValues || [];
|
|
10171
|
+
}
|
|
10172
|
+
var seriesValues = [];
|
|
10173
|
+
this.questionsY.forEach(function (q) {
|
|
10174
|
+
if (_this.getQuestionValueType(q.question) === "enum") {
|
|
10175
|
+
seriesValues.push.apply(seriesValues, q.getValues().reverse());
|
|
10176
|
+
}
|
|
10177
|
+
else {
|
|
10178
|
+
seriesValues.push(q.question.name);
|
|
10179
|
+
}
|
|
10297
10180
|
});
|
|
10298
|
-
return
|
|
10181
|
+
return seriesValues;
|
|
10299
10182
|
};
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10183
|
+
PivotModel.prototype.getSeriesLabels = function () {
|
|
10184
|
+
var _this = this;
|
|
10185
|
+
if (this.questionsY.length === 0) {
|
|
10186
|
+
return this.getSeriesValues();
|
|
10187
|
+
}
|
|
10188
|
+
var seriesLabels = [];
|
|
10189
|
+
this.questionsY.forEach(function (q) {
|
|
10190
|
+
if (_this.getQuestionValueType(q.question) === "enum") {
|
|
10191
|
+
seriesLabels.push.apply(seriesLabels, q.getLabels().reverse());
|
|
10192
|
+
}
|
|
10193
|
+
else {
|
|
10194
|
+
seriesLabels.push(q.question.title || q.question.name);
|
|
10195
|
+
}
|
|
10307
10196
|
});
|
|
10197
|
+
return seriesLabels;
|
|
10308
10198
|
};
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
"use strict";
|
|
10324
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10325
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10326
|
-
/* harmony export */ GaugePlotly: () => (/* binding */ GaugePlotly),
|
|
10327
|
-
/* harmony export */ PlotlyGaugeAdapter: () => (/* binding */ PlotlyGaugeAdapter)
|
|
10328
|
-
/* harmony export */ });
|
|
10329
|
-
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10330
|
-
/* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../number */ "./src/number.ts");
|
|
10331
|
-
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
|
|
10332
|
-
/* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/index */ "./src/utils/index.ts");
|
|
10333
|
-
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../localizationManager */ "./src/localizationManager.ts");
|
|
10334
|
-
/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
|
|
10335
|
-
/* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! plotly.js-dist-min */ "plotly.js-dist-min");
|
|
10336
|
-
/* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__);
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
var PlotlyGaugeAdapter = /** @class */ (function () {
|
|
10345
|
-
function PlotlyGaugeAdapter(model) {
|
|
10346
|
-
this.model = model;
|
|
10347
|
-
this._chart = undefined;
|
|
10348
|
-
}
|
|
10349
|
-
Object.defineProperty(PlotlyGaugeAdapter.prototype, "chart", {
|
|
10199
|
+
PivotModel.prototype.getValues = function () {
|
|
10200
|
+
if (this.valueType === "enum") {
|
|
10201
|
+
return _super.prototype.getValues.call(this).reverse();
|
|
10202
|
+
}
|
|
10203
|
+
return this.intervals.map(function (interval) { return interval.start; });
|
|
10204
|
+
};
|
|
10205
|
+
PivotModel.prototype.getLabels = function () {
|
|
10206
|
+
if (this.valueType === "enum") {
|
|
10207
|
+
return _super.prototype.getLabels.call(this).reverse();
|
|
10208
|
+
}
|
|
10209
|
+
return this.intervals.map(function (interval) { return interval.label; });
|
|
10210
|
+
};
|
|
10211
|
+
Object.defineProperty(PivotModel.prototype, "hasCustomIntervals", {
|
|
10350
10212
|
get: function () {
|
|
10351
|
-
return this.
|
|
10213
|
+
return !!this.questionOptions && Array.isArray(this.questionOptions.intervals);
|
|
10352
10214
|
},
|
|
10353
10215
|
enumerable: false,
|
|
10354
10216
|
configurable: true
|
|
10355
10217
|
});
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10218
|
+
Object.defineProperty(PivotModel.prototype, "intervals", {
|
|
10219
|
+
get: function () {
|
|
10220
|
+
if (this.hasCustomIntervals) {
|
|
10221
|
+
return this.questionOptions.intervals;
|
|
10222
|
+
}
|
|
10223
|
+
if (this.question.getType() == "rating") {
|
|
10224
|
+
if (this.needUseRateValues) {
|
|
10225
|
+
var rateValues_1 = this.question["rateValues"];
|
|
10226
|
+
rateValues_1.sort(function (iv1, iv2) { return iv1.value - iv2.value; });
|
|
10227
|
+
return rateValues_1.map(function (rateValue, i) { return ({
|
|
10228
|
+
start: rateValue.value,
|
|
10229
|
+
end: i < rateValues_1.length - 1 ? rateValues_1[i + 1].value : rateValue.value + 1,
|
|
10230
|
+
label: rateValue.text
|
|
10231
|
+
}); });
|
|
10232
|
+
}
|
|
10233
|
+
else {
|
|
10234
|
+
var rateIntervals = [];
|
|
10235
|
+
for (var i = (this.question["rateMin"] || 0); i <= (this.question["rateMax"] || (PivotModel.IntervalsCount - 1)); i += (this.question["rateStep"] || 1)) {
|
|
10236
|
+
rateIntervals.push({
|
|
10237
|
+
start: i,
|
|
10238
|
+
end: i + 1,
|
|
10239
|
+
label: "" + (!!this.question["rateMin"] && !!this.question["rateMax"] ? i : (i + "-" + (i + 1)))
|
|
10240
|
+
});
|
|
10241
|
+
}
|
|
10242
|
+
return rateIntervals;
|
|
10243
|
+
}
|
|
10244
|
+
}
|
|
10245
|
+
if (this._cachedIntervals === undefined) {
|
|
10246
|
+
var continiousValues = this.getContiniousValues();
|
|
10247
|
+
this._cachedIntervals = [];
|
|
10248
|
+
if (continiousValues.length) {
|
|
10249
|
+
var start = continiousValues[0].continious;
|
|
10250
|
+
var end = continiousValues[continiousValues.length - 1].continious;
|
|
10251
|
+
var intervalsCount = PivotModel.IntervalsCount;
|
|
10252
|
+
var delta = (end - start) / intervalsCount;
|
|
10253
|
+
for (var i = 0; i < intervalsCount; ++i) {
|
|
10254
|
+
var next = start + delta;
|
|
10255
|
+
var istart = this.toPrecision(start);
|
|
10256
|
+
var inext = this.toPrecision(next);
|
|
10257
|
+
this._cachedIntervals.push({
|
|
10258
|
+
start: istart,
|
|
10259
|
+
end: i < intervalsCount - 1 ? inext : inext + delta / 100,
|
|
10260
|
+
label: "" + this.getString(istart) + "-" + this.getString(inext)
|
|
10261
|
+
});
|
|
10262
|
+
start = next;
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
return this._cachedIntervals;
|
|
10267
|
+
},
|
|
10268
|
+
enumerable: false,
|
|
10269
|
+
configurable: true
|
|
10270
|
+
});
|
|
10271
|
+
PivotModel.prototype.convertFromExternalData = function (externalCalculatedData) {
|
|
10272
|
+
return [externalCalculatedData];
|
|
10273
|
+
};
|
|
10274
|
+
PivotModel.prototype.getSeriesValueIndexes = function () {
|
|
10275
|
+
var _this = this;
|
|
10276
|
+
var seriesValueIndexes = {};
|
|
10277
|
+
var valueIndex = 0;
|
|
10278
|
+
for (var i = 0; i < this.questionsY.length; ++i) {
|
|
10279
|
+
var questionValueType = this.getQuestionValueType(this.questionsY[i].question);
|
|
10280
|
+
if (questionValueType === "enum") {
|
|
10281
|
+
this.questionsY[i].getValues().reverse().forEach(function (value) {
|
|
10282
|
+
seriesValueIndexes[_this.questionsY[i].name + "_" + value] = valueIndex++;
|
|
10283
|
+
});
|
|
10284
|
+
}
|
|
10285
|
+
else {
|
|
10286
|
+
seriesValueIndexes[this.questionsY[i].name] = valueIndex++;
|
|
10287
|
+
}
|
|
10288
|
+
}
|
|
10289
|
+
return seriesValueIndexes;
|
|
10290
|
+
};
|
|
10291
|
+
PivotModel.prototype.updateStatisticsSeriesValue = function (statistics, dataRow, valueIndex, seriesValueIndexes) {
|
|
10292
|
+
for (var j = 0; j < this.questionsY.length; ++j) {
|
|
10293
|
+
if (dataRow[this.questionsY[j].name] !== undefined) {
|
|
10294
|
+
var questionValueType = this.getQuestionValueType(this.questionsY[j].question);
|
|
10295
|
+
if (questionValueType === "enum" || questionValueType === "date") {
|
|
10296
|
+
var seriesValueIndex = seriesValueIndexes[this.questionsY[j].name + "_" + dataRow[this.questionsY[j].name]];
|
|
10297
|
+
statistics[seriesValueIndex][valueIndex]++;
|
|
10298
|
+
}
|
|
10299
|
+
else {
|
|
10300
|
+
var seriesValueIndex = seriesValueIndexes[this.questionsY[j].name];
|
|
10301
|
+
statistics[seriesValueIndex][valueIndex] += parseFloat(dataRow[this.questionsY[j].name]);
|
|
10302
|
+
}
|
|
10303
|
+
}
|
|
10304
|
+
}
|
|
10305
|
+
};
|
|
10306
|
+
PivotModel.prototype.getCalculatedValuesCore = function () {
|
|
10307
|
+
var _this = this;
|
|
10308
|
+
var statistics = [];
|
|
10309
|
+
var series = this.getSeriesValues();
|
|
10310
|
+
if (series.length === 0) {
|
|
10311
|
+
series.push("");
|
|
10312
|
+
}
|
|
10313
|
+
var seriesValueIndexes = this.getSeriesValueIndexes();
|
|
10314
|
+
if (this.valueType === "enum") {
|
|
10315
|
+
var values = this.getValues();
|
|
10316
|
+
var valueIndexes_1 = {};
|
|
10317
|
+
values.forEach(function (value, index) {
|
|
10318
|
+
valueIndexes_1[value] = index;
|
|
10319
|
+
});
|
|
10320
|
+
for (var i = 0; i < series.length; ++i) {
|
|
10321
|
+
statistics.push(values.map(function (i) { return 0; }));
|
|
10322
|
+
}
|
|
10323
|
+
this.data.forEach(function (dataRow) {
|
|
10324
|
+
var answerData = dataRow[_this.name];
|
|
10325
|
+
if (answerData !== undefined && valueIndexes_1[answerData] !== undefined) {
|
|
10326
|
+
var valueIndex = valueIndexes_1[answerData];
|
|
10327
|
+
if (_this.questionsY.length === 0) {
|
|
10328
|
+
statistics[0][valueIndex]++;
|
|
10329
|
+
}
|
|
10330
|
+
else {
|
|
10331
|
+
_this.updateStatisticsSeriesValue(statistics, dataRow, valueIndex, seriesValueIndexes);
|
|
10332
|
+
}
|
|
10333
|
+
}
|
|
10334
|
+
});
|
|
10335
|
+
}
|
|
10336
|
+
else {
|
|
10337
|
+
var continiousValues = this.getContiniousValues();
|
|
10338
|
+
var intervals_1 = this.intervals;
|
|
10339
|
+
for (var i = 0; i < series.length; ++i) {
|
|
10340
|
+
statistics.push(intervals_1.map(function (i) { return 0; }));
|
|
10341
|
+
}
|
|
10342
|
+
this._continiousData.forEach(function (dataValue) {
|
|
10343
|
+
for (var valueIndex = 0; valueIndex < intervals_1.length; ++valueIndex) {
|
|
10344
|
+
if (intervals_1[valueIndex].start <= dataValue.continious && (dataValue.continious < intervals_1[valueIndex].end || valueIndex == intervals_1.length - 1)) {
|
|
10345
|
+
if (_this.questionsY.length === 0) {
|
|
10346
|
+
statistics[0][valueIndex]++;
|
|
10377
10347
|
}
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
type: "indicator",
|
|
10381
|
-
mode: "gauge+number",
|
|
10382
|
-
gauge: {
|
|
10383
|
-
axis: { range: [minValue, maxValue] },
|
|
10384
|
-
shape: this.model.chartType,
|
|
10385
|
-
bgcolor: "white",
|
|
10386
|
-
bar: { color: colors[0] },
|
|
10387
|
-
},
|
|
10388
|
-
value: level,
|
|
10389
|
-
text: question.name,
|
|
10390
|
-
domain: { x: [0, 1], y: [0, 1] },
|
|
10391
|
-
},
|
|
10392
|
-
];
|
|
10393
|
-
chartMargin = this.model.chartType === "bullet" ? 60 : 30;
|
|
10394
|
-
layout = {
|
|
10395
|
-
height: 250,
|
|
10396
|
-
margin: {
|
|
10397
|
-
l: chartMargin,
|
|
10398
|
-
r: chartMargin,
|
|
10399
|
-
b: chartMargin,
|
|
10400
|
-
t: chartMargin,
|
|
10401
|
-
pad: 5
|
|
10402
|
-
},
|
|
10403
|
-
plot_bgcolor: this.model.backgroundColor,
|
|
10404
|
-
paper_bgcolor: this.model.backgroundColor,
|
|
10405
|
-
};
|
|
10406
|
-
config = {
|
|
10407
|
-
displayModeBar: true,
|
|
10408
|
-
locale: _localizationManager__WEBPACK_IMPORTED_MODULE_4__.localization.currentLocale,
|
|
10409
|
-
responsive: true,
|
|
10410
|
-
displaylogo: false,
|
|
10411
|
-
modeBarButtonsToRemove: ["toImage"],
|
|
10412
|
-
modeBarButtonsToAdd: [
|
|
10413
|
-
{
|
|
10414
|
-
name: "toImageSjs",
|
|
10415
|
-
title: _localizationManager__WEBPACK_IMPORTED_MODULE_4__.localization.getString("saveDiagramAsPNG"),
|
|
10416
|
-
icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
|
|
10417
|
-
click: function (gd) {
|
|
10418
|
-
var options = {
|
|
10419
|
-
format: _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.imageExportFormat,
|
|
10420
|
-
// width: 800,
|
|
10421
|
-
// height: 600,
|
|
10422
|
-
filename: _this.model.question.name,
|
|
10423
|
-
};
|
|
10424
|
-
_setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onImageSaving.fire(_this.model, options);
|
|
10425
|
-
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
|
|
10426
|
-
},
|
|
10427
|
-
},
|
|
10428
|
-
],
|
|
10429
|
-
};
|
|
10430
|
-
if (GaugePlotly.displayModeBar !== undefined) {
|
|
10431
|
-
config.displayModeBar = GaugePlotly.displayModeBar;
|
|
10348
|
+
else {
|
|
10349
|
+
_this.updateStatisticsSeriesValue(statistics, dataValue.row, valueIndex, seriesValueIndexes);
|
|
10432
10350
|
}
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
layout: layout,
|
|
10436
|
-
config: config,
|
|
10437
|
-
};
|
|
10438
|
-
_setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onPlotCreating.fire(this.model, options);
|
|
10439
|
-
plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().newPlot(chartNode, options.data, options.layout, options.config);
|
|
10440
|
-
// setTimeout(() => Plotly.Plots.resize(chartNode), 10);
|
|
10441
|
-
return [2 /*return*/, plot];
|
|
10351
|
+
break;
|
|
10352
|
+
}
|
|
10442
10353
|
}
|
|
10443
10354
|
});
|
|
10444
|
-
});
|
|
10445
|
-
};
|
|
10446
|
-
PlotlyGaugeAdapter.prototype.destroy = function (node) {
|
|
10447
|
-
if (!!node) {
|
|
10448
|
-
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().purge(node);
|
|
10449
10355
|
}
|
|
10450
|
-
|
|
10356
|
+
return statistics;
|
|
10451
10357
|
};
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
var GaugePlotly = /** @class */ (function (_super) {
|
|
10456
|
-
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(GaugePlotly, _super);
|
|
10457
|
-
function GaugePlotly(question, data, options, name) {
|
|
10458
|
-
var _this = _super.call(this, question, data, options, name) || this;
|
|
10459
|
-
_this.chartTypes = GaugePlotly.types;
|
|
10460
|
-
_this.chartType = _this.chartTypes[0];
|
|
10461
|
-
_this._chartAdapter = new PlotlyGaugeAdapter(_this);
|
|
10462
|
-
return _this;
|
|
10463
|
-
}
|
|
10464
|
-
GaugePlotly.prototype.destroyContent = function (container) {
|
|
10465
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
10466
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10358
|
+
PivotModel.prototype.getValueType = function () {
|
|
10359
|
+
return this.valueType;
|
|
10467
10360
|
};
|
|
10468
|
-
|
|
10469
|
-
return
|
|
10470
|
-
var chartNode;
|
|
10471
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
10472
|
-
switch (_a.label) {
|
|
10473
|
-
case 0:
|
|
10474
|
-
chartNode = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createElement("div");
|
|
10475
|
-
container.innerHTML = "";
|
|
10476
|
-
container.appendChild(chartNode);
|
|
10477
|
-
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
10478
|
-
case 1:
|
|
10479
|
-
_a.sent();
|
|
10480
|
-
return [2 /*return*/, container];
|
|
10481
|
-
}
|
|
10482
|
-
});
|
|
10483
|
-
});
|
|
10361
|
+
PivotModel.prototype.isSupportSoftUpdateContent = function () {
|
|
10362
|
+
return false;
|
|
10484
10363
|
};
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
return
|
|
10488
|
-
}(
|
|
10364
|
+
PivotModel.IntervalsCount = 10;
|
|
10365
|
+
PivotModel.UseIntervalsFrom = 10;
|
|
10366
|
+
return PivotModel;
|
|
10367
|
+
}(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
|
|
10489
10368
|
|
|
10490
|
-
|
|
10491
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.registerVisualizer("rating", GaugePlotly);
|
|
10492
|
-
_visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.registerVisualizer("expression", GaugePlotly);
|
|
10369
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_6__.VisualizationManager.registerPivotVisualizer(PivotModel);
|
|
10493
10370
|
|
|
10494
10371
|
|
|
10495
10372
|
/***/ }),
|
|
10496
10373
|
|
|
10497
|
-
/***/ "./src/plotly/
|
|
10498
|
-
|
|
10499
|
-
!*** ./src/plotly/
|
|
10500
|
-
|
|
10374
|
+
/***/ "./src/plotly/chart-adapter.ts":
|
|
10375
|
+
/*!*************************************!*\
|
|
10376
|
+
!*** ./src/plotly/chart-adapter.ts ***!
|
|
10377
|
+
\*************************************/
|
|
10501
10378
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10502
10379
|
|
|
10503
10380
|
"use strict";
|
|
10504
10381
|
__webpack_require__.r(__webpack_exports__);
|
|
10505
10382
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10506
|
-
/* harmony export */ PlotlyChartAdapter: () => (/* binding */ PlotlyChartAdapter)
|
|
10507
|
-
/* harmony export */ SelectBasePlotly: () => (/* binding */ SelectBasePlotly)
|
|
10383
|
+
/* harmony export */ PlotlyChartAdapter: () => (/* binding */ PlotlyChartAdapter)
|
|
10508
10384
|
/* harmony export */ });
|
|
10509
10385
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10510
10386
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
10511
10387
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
10512
10388
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../selectBase */ "./src/selectBase.ts");
|
|
10513
|
-
/* harmony import */ var
|
|
10514
|
-
/* harmony import */ var
|
|
10515
|
-
/* harmony import */ var
|
|
10516
|
-
/* harmony import */ var
|
|
10517
|
-
/* harmony import */ var
|
|
10518
|
-
/* harmony import */ var
|
|
10389
|
+
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../localizationManager */ "./src/localizationManager.ts");
|
|
10390
|
+
/* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! plotly.js-dist-min */ "plotly.js-dist-min");
|
|
10391
|
+
/* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4__);
|
|
10392
|
+
/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
|
|
10393
|
+
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../visualizerBase */ "./src/visualizerBase.ts");
|
|
10394
|
+
/* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../boolean */ "./src/boolean.ts");
|
|
10395
|
+
/* harmony import */ var _legacy__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./legacy */ "./src/plotly/legacy.ts");
|
|
10396
|
+
|
|
10519
10397
|
|
|
10520
10398
|
|
|
10521
10399
|
|
|
@@ -10529,7 +10407,32 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10529
10407
|
this.model = model;
|
|
10530
10408
|
this._chart = undefined;
|
|
10531
10409
|
}
|
|
10532
|
-
PlotlyChartAdapter.prototype.patchConfigParameters = function (chartNode, traces, layout, config) {
|
|
10410
|
+
PlotlyChartAdapter.prototype.patchConfigParameters = function (chartNode, traces, layout, config) {
|
|
10411
|
+
if (this.model.question.getType() === "boolean") {
|
|
10412
|
+
var colors = this.model.getColors();
|
|
10413
|
+
var boolColors_1 = [
|
|
10414
|
+
_boolean__WEBPACK_IMPORTED_MODULE_7__.BooleanModel.trueColor || colors[0],
|
|
10415
|
+
_boolean__WEBPACK_IMPORTED_MODULE_7__.BooleanModel.falseColor || colors[1],
|
|
10416
|
+
];
|
|
10417
|
+
if (this.model.showMissingAnswers) {
|
|
10418
|
+
boolColors_1.push(colors[2]);
|
|
10419
|
+
}
|
|
10420
|
+
var chartType = this.model.chartType;
|
|
10421
|
+
if (chartType === "pie" || chartType === "doughnut") {
|
|
10422
|
+
traces.forEach(function (trace) {
|
|
10423
|
+
trace.marker.colors = boolColors_1;
|
|
10424
|
+
});
|
|
10425
|
+
}
|
|
10426
|
+
else if (chartType === "bar") {
|
|
10427
|
+
traces.forEach(function (trace) {
|
|
10428
|
+
trace.marker.color = boolColors_1;
|
|
10429
|
+
});
|
|
10430
|
+
}
|
|
10431
|
+
}
|
|
10432
|
+
if (this.model.type === "number") {
|
|
10433
|
+
config.displayModeBar = true;
|
|
10434
|
+
}
|
|
10435
|
+
};
|
|
10533
10436
|
Object.defineProperty(PlotlyChartAdapter.prototype, "chart", {
|
|
10534
10437
|
get: function () {
|
|
10535
10438
|
return this._chart;
|
|
@@ -10537,45 +10440,73 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10537
10440
|
enumerable: false,
|
|
10538
10441
|
configurable: true
|
|
10539
10442
|
});
|
|
10443
|
+
PlotlyChartAdapter.prototype.getChartTypes = function () {
|
|
10444
|
+
var visualizerType = this.model.type;
|
|
10445
|
+
if (visualizerType === "boolean") {
|
|
10446
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.BooleanPlotly.types;
|
|
10447
|
+
}
|
|
10448
|
+
else if (visualizerType === "number") {
|
|
10449
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.GaugePlotly.types;
|
|
10450
|
+
}
|
|
10451
|
+
else if (visualizerType === "selectBase") {
|
|
10452
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.SelectBasePlotly.types;
|
|
10453
|
+
}
|
|
10454
|
+
else if (visualizerType === "histogram") {
|
|
10455
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.HistogramPlotly.types;
|
|
10456
|
+
}
|
|
10457
|
+
else if (visualizerType === "matrix") {
|
|
10458
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.MatrixPlotly.types;
|
|
10459
|
+
}
|
|
10460
|
+
else if (visualizerType === "matrixDropdownGrouped") {
|
|
10461
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.MatrixDropdownGroupedPlotly.types;
|
|
10462
|
+
}
|
|
10463
|
+
else if (visualizerType === "pivot") {
|
|
10464
|
+
return _legacy__WEBPACK_IMPORTED_MODULE_8__.PivotPlotly.types;
|
|
10465
|
+
}
|
|
10466
|
+
return [];
|
|
10467
|
+
};
|
|
10540
10468
|
PlotlyChartAdapter.prototype.create = function (chartNode) {
|
|
10541
10469
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10542
|
-
var _a, plot, plotlyOptions, getDragLayer;
|
|
10470
|
+
var _a, plot, plotlyOptions, _model_1, getDragLayer;
|
|
10543
10471
|
var _this = this;
|
|
10544
10472
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
|
|
10545
10473
|
switch (_b.label) {
|
|
10546
10474
|
case 0: return [4 /*yield*/, this.update(chartNode)];
|
|
10547
10475
|
case 1:
|
|
10548
10476
|
_a = _b.sent(), plot = _a[0], plotlyOptions = _a[1];
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
var
|
|
10553
|
-
if (
|
|
10554
|
-
itemText =
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10477
|
+
if (this.model instanceof _selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase) {
|
|
10478
|
+
_model_1 = this.model;
|
|
10479
|
+
chartNode["on"]("plotly_click", function (data) {
|
|
10480
|
+
var _a;
|
|
10481
|
+
if (data.points.length > 0) {
|
|
10482
|
+
var itemText = "";
|
|
10483
|
+
if (!plotlyOptions.hasSeries) {
|
|
10484
|
+
itemText = Array.isArray(data.points[0].customdata)
|
|
10485
|
+
? data.points[0].customdata[0]
|
|
10486
|
+
: data.points[0].customdata;
|
|
10487
|
+
var item = _model_1.getSelectedItemByText(itemText);
|
|
10488
|
+
_model_1.setSelection(item);
|
|
10489
|
+
}
|
|
10490
|
+
else {
|
|
10491
|
+
itemText = data.points[0].data.name;
|
|
10492
|
+
var propertyLabel = data.points[0].label;
|
|
10493
|
+
var seriesValues = _this.model.getSeriesValues();
|
|
10494
|
+
var seriesLabels = _this.model.getSeriesLabels();
|
|
10495
|
+
var propertyValue = seriesValues[seriesLabels.indexOf(propertyLabel)];
|
|
10496
|
+
var selectedItem = _model_1.getSelectedItemByText(itemText);
|
|
10497
|
+
var item = new survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue((_a = {}, _a[propertyValue] = selectedItem.value, _a), propertyLabel + ": " + selectedItem.text);
|
|
10498
|
+
_model_1.setSelection(item);
|
|
10499
|
+
}
|
|
10500
|
+
// const itemText = plotlyOptions.hasSeries
|
|
10501
|
+
// ? data.points[0].data.name
|
|
10502
|
+
// : Array.isArray(data.points[0].customdata)
|
|
10503
|
+
// ? data.points[0].customdata[0]
|
|
10504
|
+
// : data.points[0].customdata;
|
|
10505
|
+
// const item: ItemValue = this.model.getSelectedItemByText(itemText);
|
|
10506
|
+
// this.model.setSelection(item);
|
|
10569
10507
|
}
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
// : Array.isArray(data.points[0].customdata)
|
|
10573
|
-
// ? data.points[0].customdata[0]
|
|
10574
|
-
// : data.points[0].customdata;
|
|
10575
|
-
// const item: ItemValue = this.model.getSelectedItemByText(itemText);
|
|
10576
|
-
// this.model.setSelection(item);
|
|
10577
|
-
}
|
|
10578
|
-
});
|
|
10508
|
+
});
|
|
10509
|
+
}
|
|
10579
10510
|
getDragLayer = function () {
|
|
10580
10511
|
return chartNode.getElementsByClassName("nsewdrag")[0];
|
|
10581
10512
|
};
|
|
@@ -10596,39 +10527,48 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10596
10527
|
};
|
|
10597
10528
|
PlotlyChartAdapter.prototype.update = function (chartNode) {
|
|
10598
10529
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10599
|
-
var answersData, plotlyOptions, config, options, plot;
|
|
10530
|
+
var answersData, _a, plotlyOptions, config, options, plot;
|
|
10600
10531
|
var _this = this;
|
|
10601
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (
|
|
10602
|
-
switch (
|
|
10603
|
-
case 0:
|
|
10532
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
|
|
10533
|
+
switch (_b.label) {
|
|
10534
|
+
case 0:
|
|
10535
|
+
if (!(this.model instanceof _selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase)) return [3 /*break*/, 2];
|
|
10536
|
+
return [4 /*yield*/, this.model.getAnswersData()];
|
|
10604
10537
|
case 1:
|
|
10605
|
-
|
|
10606
|
-
|
|
10538
|
+
_a = _b.sent();
|
|
10539
|
+
return [3 /*break*/, 4];
|
|
10540
|
+
case 2: return [4 /*yield*/, this.model.getCalculatedValues()];
|
|
10541
|
+
case 3:
|
|
10542
|
+
_a = _b.sent();
|
|
10543
|
+
_b.label = 4;
|
|
10544
|
+
case 4:
|
|
10545
|
+
answersData = _a;
|
|
10546
|
+
plotlyOptions = _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.setup(this.model.chartType, this.model, answersData);
|
|
10607
10547
|
config = {
|
|
10608
10548
|
displaylogo: false,
|
|
10609
10549
|
responsive: true,
|
|
10610
|
-
locale:
|
|
10550
|
+
locale: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.currentLocale,
|
|
10611
10551
|
modeBarButtonsToRemove: ["toImage"],
|
|
10612
10552
|
modeBarButtonsToAdd: [
|
|
10613
10553
|
{
|
|
10614
10554
|
name: "toImageSjs",
|
|
10615
|
-
title:
|
|
10616
|
-
icon: (
|
|
10555
|
+
title: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.getString("saveDiagramAsPNG"),
|
|
10556
|
+
icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().Icons).camera,
|
|
10617
10557
|
click: function (gd) {
|
|
10618
10558
|
var options = {
|
|
10619
|
-
format:
|
|
10559
|
+
format: _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.imageExportFormat,
|
|
10620
10560
|
// width: 800,
|
|
10621
10561
|
// height: 600,
|
|
10622
10562
|
filename: _this.model.question.name,
|
|
10623
10563
|
};
|
|
10624
|
-
|
|
10625
|
-
|
|
10564
|
+
_setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onImageSaving.fire(_this.model, options);
|
|
10565
|
+
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().downloadImage(gd, options);
|
|
10626
10566
|
},
|
|
10627
10567
|
},
|
|
10628
10568
|
],
|
|
10629
10569
|
};
|
|
10630
|
-
if (SelectBasePlotly.displayModeBar !== undefined) {
|
|
10631
|
-
config.displayModeBar = SelectBasePlotly.displayModeBar;
|
|
10570
|
+
if (_legacy__WEBPACK_IMPORTED_MODULE_8__.SelectBasePlotly.displayModeBar !== undefined) {
|
|
10571
|
+
config.displayModeBar = _legacy__WEBPACK_IMPORTED_MODULE_8__.SelectBasePlotly.displayModeBar;
|
|
10632
10572
|
}
|
|
10633
10573
|
this.patchConfigParameters(chartNode, plotlyOptions.traces, plotlyOptions.layout, config);
|
|
10634
10574
|
options = {
|
|
@@ -10636,8 +10576,8 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10636
10576
|
layout: plotlyOptions.layout,
|
|
10637
10577
|
config: config,
|
|
10638
10578
|
};
|
|
10639
|
-
|
|
10640
|
-
plot =
|
|
10579
|
+
_setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onPlotCreating.fire(this.model, options);
|
|
10580
|
+
plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().react(chartNode, options.traces, options.layout, options.config);
|
|
10641
10581
|
return [2 /*return*/, [plot, plotlyOptions]];
|
|
10642
10582
|
}
|
|
10643
10583
|
});
|
|
@@ -10645,84 +10585,157 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10645
10585
|
};
|
|
10646
10586
|
PlotlyChartAdapter.prototype.destroy = function (node) {
|
|
10647
10587
|
if (!!node) {
|
|
10648
|
-
|
|
10588
|
+
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().purge(node);
|
|
10649
10589
|
}
|
|
10650
10590
|
this._chart = undefined;
|
|
10651
10591
|
};
|
|
10652
10592
|
return PlotlyChartAdapter;
|
|
10653
10593
|
}());
|
|
10654
10594
|
|
|
10595
|
+
_visualizerBase__WEBPACK_IMPORTED_MODULE_6__.VisualizerBase.chartAdapterType = PlotlyChartAdapter;
|
|
10596
|
+
|
|
10597
|
+
|
|
10598
|
+
/***/ }),
|
|
10599
|
+
|
|
10600
|
+
/***/ "./src/plotly/index.ts":
|
|
10601
|
+
/*!*****************************!*\
|
|
10602
|
+
!*** ./src/plotly/index.ts ***!
|
|
10603
|
+
\*****************************/
|
|
10604
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10605
|
+
|
|
10606
|
+
"use strict";
|
|
10607
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10608
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10609
|
+
/* harmony export */ BooleanPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.BooleanPlotly),
|
|
10610
|
+
/* harmony export */ GaugePlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.GaugePlotly),
|
|
10611
|
+
/* harmony export */ HistogramPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.HistogramPlotly),
|
|
10612
|
+
/* harmony export */ MatrixDropdownGroupedPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.MatrixDropdownGroupedPlotly),
|
|
10613
|
+
/* harmony export */ MatrixPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.MatrixPlotly),
|
|
10614
|
+
/* harmony export */ PivotPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.PivotPlotly),
|
|
10615
|
+
/* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _chart_adapter__WEBPACK_IMPORTED_MODULE_1__.PlotlyChartAdapter),
|
|
10616
|
+
/* harmony export */ PlotlySetup: () => (/* reexport safe */ _setup__WEBPACK_IMPORTED_MODULE_0__.PlotlySetup),
|
|
10617
|
+
/* harmony export */ RankingPlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.RankingPlotly),
|
|
10618
|
+
/* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _legacy__WEBPACK_IMPORTED_MODULE_2__.SelectBasePlotly)
|
|
10619
|
+
/* harmony export */ });
|
|
10620
|
+
/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
|
|
10621
|
+
/* harmony import */ var _chart_adapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chart-adapter */ "./src/plotly/chart-adapter.ts");
|
|
10622
|
+
/* harmony import */ var _legacy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./legacy */ "./src/plotly/legacy.ts");
|
|
10623
|
+
|
|
10624
|
+
|
|
10625
|
+
|
|
10626
|
+
|
|
10627
|
+
|
|
10628
|
+
/***/ }),
|
|
10629
|
+
|
|
10630
|
+
/***/ "./src/plotly/legacy.ts":
|
|
10631
|
+
/*!******************************!*\
|
|
10632
|
+
!*** ./src/plotly/legacy.ts ***!
|
|
10633
|
+
\******************************/
|
|
10634
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10635
|
+
|
|
10636
|
+
"use strict";
|
|
10637
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10638
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10639
|
+
/* harmony export */ BooleanPlotly: () => (/* binding */ BooleanPlotly),
|
|
10640
|
+
/* harmony export */ GaugePlotly: () => (/* binding */ GaugePlotly),
|
|
10641
|
+
/* harmony export */ HistogramPlotly: () => (/* binding */ HistogramPlotly),
|
|
10642
|
+
/* harmony export */ MatrixDropdownGroupedPlotly: () => (/* binding */ MatrixDropdownGroupedPlotly),
|
|
10643
|
+
/* harmony export */ MatrixPlotly: () => (/* binding */ MatrixPlotly),
|
|
10644
|
+
/* harmony export */ PivotPlotly: () => (/* binding */ PivotPlotly),
|
|
10645
|
+
/* harmony export */ RankingPlotly: () => (/* binding */ RankingPlotly),
|
|
10646
|
+
/* harmony export */ SelectBasePlotly: () => (/* binding */ SelectBasePlotly)
|
|
10647
|
+
/* harmony export */ });
|
|
10648
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
10649
|
+
/* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../boolean */ "./src/boolean.ts");
|
|
10650
|
+
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../selectBase */ "./src/selectBase.ts");
|
|
10651
|
+
/* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../histogram */ "./src/histogram.ts");
|
|
10652
|
+
/* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../matrix */ "./src/matrix.ts");
|
|
10653
|
+
/* harmony import */ var _matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../matrixDropdownGrouped */ "./src/matrixDropdownGrouped.ts");
|
|
10654
|
+
/* harmony import */ var _pivot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../pivot */ "./src/pivot.ts");
|
|
10655
|
+
/* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../number */ "./src/number.ts");
|
|
10656
|
+
/* harmony import */ var _ranking__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../ranking */ "./src/ranking.ts");
|
|
10657
|
+
|
|
10658
|
+
|
|
10659
|
+
|
|
10660
|
+
|
|
10661
|
+
|
|
10662
|
+
|
|
10663
|
+
|
|
10664
|
+
|
|
10665
|
+
|
|
10655
10666
|
var SelectBasePlotly = /** @class */ (function (_super) {
|
|
10656
10667
|
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(SelectBasePlotly, _super);
|
|
10657
|
-
function SelectBasePlotly(
|
|
10658
|
-
|
|
10659
|
-
var _this = _super.call(this, question, data, options, name) || this;
|
|
10660
|
-
_this.chartTypes = [].concat(SelectBasePlotly.types);
|
|
10661
|
-
if (_this.getSeriesValues().length > 0 && _this.chartTypes.indexOf("stackedbar") === -1) {
|
|
10662
|
-
_this.chartTypes.push("stackedbar");
|
|
10663
|
-
}
|
|
10664
|
-
if (options.allowExperimentalFeatures) {
|
|
10665
|
-
// this.chartTypes.splice(1, 0, "vbar");
|
|
10666
|
-
}
|
|
10667
|
-
_this._chartType = _this.chartTypes[0];
|
|
10668
|
-
if (_this.chartTypes.indexOf(options.defaultChartType) !== -1) {
|
|
10669
|
-
_this._chartType = options.defaultChartType;
|
|
10670
|
-
}
|
|
10671
|
-
_this._chartAdapter = new PlotlyChartAdapter(_this);
|
|
10672
|
-
return _this;
|
|
10668
|
+
function SelectBasePlotly() {
|
|
10669
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10673
10670
|
}
|
|
10674
|
-
SelectBasePlotly.prototype.destroyContent = function (container) {
|
|
10675
|
-
this._chartAdapter.destroy(container.children[0]);
|
|
10676
|
-
_super.prototype.destroyContent.call(this, container);
|
|
10677
|
-
};
|
|
10678
|
-
SelectBasePlotly.prototype.renderContentAsync = function (container) {
|
|
10679
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10680
|
-
var chartNode;
|
|
10681
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
10682
|
-
switch (_a.label) {
|
|
10683
|
-
case 0:
|
|
10684
|
-
chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
|
|
10685
|
-
container.innerHTML = "";
|
|
10686
|
-
container.appendChild(chartNode);
|
|
10687
|
-
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
10688
|
-
case 1:
|
|
10689
|
-
_a.sent();
|
|
10690
|
-
return [2 /*return*/, container];
|
|
10691
|
-
}
|
|
10692
|
-
});
|
|
10693
|
-
});
|
|
10694
|
-
};
|
|
10695
|
-
SelectBasePlotly.prototype.updateContent = function () {
|
|
10696
|
-
var _a;
|
|
10697
|
-
var chartNode = (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.children[0];
|
|
10698
|
-
if (chartNode) {
|
|
10699
|
-
this._chartAdapter.update(chartNode);
|
|
10700
|
-
}
|
|
10701
|
-
};
|
|
10702
|
-
SelectBasePlotly.prototype.getCalculatedValuesCore = function () {
|
|
10703
|
-
var statistics = _super.prototype.getCalculatedValuesCore.call(this);
|
|
10704
|
-
var series = this.getSeriesValues();
|
|
10705
|
-
var values = this.getValues();
|
|
10706
|
-
if (series.length > 1) {
|
|
10707
|
-
var preparedData_1 = [];
|
|
10708
|
-
values.forEach(function (val, valueIndex) {
|
|
10709
|
-
var seriesData = series.map(function (seriesValue, seriesIndex) { return statistics[seriesIndex][valueIndex]; });
|
|
10710
|
-
preparedData_1.push(seriesData);
|
|
10711
|
-
});
|
|
10712
|
-
return preparedData_1;
|
|
10713
|
-
}
|
|
10714
|
-
return statistics;
|
|
10715
|
-
};
|
|
10716
10671
|
SelectBasePlotly.types = ["bar", "vbar", "pie", "doughnut"];
|
|
10717
10672
|
SelectBasePlotly.displayModeBar = undefined;
|
|
10718
10673
|
return SelectBasePlotly;
|
|
10719
10674
|
}(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
|
|
10720
10675
|
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10676
|
+
var BooleanPlotly = /** @class */ (function (_super) {
|
|
10677
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BooleanPlotly, _super);
|
|
10678
|
+
function BooleanPlotly() {
|
|
10679
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10680
|
+
}
|
|
10681
|
+
BooleanPlotly.types = ["pie", "bar", "doughnut"];
|
|
10682
|
+
return BooleanPlotly;
|
|
10683
|
+
}(_boolean__WEBPACK_IMPORTED_MODULE_1__.BooleanModel));
|
|
10684
|
+
|
|
10685
|
+
var HistogramPlotly = /** @class */ (function (_super) {
|
|
10686
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(HistogramPlotly, _super);
|
|
10687
|
+
function HistogramPlotly() {
|
|
10688
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10689
|
+
}
|
|
10690
|
+
HistogramPlotly.types = ["vbar", "bar"];
|
|
10691
|
+
return HistogramPlotly;
|
|
10692
|
+
}(_histogram__WEBPACK_IMPORTED_MODULE_3__.HistogramModel));
|
|
10693
|
+
|
|
10694
|
+
var MatrixPlotly = /** @class */ (function (_super) {
|
|
10695
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixPlotly, _super);
|
|
10696
|
+
function MatrixPlotly() {
|
|
10697
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10698
|
+
}
|
|
10699
|
+
MatrixPlotly.types = ["bar", "stackedbar", "pie", "doughnut"];
|
|
10700
|
+
return MatrixPlotly;
|
|
10701
|
+
}(_matrix__WEBPACK_IMPORTED_MODULE_4__.Matrix));
|
|
10702
|
+
|
|
10703
|
+
var MatrixDropdownGroupedPlotly = /** @class */ (function (_super) {
|
|
10704
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixDropdownGroupedPlotly, _super);
|
|
10705
|
+
function MatrixDropdownGroupedPlotly() {
|
|
10706
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10707
|
+
}
|
|
10708
|
+
MatrixDropdownGroupedPlotly.types = ["stackedbar", "bar", "pie", "doughnut"];
|
|
10709
|
+
return MatrixDropdownGroupedPlotly;
|
|
10710
|
+
}(_matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_5__.MatrixDropdownGrouped));
|
|
10711
|
+
|
|
10712
|
+
var PivotPlotly = /** @class */ (function (_super) {
|
|
10713
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PivotPlotly, _super);
|
|
10714
|
+
function PivotPlotly() {
|
|
10715
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10716
|
+
}
|
|
10717
|
+
PivotPlotly.types = ["vbar", "bar", "line", "stackedbar", "pie", "doughnut"]; // ["vbar", "bar"];
|
|
10718
|
+
return PivotPlotly;
|
|
10719
|
+
}(_pivot__WEBPACK_IMPORTED_MODULE_6__.PivotModel));
|
|
10720
|
+
|
|
10721
|
+
var GaugePlotly = /** @class */ (function (_super) {
|
|
10722
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(GaugePlotly, _super);
|
|
10723
|
+
function GaugePlotly() {
|
|
10724
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10725
|
+
}
|
|
10726
|
+
GaugePlotly.displayModeBar = undefined;
|
|
10727
|
+
GaugePlotly.types = ["gauge", "bullet"];
|
|
10728
|
+
return GaugePlotly;
|
|
10729
|
+
}(_number__WEBPACK_IMPORTED_MODULE_7__.NumberModel));
|
|
10730
|
+
|
|
10731
|
+
var RankingPlotly = /** @class */ (function (_super) {
|
|
10732
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(RankingPlotly, _super);
|
|
10733
|
+
function RankingPlotly() {
|
|
10734
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
10735
|
+
}
|
|
10736
|
+
return RankingPlotly;
|
|
10737
|
+
}(_ranking__WEBPACK_IMPORTED_MODULE_8__.RankingModel));
|
|
10738
|
+
|
|
10726
10739
|
|
|
10727
10740
|
|
|
10728
10741
|
/***/ }),
|
|
@@ -10741,6 +10754,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10741
10754
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
10742
10755
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
10743
10756
|
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../localizationManager */ "./src/localizationManager.ts");
|
|
10757
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
|
|
10758
|
+
/* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../number */ "./src/number.ts");
|
|
10759
|
+
|
|
10760
|
+
|
|
10744
10761
|
|
|
10745
10762
|
|
|
10746
10763
|
var PlotlySetup = /** @class */ (function () {
|
|
@@ -10751,38 +10768,44 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10751
10768
|
};
|
|
10752
10769
|
PlotlySetup.setupPie = function (model, answersData) {
|
|
10753
10770
|
var datasets = answersData.datasets, labels = answersData.labels, colors = answersData.colors, texts = answersData.texts, seriesLabels = answersData.seriesLabels;
|
|
10754
|
-
var traces = [];
|
|
10755
10771
|
var hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
10772
|
+
var layoutColumns = 2;
|
|
10773
|
+
var traces = [];
|
|
10756
10774
|
var traceConfig = {
|
|
10757
10775
|
type: model.chartType,
|
|
10758
|
-
|
|
10759
|
-
|
|
10776
|
+
labels: labels,
|
|
10777
|
+
customdata: labels,
|
|
10778
|
+
text: labels.map(function (label) {
|
|
10760
10779
|
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength);
|
|
10761
10780
|
}),
|
|
10762
|
-
hoverinfo: "
|
|
10763
|
-
|
|
10764
|
-
marker: {},
|
|
10781
|
+
hoverinfo: "label+value+percent",
|
|
10782
|
+
textposition: "inside",
|
|
10765
10783
|
};
|
|
10766
|
-
traceConfig.hoverinfo = "label+value+percent";
|
|
10767
|
-
traceConfig.marker.colors = colors;
|
|
10768
|
-
traceConfig.textposition = "inside";
|
|
10769
10784
|
if (model.chartType === "doughnut") {
|
|
10770
10785
|
traceConfig.type = "pie";
|
|
10771
10786
|
traceConfig.hole = 0.4;
|
|
10772
10787
|
}
|
|
10773
10788
|
if (!hasSeries) {
|
|
10789
|
+
traceConfig.mode = "markers",
|
|
10790
|
+
traceConfig.marker = { color: colors };
|
|
10774
10791
|
traceConfig.marker.symbol = "circle";
|
|
10775
10792
|
traceConfig.marker.size = 16;
|
|
10776
10793
|
}
|
|
10777
10794
|
datasets.forEach(function (dataset, index) {
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10795
|
+
var isNotEmpty = dataset.some(function (value) { return value != 0; });
|
|
10796
|
+
if (isNotEmpty) {
|
|
10797
|
+
traces.push(Object.assign({}, traceConfig, {
|
|
10798
|
+
values: dataset,
|
|
10799
|
+
domain: {
|
|
10800
|
+
column: traces.length % layoutColumns,
|
|
10801
|
+
row: Math.floor(traces.length / layoutColumns),
|
|
10802
|
+
},
|
|
10803
|
+
title: { position: "bottom center", text: seriesLabels[index] }
|
|
10804
|
+
}));
|
|
10805
|
+
}
|
|
10783
10806
|
});
|
|
10784
10807
|
var radius = labels.length < 10 ? labels.length * 50 + 100 : 550;
|
|
10785
|
-
var height = radius * Math.
|
|
10808
|
+
var height = (radius + 25) * Math.ceil(traces.length / layoutColumns);
|
|
10786
10809
|
var layout = {
|
|
10787
10810
|
font: {
|
|
10788
10811
|
family: "Segoe UI, sans-serif",
|
|
@@ -10805,21 +10828,7 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10805
10828
|
};
|
|
10806
10829
|
if (hasSeries) {
|
|
10807
10830
|
layout.annotations = [];
|
|
10808
|
-
|
|
10809
|
-
traces[index].title = { position: "bottom center", text: label };
|
|
10810
|
-
});
|
|
10811
|
-
traces = traces.filter(function (t) { return !(t.values.length === 1 && t.values[0] === 0); });
|
|
10812
|
-
traces.forEach(function (label, index) {
|
|
10813
|
-
traces[index].domain = {
|
|
10814
|
-
column: index % 2,
|
|
10815
|
-
row: Math.floor(index / 2),
|
|
10816
|
-
};
|
|
10817
|
-
});
|
|
10818
|
-
layout.grid = {
|
|
10819
|
-
rows: Math.round(traces.length / 2),
|
|
10820
|
-
columns: 2,
|
|
10821
|
-
};
|
|
10822
|
-
layout.height = radius * Math.round(traces.length / 2) + 25;
|
|
10831
|
+
layout.grid = { rows: Math.ceil(traces.length / layoutColumns), columns: layoutColumns };
|
|
10823
10832
|
}
|
|
10824
10833
|
return { traces: traces, layout: layout, hasSeries: hasSeries };
|
|
10825
10834
|
};
|
|
@@ -10828,36 +10837,45 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10828
10837
|
var topMargin = 30;
|
|
10829
10838
|
var bottomMargin = 30;
|
|
10830
10839
|
var datasets = answersData.datasets, labels = answersData.labels, colors = answersData.colors, texts = answersData.texts, seriesLabels = answersData.seriesLabels;
|
|
10831
|
-
var traces = [];
|
|
10832
10840
|
var hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
10833
|
-
var
|
|
10841
|
+
var traces = [];
|
|
10834
10842
|
var traceConfig = {
|
|
10835
|
-
type: model.chartType,
|
|
10836
|
-
y:
|
|
10837
|
-
|
|
10838
|
-
customdata: hasSeries ? seriesLabels : labels,
|
|
10843
|
+
type: model.chartType === "line" ? "line" : "bar",
|
|
10844
|
+
y: labels,
|
|
10845
|
+
customdata: labels,
|
|
10839
10846
|
hoverinfo: "text",
|
|
10840
10847
|
orientation: "h",
|
|
10841
|
-
mode: "markers",
|
|
10842
10848
|
textposition: "none",
|
|
10843
|
-
width: 0.5,
|
|
10844
|
-
bargap: 0.5,
|
|
10845
|
-
marker: {},
|
|
10846
10849
|
};
|
|
10847
|
-
|
|
10850
|
+
if (!hasSeries) {
|
|
10851
|
+
traceConfig.width = 0.5;
|
|
10852
|
+
traceConfig.bargap = 0.5;
|
|
10853
|
+
traceConfig.mode = "markers",
|
|
10854
|
+
traceConfig.marker = { color: colors };
|
|
10855
|
+
}
|
|
10848
10856
|
datasets.forEach(function (dataset, index) {
|
|
10857
|
+
var traceName = hasSeries ? seriesLabels[index] : labels[index];
|
|
10858
|
+
var percentString = model.showPercentages ? "%" : "";
|
|
10849
10859
|
var trace = Object.assign({}, traceConfig, {
|
|
10850
10860
|
x: dataset,
|
|
10861
|
+
name: traceName,
|
|
10862
|
+
width: hasSeries && model.chartType !== "stackedbar" ? 0.5 / seriesLabels.length : 0.5,
|
|
10851
10863
|
text: texts[index],
|
|
10852
|
-
hovertext:
|
|
10853
|
-
|
|
10864
|
+
hovertext: labels.map(function (label, labelIndex) {
|
|
10865
|
+
if (model.showOnlyPercentages) {
|
|
10866
|
+
return "".concat(texts[index][labelIndex]).concat(percentString);
|
|
10867
|
+
}
|
|
10868
|
+
else {
|
|
10869
|
+
return hasSeries ? "".concat(traceName, " : ").concat(label, ", ").concat(texts[index][labelIndex]).concat(percentString) : "".concat(texts[index][labelIndex]).concat(percentString, ", ").concat(label);
|
|
10870
|
+
}
|
|
10854
10871
|
}),
|
|
10855
10872
|
});
|
|
10856
10873
|
if (model.showPercentages) {
|
|
10857
10874
|
var texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
10858
10875
|
trace.textposition = "inside";
|
|
10859
10876
|
trace.texttemplate = texttemplate;
|
|
10860
|
-
trace.
|
|
10877
|
+
trace.width = hasSeries && model.chartType !== "stackedbar" ? 0.7 / seriesLabels.length : 0.9;
|
|
10878
|
+
trace.bargap = hasSeries && model.chartType !== "stackedbar" ? 0.3 / seriesLabels.length : 0.1;
|
|
10861
10879
|
}
|
|
10862
10880
|
traces.push(trace);
|
|
10863
10881
|
});
|
|
@@ -10877,60 +10895,49 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10877
10895
|
},
|
|
10878
10896
|
colorway: colors,
|
|
10879
10897
|
hovermode: "closest",
|
|
10898
|
+
plot_bgcolor: model.backgroundColor,
|
|
10899
|
+
paper_bgcolor: model.backgroundColor,
|
|
10900
|
+
showlegend: hasSeries,
|
|
10901
|
+
barmode: hasSeries && model.chartType == "stackedbar" ? "stack" : "group",
|
|
10902
|
+
xaxis: {
|
|
10903
|
+
rangemode: "nonnegative",
|
|
10904
|
+
automargin: true,
|
|
10905
|
+
},
|
|
10880
10906
|
yaxis: {
|
|
10881
10907
|
automargin: true,
|
|
10882
10908
|
type: "category",
|
|
10883
10909
|
orientation: "h",
|
|
10884
10910
|
tickmode: "array",
|
|
10885
|
-
tickvals:
|
|
10886
|
-
ticktext:
|
|
10911
|
+
tickvals: labels,
|
|
10912
|
+
ticktext: labels.map(function (label) {
|
|
10887
10913
|
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength) + " ";
|
|
10888
10914
|
}),
|
|
10889
10915
|
},
|
|
10890
|
-
xaxis: {
|
|
10891
|
-
rangemode: "nonnegative",
|
|
10892
|
-
automargin: true,
|
|
10893
|
-
// dtick: 1
|
|
10894
|
-
},
|
|
10895
|
-
plot_bgcolor: model.backgroundColor,
|
|
10896
|
-
paper_bgcolor: model.backgroundColor,
|
|
10897
|
-
showlegend: false,
|
|
10898
10916
|
};
|
|
10899
|
-
if (hasSeries) {
|
|
10900
|
-
layout.
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
(seriesLabels.length + 1) * lineHeight +
|
|
10905
|
-
topMargin +
|
|
10906
|
-
bottomMargin;
|
|
10907
|
-
}
|
|
10908
|
-
else {
|
|
10909
|
-
layout.height =
|
|
10910
|
-
(labels.length + 1) * lineHeight * seriesLabels.length +
|
|
10911
|
-
topMargin +
|
|
10912
|
-
bottomMargin;
|
|
10913
|
-
}
|
|
10914
|
-
labels.forEach(function (label, index) {
|
|
10915
|
-
traces[index].marker.color = undefined;
|
|
10916
|
-
traces[index].name = label;
|
|
10917
|
-
if (model.chartType === "stackedbar") {
|
|
10918
|
-
traces[index].type = "bar";
|
|
10919
|
-
traces[index].width = 0.5;
|
|
10920
|
-
}
|
|
10921
|
-
else {
|
|
10922
|
-
traces[index].width =
|
|
10923
|
-
(model.showPercentages ? 0.7 : 0.5) / traces.length;
|
|
10924
|
-
}
|
|
10925
|
-
});
|
|
10926
|
-
traces.forEach(function (trace, traceIndex) {
|
|
10927
|
-
var percentString = model.showPercentages ? "%" : "";
|
|
10928
|
-
traces[traceIndex].hovertext = [];
|
|
10929
|
-
yFullTexts.forEach(function (yFullText, yFullTextIndex) {
|
|
10930
|
-
traces[traceIndex].hovertext.push("".concat(trace.y[yFullTextIndex], " : ").concat(trace.name, ", ").concat(trace.text[yFullTextIndex]).concat(percentString));
|
|
10931
|
-
});
|
|
10932
|
-
});
|
|
10917
|
+
if (hasSeries && model.chartType !== "stackedbar") {
|
|
10918
|
+
layout.height =
|
|
10919
|
+
(labels.length * seriesLabels.length + 1) * lineHeight +
|
|
10920
|
+
topMargin +
|
|
10921
|
+
bottomMargin;
|
|
10933
10922
|
}
|
|
10923
|
+
// labels.forEach((label, index) => {
|
|
10924
|
+
// traces[index].marker.color = undefined;
|
|
10925
|
+
// traces[index].name = label;
|
|
10926
|
+
// if (model.chartType === "stackedbar") {
|
|
10927
|
+
// traces[index].type = "bar";
|
|
10928
|
+
// traces[index].width = 0.5;
|
|
10929
|
+
// } else {
|
|
10930
|
+
// traces[index].width =
|
|
10931
|
+
// (model.showPercentages ? 0.7 : 0.5) / traces.length;
|
|
10932
|
+
// }
|
|
10933
|
+
// });
|
|
10934
|
+
// traces.forEach((trace, traceIndex) => {
|
|
10935
|
+
// const percentString = model.showPercentages ? "%" : "";
|
|
10936
|
+
// traces[traceIndex].hovertext = [];
|
|
10937
|
+
// yFullTexts.forEach((yFullText, yFullTextIndex) => {
|
|
10938
|
+
// traces[traceIndex].hovertext.push(`${trace.y[yFullTextIndex]} : ${trace.name}, ${trace.text[yFullTextIndex]}${percentString}`);
|
|
10939
|
+
// });
|
|
10940
|
+
// });
|
|
10934
10941
|
if (["ar", "fa"].indexOf(_localizationManager__WEBPACK_IMPORTED_MODULE_1__.localization.currentLocale) !== -1) {
|
|
10935
10942
|
layout.xaxis.autorange = "reversed";
|
|
10936
10943
|
layout.yaxis.side = "right";
|
|
@@ -10947,9 +10954,11 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10947
10954
|
var topMargin = 30;
|
|
10948
10955
|
var bottomMargin = 30;
|
|
10949
10956
|
var datasets = answersData.datasets, labels = answersData.labels, colors = answersData.colors, texts = answersData.texts, seriesLabels = answersData.seriesLabels;
|
|
10950
|
-
|
|
10957
|
+
var hasSeries = seriesLabels.length > 1 || model.question.getType() === "matrix";
|
|
10958
|
+
if (model.type !== "histogram" && model.type !== "pivot") {
|
|
10951
10959
|
labels = [].concat(labels).reverse();
|
|
10952
|
-
|
|
10960
|
+
seriesLabels = [].concat(seriesLabels).reverse();
|
|
10961
|
+
colors = [].concat(colors.slice(0, hasSeries ? seriesLabels.length : labels.length)).reverse();
|
|
10953
10962
|
var ts_1 = [];
|
|
10954
10963
|
texts.forEach(function (text) {
|
|
10955
10964
|
ts_1.push([].concat(text).reverse());
|
|
@@ -10962,7 +10971,37 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10962
10971
|
datasets = ds_1;
|
|
10963
10972
|
}
|
|
10964
10973
|
var traces = [];
|
|
10965
|
-
var
|
|
10974
|
+
var traceConfig = {
|
|
10975
|
+
type: model.chartType === "line" ? "line" : "bar",
|
|
10976
|
+
x: labels,
|
|
10977
|
+
customdata: hasSeries ? seriesLabels : labels,
|
|
10978
|
+
hoverinfo: hasSeries ? undefined : "x+y",
|
|
10979
|
+
orientation: "v",
|
|
10980
|
+
textposition: "none",
|
|
10981
|
+
};
|
|
10982
|
+
if (model.type === "histogram" || !hasSeries) {
|
|
10983
|
+
traceConfig.width = 0.5;
|
|
10984
|
+
traceConfig.bargap = 0.5;
|
|
10985
|
+
traceConfig.mode = "markers",
|
|
10986
|
+
traceConfig.marker = { color: colors };
|
|
10987
|
+
}
|
|
10988
|
+
datasets.forEach(function (dataset, index) {
|
|
10989
|
+
var trace = Object.assign({}, traceConfig, {
|
|
10990
|
+
y: dataset,
|
|
10991
|
+
name: hasSeries ? seriesLabels[index] : labels[index],
|
|
10992
|
+
text: texts[index],
|
|
10993
|
+
});
|
|
10994
|
+
if (model.showPercentages) {
|
|
10995
|
+
var texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
10996
|
+
trace.textposition = "inside";
|
|
10997
|
+
trace.texttemplate = texttemplate;
|
|
10998
|
+
if (!hasSeries) {
|
|
10999
|
+
trace.width = 0.9;
|
|
11000
|
+
trace.bargap = 0.1;
|
|
11001
|
+
}
|
|
11002
|
+
}
|
|
11003
|
+
traces.push(trace);
|
|
11004
|
+
});
|
|
10966
11005
|
var layout = {
|
|
10967
11006
|
font: {
|
|
10968
11007
|
family: "Segoe UI, sans-serif",
|
|
@@ -10979,34 +11018,21 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
10979
11018
|
hovermode: "closest",
|
|
10980
11019
|
plot_bgcolor: model.backgroundColor,
|
|
10981
11020
|
paper_bgcolor: model.backgroundColor,
|
|
10982
|
-
showlegend:
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
11021
|
+
showlegend: hasSeries,
|
|
11022
|
+
yaxis: {
|
|
11023
|
+
rangemode: "nonnegative",
|
|
11024
|
+
automargin: true,
|
|
11025
|
+
},
|
|
11026
|
+
xaxis: {
|
|
11027
|
+
automargin: true,
|
|
11028
|
+
type: "category",
|
|
11029
|
+
tickmode: "array",
|
|
11030
|
+
tickvals: labels,
|
|
11031
|
+
ticktext: labels.map(function (label) {
|
|
11032
|
+
return PlotlySetup.getTruncatedLabel(label, model.labelTruncateLength) + " ";
|
|
11033
|
+
}),
|
|
11034
|
+
},
|
|
10993
11035
|
};
|
|
10994
|
-
traceConfig.marker.color = colors;
|
|
10995
|
-
datasets.forEach(function (dataset, index) {
|
|
10996
|
-
var trace = Object.assign({}, traceConfig, {
|
|
10997
|
-
x: labels,
|
|
10998
|
-
y: model.showPercentages ? texts[index].map(function (y) { return y / 100; }) : dataset,
|
|
10999
|
-
text: texts[index],
|
|
11000
|
-
});
|
|
11001
|
-
if (model.showPercentages) {
|
|
11002
|
-
var texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
11003
|
-
trace.textposition = "inside";
|
|
11004
|
-
trace.texttemplate = texttemplate;
|
|
11005
|
-
trace.width = 0.9;
|
|
11006
|
-
trace.bargap = 0.1;
|
|
11007
|
-
}
|
|
11008
|
-
traces.push(trace);
|
|
11009
|
-
});
|
|
11010
11036
|
if (model.showPercentages && model.showOnlyPercentages) {
|
|
11011
11037
|
layout.yaxis = {
|
|
11012
11038
|
automargin: true,
|
|
@@ -11097,6 +11123,49 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
11097
11123
|
}
|
|
11098
11124
|
return { traces: traces, layout: layout, hasSeries: hasSeries };
|
|
11099
11125
|
};
|
|
11126
|
+
PlotlySetup.setupGauge = function (model, answersData) {
|
|
11127
|
+
var _a = answersData, level = _a[0], minValue = _a[1], maxValue = _a[2];
|
|
11128
|
+
if (model.question.getType() === "rating") {
|
|
11129
|
+
var rateValues = model.question.visibleRateValues;
|
|
11130
|
+
maxValue = rateValues[rateValues.length - 1].value;
|
|
11131
|
+
minValue = rateValues[0].value;
|
|
11132
|
+
}
|
|
11133
|
+
var colors = model.generateColors(maxValue, minValue, _number__WEBPACK_IMPORTED_MODULE_3__.NumberModel.stepsCount);
|
|
11134
|
+
if (_number__WEBPACK_IMPORTED_MODULE_3__.NumberModel.showAsPercentage) {
|
|
11135
|
+
level = _utils__WEBPACK_IMPORTED_MODULE_2__.DataHelper.toPercentage(level, maxValue);
|
|
11136
|
+
minValue = _utils__WEBPACK_IMPORTED_MODULE_2__.DataHelper.toPercentage(minValue, maxValue);
|
|
11137
|
+
maxValue = _utils__WEBPACK_IMPORTED_MODULE_2__.DataHelper.toPercentage(maxValue, maxValue);
|
|
11138
|
+
}
|
|
11139
|
+
var traces = [
|
|
11140
|
+
{
|
|
11141
|
+
type: "indicator",
|
|
11142
|
+
mode: "gauge+number",
|
|
11143
|
+
gauge: {
|
|
11144
|
+
axis: { range: [minValue, maxValue] },
|
|
11145
|
+
shape: model.chartType,
|
|
11146
|
+
bgcolor: "white",
|
|
11147
|
+
bar: { color: colors[0] },
|
|
11148
|
+
},
|
|
11149
|
+
value: level,
|
|
11150
|
+
text: model.name,
|
|
11151
|
+
domain: { x: [0, 1], y: [0, 1] },
|
|
11152
|
+
},
|
|
11153
|
+
];
|
|
11154
|
+
var chartMargin = model.chartType === "bullet" ? 60 : 30;
|
|
11155
|
+
var layout = {
|
|
11156
|
+
height: 250,
|
|
11157
|
+
margin: {
|
|
11158
|
+
l: chartMargin,
|
|
11159
|
+
r: chartMargin,
|
|
11160
|
+
b: chartMargin,
|
|
11161
|
+
t: chartMargin,
|
|
11162
|
+
pad: 5
|
|
11163
|
+
},
|
|
11164
|
+
plot_bgcolor: model.backgroundColor,
|
|
11165
|
+
paper_bgcolor: model.backgroundColor,
|
|
11166
|
+
};
|
|
11167
|
+
return { traces: traces, layout: layout, hasSeries: false };
|
|
11168
|
+
};
|
|
11100
11169
|
PlotlySetup.imageExportFormat = "png";
|
|
11101
11170
|
/**
|
|
11102
11171
|
* Fires when end user clicks on the 'save as image' button.
|
|
@@ -11115,6 +11184,8 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
11115
11184
|
doughnut: PlotlySetup.setupPie,
|
|
11116
11185
|
pie: PlotlySetup.setupPie,
|
|
11117
11186
|
scatter: PlotlySetup.setupScatter,
|
|
11187
|
+
gauge: PlotlySetup.setupGauge,
|
|
11188
|
+
bullet: PlotlySetup.setupGauge,
|
|
11118
11189
|
};
|
|
11119
11190
|
PlotlySetup.getTruncatedLabel = function (label, labelTruncateLength) {
|
|
11120
11191
|
var truncateSymbols = "...";
|
|
@@ -11132,6 +11203,66 @@ var PlotlySetup = /** @class */ (function () {
|
|
|
11132
11203
|
|
|
11133
11204
|
|
|
11134
11205
|
|
|
11206
|
+
/***/ }),
|
|
11207
|
+
|
|
11208
|
+
/***/ "./src/ranking.ts":
|
|
11209
|
+
/*!************************!*\
|
|
11210
|
+
!*** ./src/ranking.ts ***!
|
|
11211
|
+
\************************/
|
|
11212
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11213
|
+
|
|
11214
|
+
"use strict";
|
|
11215
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11216
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11217
|
+
/* harmony export */ RankingModel: () => (/* binding */ RankingModel)
|
|
11218
|
+
/* harmony export */ });
|
|
11219
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
11220
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
11221
|
+
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
11222
|
+
|
|
11223
|
+
|
|
11224
|
+
|
|
11225
|
+
var RankingModel = /** @class */ (function (_super) {
|
|
11226
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(RankingModel, _super);
|
|
11227
|
+
function RankingModel() {
|
|
11228
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
11229
|
+
}
|
|
11230
|
+
RankingModel.prototype.getQuestionResults = function () {
|
|
11231
|
+
var name = this.question.name;
|
|
11232
|
+
return this.data.map(function (dataItem) { return dataItem[name]; });
|
|
11233
|
+
};
|
|
11234
|
+
RankingModel.prototype.getEmptyData = function () {
|
|
11235
|
+
var choices = this.getValues();
|
|
11236
|
+
var data = [];
|
|
11237
|
+
data.length = choices.length;
|
|
11238
|
+
data.fill(0);
|
|
11239
|
+
return data;
|
|
11240
|
+
};
|
|
11241
|
+
RankingModel.prototype.getCalculatedValuesCore = function () {
|
|
11242
|
+
var _this = this;
|
|
11243
|
+
var results = this.getQuestionResults();
|
|
11244
|
+
var choices = this.getValues();
|
|
11245
|
+
var plotlyData = this.getEmptyData();
|
|
11246
|
+
results.forEach(function (result) {
|
|
11247
|
+
_this.applyResultToPlotlyData(result, plotlyData, choices);
|
|
11248
|
+
});
|
|
11249
|
+
return [plotlyData];
|
|
11250
|
+
};
|
|
11251
|
+
RankingModel.prototype.applyResultToPlotlyData = function (result, plotlyData, choices) {
|
|
11252
|
+
if (!result || !plotlyData || !choices)
|
|
11253
|
+
return;
|
|
11254
|
+
result.forEach(function (resultValue, resultValueIndex, result) {
|
|
11255
|
+
var index = choices.indexOf(resultValue);
|
|
11256
|
+
plotlyData[index] =
|
|
11257
|
+
+plotlyData[index] + (result.length - resultValueIndex);
|
|
11258
|
+
});
|
|
11259
|
+
};
|
|
11260
|
+
return RankingModel;
|
|
11261
|
+
}(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
|
|
11262
|
+
|
|
11263
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("ranking", RankingModel);
|
|
11264
|
+
|
|
11265
|
+
|
|
11135
11266
|
/***/ }),
|
|
11136
11267
|
|
|
11137
11268
|
/***/ "./src/selectBase.ts":
|
|
@@ -11152,6 +11283,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11152
11283
|
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
|
|
11153
11284
|
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
11154
11285
|
/* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/index */ "./src/utils/index.ts");
|
|
11286
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
11287
|
+
|
|
11155
11288
|
|
|
11156
11289
|
|
|
11157
11290
|
|
|
@@ -11182,9 +11315,9 @@ function hideEmptyAnswersInData(answersData) {
|
|
|
11182
11315
|
seriesDataExistence.length = answersData.seriesLabels.length;
|
|
11183
11316
|
var valuesDataExistence = [];
|
|
11184
11317
|
valuesDataExistence.length = answersData.labels.length;
|
|
11185
|
-
for (var
|
|
11186
|
-
for (var
|
|
11187
|
-
if (answersData.datasets[
|
|
11318
|
+
for (var seriesIndex = 0; seriesIndex < answersData.seriesLabels.length; seriesIndex++) {
|
|
11319
|
+
for (var valueIndex = 0; valueIndex < answersData.labels.length; valueIndex++) {
|
|
11320
|
+
if (answersData.datasets[seriesIndex][valueIndex] != 0) {
|
|
11188
11321
|
seriesDataExistence[seriesIndex] = true;
|
|
11189
11322
|
valuesDataExistence[valueIndex] = true;
|
|
11190
11323
|
}
|
|
@@ -11201,14 +11334,14 @@ function hideEmptyAnswersInData(answersData) {
|
|
|
11201
11334
|
result.seriesLabels.push(answersData.seriesLabels[seriesIndex]);
|
|
11202
11335
|
}
|
|
11203
11336
|
}
|
|
11204
|
-
for (var
|
|
11205
|
-
if (
|
|
11337
|
+
for (var seriesIndex = 0; seriesIndex < answersData.datasets.length; seriesIndex++) {
|
|
11338
|
+
if (seriesDataExistence[seriesIndex]) {
|
|
11206
11339
|
var dataset = [];
|
|
11207
11340
|
var texts = [];
|
|
11208
|
-
for (var
|
|
11209
|
-
if (
|
|
11210
|
-
dataset.push(answersData.datasets[
|
|
11211
|
-
texts.push(answersData.texts[
|
|
11341
|
+
for (var valueIndex = 0; valueIndex < answersData.labels.length; valueIndex++) {
|
|
11342
|
+
if (valuesDataExistence[valueIndex]) {
|
|
11343
|
+
dataset.push(answersData.datasets[seriesIndex][valueIndex]);
|
|
11344
|
+
texts.push(answersData.texts[seriesIndex][valueIndex]);
|
|
11212
11345
|
}
|
|
11213
11346
|
}
|
|
11214
11347
|
result.datasets.push(dataset);
|
|
@@ -11246,17 +11379,36 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11246
11379
|
* options fields can be modified
|
|
11247
11380
|
*/
|
|
11248
11381
|
_this.onAnswersDataReady = new survey_core__WEBPACK_IMPORTED_MODULE_1__.Event();
|
|
11249
|
-
question
|
|
11250
|
-
|
|
11251
|
-
|
|
11382
|
+
if (!!question) { // TODO: move somewhere else
|
|
11383
|
+
question.visibleChoicesChangedCallback = function () {
|
|
11384
|
+
_this.dataProvider.raiseDataChanged();
|
|
11385
|
+
};
|
|
11386
|
+
}
|
|
11252
11387
|
_this._showPercentages = _this.options.showPercentages === true;
|
|
11253
11388
|
_this._showOnlyPercentages = _this.options.showOnlyPercentages === true;
|
|
11254
11389
|
if (_this.options.percentagePrecision) {
|
|
11255
11390
|
_this._percentagePrecision = _this.options.percentagePrecision;
|
|
11256
11391
|
}
|
|
11392
|
+
if (_this.options.transposeData !== undefined) {
|
|
11393
|
+
_this._transposeData = _this.options.transposeData;
|
|
11394
|
+
}
|
|
11257
11395
|
_this._hideEmptyAnswers = _this.options.hideEmptyAnswers === true;
|
|
11258
11396
|
_this._answersOrder = _this.options.answersOrder || "default";
|
|
11259
11397
|
_this._showMissingAnswers = _this.isSupportMissingAnswers() && _this.options.showMissingAnswers === true;
|
|
11398
|
+
if (_this.options.allowExperimentalFeatures) {
|
|
11399
|
+
// this.chartTypes.splice(1, 0, "vbar");
|
|
11400
|
+
}
|
|
11401
|
+
if (_visualizerBase__WEBPACK_IMPORTED_MODULE_2__.VisualizerBase.chartAdapterType) {
|
|
11402
|
+
_this._chartAdapter = new _visualizerBase__WEBPACK_IMPORTED_MODULE_2__.VisualizerBase.chartAdapterType(_this);
|
|
11403
|
+
_this.chartTypes = _this._chartAdapter.getChartTypes();
|
|
11404
|
+
if (_this.getSeriesValues().length > 0 && _this.chartTypes.indexOf("stackedbar") === -1) {
|
|
11405
|
+
_this.chartTypes.push("stackedbar");
|
|
11406
|
+
}
|
|
11407
|
+
_this._chartType = _this.chartTypes[0];
|
|
11408
|
+
if (_this.chartTypes.indexOf(_this.options.defaultChartType) !== -1) {
|
|
11409
|
+
_this._chartType = _this.options.defaultChartType;
|
|
11410
|
+
}
|
|
11411
|
+
}
|
|
11260
11412
|
_this.registerToolbarItem("changeChartType", function () {
|
|
11261
11413
|
if (_this.chartTypes.length > 1) {
|
|
11262
11414
|
return _utils_index__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
|
|
@@ -11439,6 +11591,16 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11439
11591
|
var selectBaseQuestion = this.question;
|
|
11440
11592
|
return resultValues.map(function (value) { return survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue.getTextOrHtmlByValue(selectBaseQuestion.choices, value); }).join(", ");
|
|
11441
11593
|
};
|
|
11594
|
+
SelectBase.prototype.isSupportSoftUpdateContent = function () {
|
|
11595
|
+
return true;
|
|
11596
|
+
};
|
|
11597
|
+
SelectBase.prototype.softUpdateContent = function () {
|
|
11598
|
+
var _a;
|
|
11599
|
+
var chartNode = (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.children[0];
|
|
11600
|
+
if (chartNode) {
|
|
11601
|
+
this._chartAdapter.update(chartNode);
|
|
11602
|
+
}
|
|
11603
|
+
};
|
|
11442
11604
|
SelectBase.prototype.getSelectedItemByText = function (itemText) {
|
|
11443
11605
|
var selBase = this.question;
|
|
11444
11606
|
if (this.question.hasOther && itemText == selBase.otherText) {
|
|
@@ -11741,9 +11903,9 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11741
11903
|
var series = this.getSeriesValues();
|
|
11742
11904
|
var innerCalculatedData = [];
|
|
11743
11905
|
if (series.length > 0) {
|
|
11744
|
-
for (var
|
|
11906
|
+
for (var j = 0; j < series.length; j++) {
|
|
11745
11907
|
var seriesData = [];
|
|
11746
|
-
for (var
|
|
11908
|
+
for (var i = 0; i < values.length; i++) {
|
|
11747
11909
|
if (!!externalCalculatedData[series[j]]) {
|
|
11748
11910
|
seriesData.push(externalCalculatedData[series[j]][values[i]] || 0);
|
|
11749
11911
|
}
|
|
@@ -11800,6 +11962,11 @@ var SelectBase = /** @class */ (function (_super) {
|
|
|
11800
11962
|
return SelectBase;
|
|
11801
11963
|
}(_visualizerBase__WEBPACK_IMPORTED_MODULE_2__.VisualizerBase));
|
|
11802
11964
|
|
|
11965
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("checkbox", SelectBase);
|
|
11966
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("radiogroup", SelectBase);
|
|
11967
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("dropdown", SelectBase);
|
|
11968
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("imagepicker", SelectBase);
|
|
11969
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("tagbox", SelectBase);
|
|
11803
11970
|
|
|
11804
11971
|
|
|
11805
11972
|
/***/ }),
|
|
@@ -12357,9 +12524,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12357
12524
|
var DocumentHelper = /** @class */ (function () {
|
|
12358
12525
|
function DocumentHelper() {
|
|
12359
12526
|
}
|
|
12360
|
-
DocumentHelper.createSelector = function (options, isSelected, handler) {
|
|
12527
|
+
DocumentHelper.createSelector = function (options, isSelected, handler, title) {
|
|
12361
12528
|
var selectWrapper = document.createElement("div");
|
|
12362
12529
|
selectWrapper.className = "sa-question__select-wrapper";
|
|
12530
|
+
if (title) {
|
|
12531
|
+
var titleElement = DocumentHelper.createElement("span", "sa-question__select-title", {
|
|
12532
|
+
innerText: title,
|
|
12533
|
+
});
|
|
12534
|
+
selectWrapper.appendChild(titleElement);
|
|
12535
|
+
}
|
|
12363
12536
|
var select = document.createElement("select");
|
|
12364
12537
|
select.className = "sa-question__select";
|
|
12365
12538
|
options.forEach(function (option) {
|
|
@@ -12665,7 +12838,14 @@ var VisualizationManager = /** @class */ (function () {
|
|
|
12665
12838
|
VisualizationManager.registerAltVisualizerSelector = function (constructor) {
|
|
12666
12839
|
VisualizationManager.alternativesVisualizer = constructor;
|
|
12667
12840
|
};
|
|
12841
|
+
VisualizationManager.getPivotVisualizerConstructor = function () {
|
|
12842
|
+
return VisualizationManager.pivotVisualizer || _visualizerBase__WEBPACK_IMPORTED_MODULE_0__.VisualizerBase;
|
|
12843
|
+
};
|
|
12844
|
+
VisualizationManager.registerPivotVisualizer = function (constructor) {
|
|
12845
|
+
VisualizationManager.pivotVisualizer = constructor;
|
|
12846
|
+
};
|
|
12668
12847
|
VisualizationManager.alternativesVisualizer = undefined;
|
|
12848
|
+
VisualizationManager.pivotVisualizer = undefined;
|
|
12669
12849
|
VisualizationManager.vizualizers = {};
|
|
12670
12850
|
return VisualizationManager;
|
|
12671
12851
|
}());
|
|
@@ -12712,6 +12892,7 @@ var VisualizationMatrixDropdown = /** @class */ (function (_super) {
|
|
|
12712
12892
|
_this._childOptions.disableLocaleSwitch = true;
|
|
12713
12893
|
_this._childOptions.dataProvider = undefined;
|
|
12714
12894
|
_this._childOptions.allowDynamicLayout = false;
|
|
12895
|
+
_this._childOptions.transposeData = true;
|
|
12715
12896
|
_this._childOptions.seriesValues = question.rows.map(function (row) { return row.value; });
|
|
12716
12897
|
_this._childOptions.seriesLabels = question.rows.map(function (row) { return row.text; });
|
|
12717
12898
|
var innerQuestions = _this.getQuestions();
|
|
@@ -12871,6 +13052,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12871
13052
|
/* harmony import */ var _layoutEngine__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./layoutEngine */ "./src/layoutEngine.ts");
|
|
12872
13053
|
/* harmony import */ var _svgbundle__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./svgbundle */ "./src/svgbundle.ts");
|
|
12873
13054
|
/* harmony import */ var _visualizationPanel_scss__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./visualizationPanel.scss */ "./src/visualizationPanel.scss");
|
|
13055
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
13056
|
+
|
|
12874
13057
|
|
|
12875
13058
|
|
|
12876
13059
|
|
|
@@ -13192,7 +13375,15 @@ var VisualizationPanel = /** @class */ (function (_super) {
|
|
|
13192
13375
|
VisualizationPanel.prototype.buildVisualizers = function (questions) {
|
|
13193
13376
|
var _this = this;
|
|
13194
13377
|
questions.forEach(function (question) {
|
|
13195
|
-
var
|
|
13378
|
+
var visualizerOptions = Object.assign({}, _this.options);
|
|
13379
|
+
var visualizerData = _this.surveyData;
|
|
13380
|
+
var visualizer;
|
|
13381
|
+
if (Array.isArray(question)) {
|
|
13382
|
+
visualizer = new (_visualizationManager__WEBPACK_IMPORTED_MODULE_11__.VisualizationManager.getPivotVisualizerConstructor())(question, visualizerData, visualizerOptions);
|
|
13383
|
+
}
|
|
13384
|
+
else {
|
|
13385
|
+
visualizer = _this.createVisualizer(question, visualizerOptions, visualizerData);
|
|
13386
|
+
}
|
|
13196
13387
|
if (!visualizer) {
|
|
13197
13388
|
return;
|
|
13198
13389
|
}
|
|
@@ -13261,6 +13452,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
|
|
|
13261
13452
|
var _this = this;
|
|
13262
13453
|
_super.prototype.setLocale.call(this, newLocale);
|
|
13263
13454
|
(this.questions || []).forEach(function (question) {
|
|
13455
|
+
question = Array.isArray(question) ? question[0] : question;
|
|
13264
13456
|
var element = _this.getElement(question.name);
|
|
13265
13457
|
if (!!element) {
|
|
13266
13458
|
element.displayName = _this.processText(question.title);
|
|
@@ -13328,6 +13520,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
|
|
|
13328
13520
|
VisualizationPanel.prototype.buildElements = function (questions) {
|
|
13329
13521
|
var _this = this;
|
|
13330
13522
|
return (questions || []).map(function (question) {
|
|
13523
|
+
question = Array.isArray(question) ? question[0] : question;
|
|
13331
13524
|
return {
|
|
13332
13525
|
name: question.name,
|
|
13333
13526
|
displayName: _this.processText(question.title),
|
|
@@ -13552,7 +13745,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
|
|
|
13552
13745
|
this._settingState = true;
|
|
13553
13746
|
try {
|
|
13554
13747
|
if (Array.isArray(newState.elements)) {
|
|
13555
|
-
var questionNames_1 = this.questions.map(function (q) { return q.name; });
|
|
13748
|
+
var questionNames_1 = this.questions.map(function (q) { return Array.isArray(q) ? q[0].name : q.name; });
|
|
13556
13749
|
this._elements = [].concat(newState.elements.filter(function (e) { return (questionNames_1.indexOf(e.name) !== -1); }));
|
|
13557
13750
|
}
|
|
13558
13751
|
if (typeof newState.locale !== "undefined")
|
|
@@ -13802,6 +13995,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13802
13995
|
this.contentContainer = undefined;
|
|
13803
13996
|
this.footerContainer = undefined;
|
|
13804
13997
|
this._supportSelection = false;
|
|
13998
|
+
this._chartAdapter = undefined;
|
|
13805
13999
|
/**
|
|
13806
14000
|
* An event that is raised after the visualizer's content is rendered.
|
|
13807
14001
|
*
|
|
@@ -13929,12 +14123,12 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13929
14123
|
enumerable: false,
|
|
13930
14124
|
configurable: true
|
|
13931
14125
|
});
|
|
13932
|
-
VisualizerBase.prototype.createVisualizer = function (question, options) {
|
|
14126
|
+
VisualizerBase.prototype.createVisualizer = function (question, options, data) {
|
|
13933
14127
|
var visualizerOptions = Object.assign({}, options || this.options);
|
|
13934
14128
|
if (visualizerOptions.dataProvider === undefined) {
|
|
13935
14129
|
visualizerOptions.dataProvider = this.dataProvider;
|
|
13936
14130
|
}
|
|
13937
|
-
return _visualizerFactory__WEBPACK_IMPORTED_MODULE_3__.VisualizerFactory.createVisualizer(question, this.data, visualizerOptions);
|
|
14131
|
+
return _visualizerFactory__WEBPACK_IMPORTED_MODULE_3__.VisualizerFactory.createVisualizer(question, data || this.data, visualizerOptions);
|
|
13938
14132
|
};
|
|
13939
14133
|
Object.defineProperty(VisualizerBase.prototype, "footerVisualizer", {
|
|
13940
14134
|
/**
|
|
@@ -14174,9 +14368,10 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
14174
14368
|
if (!!this.options && typeof this.options.destroyContent === "function") {
|
|
14175
14369
|
this.options.destroyContent(container, this);
|
|
14176
14370
|
}
|
|
14177
|
-
else {
|
|
14178
|
-
container.
|
|
14371
|
+
else if (this._chartAdapter) {
|
|
14372
|
+
this._chartAdapter.destroy(container.children[0]);
|
|
14179
14373
|
}
|
|
14374
|
+
container.innerHTML = "";
|
|
14180
14375
|
};
|
|
14181
14376
|
VisualizerBase.prototype.renderHeader = function (container) {
|
|
14182
14377
|
if (!!this.options && typeof this.options.renderHeader === "function") {
|
|
@@ -14190,11 +14385,23 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
14190
14385
|
};
|
|
14191
14386
|
VisualizerBase.prototype.renderContentAsync = function (container) {
|
|
14192
14387
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
14388
|
+
var chartNode;
|
|
14193
14389
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
14194
|
-
|
|
14390
|
+
switch (_a.label) {
|
|
14391
|
+
case 0:
|
|
14392
|
+
if (!this._chartAdapter) return [3 /*break*/, 2];
|
|
14393
|
+
chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
|
|
14394
|
+
container.innerHTML = "";
|
|
14395
|
+
container.appendChild(chartNode);
|
|
14396
|
+
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
14397
|
+
case 1:
|
|
14398
|
+
_a.sent();
|
|
14399
|
+
return [3 /*break*/, 3];
|
|
14400
|
+
case 2:
|
|
14195
14401
|
container.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("noVisualizerForQuestion");
|
|
14196
|
-
|
|
14197
|
-
|
|
14402
|
+
_a.label = 3;
|
|
14403
|
+
case 3: return [2 /*return*/, container];
|
|
14404
|
+
}
|
|
14198
14405
|
});
|
|
14199
14406
|
});
|
|
14200
14407
|
};
|
|
@@ -14277,10 +14484,32 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
14277
14484
|
targetElement.appendChild(this.footerContainer);
|
|
14278
14485
|
this.renderFooter(this.footerContainer);
|
|
14279
14486
|
};
|
|
14280
|
-
VisualizerBase.prototype.
|
|
14487
|
+
VisualizerBase.prototype.updateToolbar = function () {
|
|
14488
|
+
var _this = this;
|
|
14489
|
+
if (!!this.toolbarContainer) {
|
|
14490
|
+
PostponeHelper.postpone(function () {
|
|
14491
|
+
_this.destroyToolbar(_this.toolbarContainer);
|
|
14492
|
+
_this.renderToolbar(_this.toolbarContainer);
|
|
14493
|
+
});
|
|
14494
|
+
}
|
|
14495
|
+
};
|
|
14496
|
+
VisualizerBase.prototype.isSupportSoftUpdateContent = function () {
|
|
14497
|
+
return false;
|
|
14498
|
+
};
|
|
14499
|
+
VisualizerBase.prototype.softUpdateContent = function () {
|
|
14500
|
+
};
|
|
14501
|
+
VisualizerBase.prototype.hardUpdateContent = function () {
|
|
14281
14502
|
this.destroyContent(this.contentContainer);
|
|
14282
14503
|
this.renderContent(this.contentContainer);
|
|
14283
14504
|
};
|
|
14505
|
+
VisualizerBase.prototype.updateContent = function () {
|
|
14506
|
+
if (!this.isSupportSoftUpdateContent()) {
|
|
14507
|
+
this.hardUpdateContent();
|
|
14508
|
+
}
|
|
14509
|
+
else {
|
|
14510
|
+
this.softUpdateContent();
|
|
14511
|
+
}
|
|
14512
|
+
};
|
|
14284
14513
|
/**
|
|
14285
14514
|
* Re-renders the visualizer and its content.
|
|
14286
14515
|
*/
|
|
@@ -14485,6 +14714,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
14485
14714
|
}
|
|
14486
14715
|
};
|
|
14487
14716
|
VisualizerBase.suppressVisualizerStubRendering = false;
|
|
14717
|
+
VisualizerBase.chartAdapterType = undefined;
|
|
14488
14718
|
// public static otherCommentQuestionType = "comment"; // TODO: make it configureable - allow choose what kind of question/visualizer will be used for comments/others
|
|
14489
14719
|
VisualizerBase.otherCommentCollapsed = true;
|
|
14490
14720
|
VisualizerBase.customColors = [];
|
|
@@ -16554,11 +16784,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16554
16784
|
/* harmony export */ NpsVisualizer: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.NpsVisualizer),
|
|
16555
16785
|
/* harmony export */ NpsVisualizerWidget: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.NpsVisualizerWidget),
|
|
16556
16786
|
/* harmony export */ NumberModel: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.NumberModel),
|
|
16557
|
-
/* harmony export */
|
|
16787
|
+
/* harmony export */ PivotModel: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.PivotModel),
|
|
16788
|
+
/* harmony export */ PivotPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PivotPlotly),
|
|
16558
16789
|
/* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlyChartAdapter),
|
|
16559
|
-
/* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlyGaugeAdapter),
|
|
16560
16790
|
/* harmony export */ PlotlySetup: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlySetup),
|
|
16561
16791
|
/* harmony export */ PostponeHelper: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.PostponeHelper),
|
|
16792
|
+
/* harmony export */ RankingModel: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.RankingModel),
|
|
16562
16793
|
/* harmony export */ RankingPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.RankingPlotly),
|
|
16563
16794
|
/* harmony export */ SelectBase: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.SelectBase),
|
|
16564
16795
|
/* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.SelectBasePlotly),
|