survey-analytics 2.2.3 → 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.
Files changed (42) hide show
  1. package/fesm/shared.mjs +1 -1
  2. package/fesm/shared2.mjs +298 -193
  3. package/fesm/shared2.mjs.map +1 -1
  4. package/fesm/survey.analytics.core.mjs +2 -2
  5. package/fesm/survey.analytics.mjs +187 -418
  6. package/fesm/survey.analytics.mjs.map +1 -1
  7. package/fesm/survey.analytics.tabulator.mjs +1 -1
  8. package/package.json +2 -2
  9. package/survey-analytics.types/boolean.d.ts +0 -1
  10. package/survey-analytics.types/entries/summary.core.d.ts +2 -1
  11. package/survey-analytics.types/histogram.d.ts +1 -1
  12. package/survey-analytics.types/pivot.d.ts +2 -0
  13. package/survey-analytics.types/plotly/chart-adapter.d.ts +13 -0
  14. package/survey-analytics.types/plotly/index.d.ts +2 -8
  15. package/survey-analytics.types/plotly/legacy.d.ts +33 -0
  16. package/survey-analytics.types/plotly/setup.d.ts +5 -3
  17. package/survey-analytics.types/{plotly/ranking.d.ts → ranking.d.ts} +2 -2
  18. package/survey-analytics.types/selectBase.d.ts +2 -0
  19. package/survey-analytics.types/visualizerBase.d.ts +11 -0
  20. package/survey.analytics.core.css +1 -1
  21. package/survey.analytics.core.js +178 -23
  22. package/survey.analytics.core.js.map +1 -1
  23. package/survey.analytics.core.min.css +1 -1
  24. package/survey.analytics.core.min.js +1 -1
  25. package/survey.analytics.core.min.js.LICENSE.txt +1 -1
  26. package/survey.analytics.css +1 -1
  27. package/survey.analytics.js +491 -762
  28. package/survey.analytics.js.map +1 -1
  29. package/survey.analytics.min.css +1 -1
  30. package/survey.analytics.min.js +1 -1
  31. package/survey.analytics.min.js.LICENSE.txt +1 -1
  32. package/survey.analytics.tabulator.css +1 -1
  33. package/survey.analytics.tabulator.js +1 -1
  34. package/survey.analytics.tabulator.min.css +1 -1
  35. package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
  36. package/survey-analytics.types/plotly/boolean.d.ts +0 -16
  37. package/survey-analytics.types/plotly/histogram.d.ts +0 -12
  38. package/survey-analytics.types/plotly/matrix.d.ts +0 -11
  39. package/survey-analytics.types/plotly/matrixdropdown-grouped.d.ts +0 -11
  40. package/survey-analytics.types/plotly/pivot.d.ts +0 -12
  41. package/survey-analytics.types/plotly/rating.d.ts +0 -20
  42. package/survey-analytics.types/plotly/selectBase.d.ts +0 -25
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.2.3
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
  */
@@ -8443,6 +8443,8 @@ __webpack_require__.r(__webpack_exports__);
8443
8443
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
8444
8444
  /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
8445
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
+
8446
8448
 
8447
8449
 
8448
8450
 
@@ -8506,6 +8508,7 @@ var BooleanModel = /** @class */ (function (_super) {
8506
8508
  return BooleanModel;
8507
8509
  }(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
8508
8510
 
8511
+ _visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerVisualizer("boolean", BooleanModel);
8509
8512
 
8510
8513
 
8511
8514
  /***/ }),
@@ -8667,18 +8670,19 @@ function questionContainsValue(questionValue, filterValue) {
8667
8670
  __webpack_require__.r(__webpack_exports__);
8668
8671
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8669
8672
  /* harmony export */ AlternativeVisualizersWrapper: () => (/* reexport safe */ _alternativeVizualizersWrapper__WEBPACK_IMPORTED_MODULE_27__.AlternativeVisualizersWrapper),
8670
- /* harmony export */ BooleanModel: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_19__.BooleanModel),
8673
+ /* harmony export */ BooleanModel: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_18__.BooleanModel),
8671
8674
  /* harmony export */ DataProvider: () => (/* reexport safe */ _dataProvider__WEBPACK_IMPORTED_MODULE_14__.DataProvider),
8672
- /* harmony export */ DocumentHelper: () => (/* reexport safe */ _utils_index__WEBPACK_IMPORTED_MODULE_34__.DocumentHelper),
8673
- /* harmony export */ HistogramModel: () => (/* reexport safe */ _histogram__WEBPACK_IMPORTED_MODULE_20__.HistogramModel),
8674
- /* harmony export */ Matrix: () => (/* reexport safe */ _matrix__WEBPACK_IMPORTED_MODULE_18__.Matrix),
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),
8675
8678
  /* harmony export */ NpsAdapter: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsAdapter),
8676
8679
  /* harmony export */ NpsVisualizer: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsVisualizer),
8677
8680
  /* harmony export */ NpsVisualizerWidget: () => (/* reexport safe */ _nps__WEBPACK_IMPORTED_MODULE_32__.NpsVisualizerWidget),
8678
- /* harmony export */ NumberModel: () => (/* reexport safe */ _number__WEBPACK_IMPORTED_MODULE_16__.NumberModel),
8679
- /* harmony export */ PivotModel: () => (/* reexport safe */ _pivot__WEBPACK_IMPORTED_MODULE_33__.PivotModel),
8681
+ /* harmony export */ NumberModel: () => (/* reexport safe */ _number__WEBPACK_IMPORTED_MODULE_20__.NumberModel),
8682
+ /* harmony export */ PivotModel: () => (/* reexport safe */ _pivot__WEBPACK_IMPORTED_MODULE_34__.PivotModel),
8680
8683
  /* harmony export */ PostponeHelper: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_21__.PostponeHelper),
8681
- /* harmony export */ SelectBase: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_17__.SelectBase),
8684
+ /* harmony export */ RankingModel: () => (/* reexport safe */ _ranking__WEBPACK_IMPORTED_MODULE_33__.RankingModel),
8685
+ /* harmony export */ SelectBase: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.SelectBase),
8682
8686
  /* harmony export */ StatisticsTable: () => (/* reexport safe */ _statistics_table__WEBPACK_IMPORTED_MODULE_31__.StatisticsTable),
8683
8687
  /* harmony export */ StatisticsTableAdapter: () => (/* reexport safe */ _statistics_table__WEBPACK_IMPORTED_MODULE_31__.StatisticsTableAdapter),
8684
8688
  /* harmony export */ Text: () => (/* reexport safe */ _text__WEBPACK_IMPORTED_MODULE_30__.Text),
@@ -8693,7 +8697,7 @@ __webpack_require__.r(__webpack_exports__);
8693
8697
  /* harmony export */ WordCloud: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloud),
8694
8698
  /* harmony export */ WordCloudAdapter: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloudAdapter),
8695
8699
  /* harmony export */ defaultStatisticsCalculator: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_21__.defaultStatisticsCalculator),
8696
- /* harmony export */ hideEmptyAnswersInData: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_17__.hideEmptyAnswersInData),
8700
+ /* harmony export */ hideEmptyAnswersInData: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.hideEmptyAnswersInData),
8697
8701
  /* harmony export */ localization: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.localization),
8698
8702
  /* harmony export */ surveyStrings: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.surveyStrings),
8699
8703
  /* harmony export */ textHelper: () => (/* reexport safe */ _wordcloud_stopwords_index__WEBPACK_IMPORTED_MODULE_29__.textHelper)
@@ -8714,11 +8718,11 @@ __webpack_require__.r(__webpack_exports__);
8714
8718
  /* harmony import */ var _analytics_localization_finnish__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../analytics-localization/finnish */ "./src/analytics-localization/finnish.ts");
8715
8719
  /* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../dataProvider */ "./src/dataProvider.ts");
8716
8720
  /* harmony import */ var _visualizerFactory__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../visualizerFactory */ "./src/visualizerFactory.ts");
8717
- /* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../number */ "./src/number.ts");
8718
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../selectBase */ "./src/selectBase.ts");
8719
- /* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../matrix */ "./src/matrix.ts");
8720
- /* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../boolean */ "./src/boolean.ts");
8721
- /* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../histogram */ "./src/histogram.ts");
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");
8722
8726
  /* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../visualizerBase */ "./src/visualizerBase.ts");
8723
8727
  /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
8724
8728
  /* harmony import */ var _visualizationPanel__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../visualizationPanel */ "./src/visualizationPanel.ts");
@@ -8731,8 +8735,9 @@ __webpack_require__.r(__webpack_exports__);
8731
8735
  /* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../text */ "./src/text.ts");
8732
8736
  /* harmony import */ var _statistics_table__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../statistics-table */ "./src/statistics-table.ts");
8733
8737
  /* harmony import */ var _nps__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../nps */ "./src/nps.ts");
8734
- /* harmony import */ var _pivot__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../pivot */ "./src/pivot.ts");
8735
- /* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../utils/index */ "./src/utils/index.ts");
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");
8736
8741
 
8737
8742
  //localization
8738
8743
 
@@ -8769,6 +8774,7 @@ __webpack_require__.r(__webpack_exports__);
8769
8774
 
8770
8775
 
8771
8776
 
8777
+
8772
8778
 
8773
8779
 
8774
8780
  /***/ }),
@@ -8840,6 +8846,8 @@ __webpack_require__.r(__webpack_exports__);
8840
8846
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
8841
8847
  /* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataProvider */ "./src/dataProvider.ts");
8842
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
+
8843
8851
 
8844
8852
 
8845
8853
 
@@ -9031,11 +9039,17 @@ var HistogramModel = /** @class */ (function (_super) {
9031
9039
  }
9032
9040
  return statistics;
9033
9041
  };
9042
+ HistogramModel.prototype.getValueType = function () {
9043
+ return this.valueType;
9044
+ };
9034
9045
  HistogramModel.IntervalsCount = 10;
9035
9046
  HistogramModel.UseIntervalsFrom = 10;
9036
9047
  return HistogramModel;
9037
9048
  }(_selectBase__WEBPACK_IMPORTED_MODULE_3__.SelectBase));
9038
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);
9039
9053
 
9040
9054
 
9041
9055
  /***/ }),
@@ -9395,6 +9409,8 @@ __webpack_require__.r(__webpack_exports__);
9395
9409
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
9396
9410
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
9397
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
+
9398
9414
 
9399
9415
 
9400
9416
 
@@ -9489,6 +9505,7 @@ var Matrix = /** @class */ (function (_super) {
9489
9505
  return Matrix;
9490
9506
  }(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
9491
9507
 
9508
+ _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("matrix", Matrix);
9492
9509
 
9493
9510
 
9494
9511
  /***/ }),
@@ -9507,6 +9524,8 @@ __webpack_require__.r(__webpack_exports__);
9507
9524
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
9508
9525
  /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
9509
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
+
9510
9529
 
9511
9530
 
9512
9531
 
@@ -9514,7 +9533,6 @@ var MatrixDropdownGrouped = /** @class */ (function (_super) {
9514
9533
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixDropdownGrouped, _super);
9515
9534
  function MatrixDropdownGrouped(question, data, options, name) {
9516
9535
  return _super.call(this, question, data, options, name || "matrixDropdownGrouped") || this;
9517
- // this.getAnswersData();
9518
9536
  }
9519
9537
  Object.defineProperty(MatrixDropdownGrouped.prototype, "matrixQuestion", {
9520
9538
  get: function () {
@@ -9559,16 +9577,12 @@ var MatrixDropdownGrouped = /** @class */ (function (_super) {
9559
9577
  getSeriesValues: function () { return rows; },
9560
9578
  getSeriesLabels: function () { return rows; },
9561
9579
  });
9562
- var preparedData = [];
9563
- values.forEach(function (val, valueIndex) {
9564
- var seriesData = series.map(function (seriesName, seriesIndex) { return statistics[seriesIndex][0][valueIndex]; });
9565
- preparedData.push(seriesData);
9566
- });
9567
- return preparedData;
9580
+ return statistics.map(function (s) { return s[0]; });
9568
9581
  };
9569
9582
  return MatrixDropdownGrouped;
9570
9583
  }(_selectBase__WEBPACK_IMPORTED_MODULE_1__.SelectBase));
9571
9584
 
9585
+ _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("matrixdropdown-grouped", MatrixDropdownGrouped);
9572
9586
 
9573
9587
 
9574
9588
  /***/ }),
@@ -9798,6 +9812,8 @@ __webpack_require__.r(__webpack_exports__);
9798
9812
  /* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
9799
9813
  /* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
9800
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
+
9801
9817
 
9802
9818
 
9803
9819
 
@@ -9807,6 +9823,11 @@ var NumberModel = /** @class */ (function (_super) {
9807
9823
  function NumberModel(question, data, options, name) {
9808
9824
  if (options === void 0) { options = {}; }
9809
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
+ }
9810
9831
  _this.registerToolbarItem("changeChartType", function () {
9811
9832
  if (_this.chartTypes.length > 1) {
9812
9833
  return _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
@@ -9924,6 +9945,9 @@ var NumberModel = /** @class */ (function (_super) {
9924
9945
  return NumberModel;
9925
9946
  }(_visualizerBase__WEBPACK_IMPORTED_MODULE_1__.VisualizerBase));
9926
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);
9927
9951
 
9928
9952
 
9929
9953
  /***/ }),
@@ -9946,6 +9970,8 @@ __webpack_require__.r(__webpack_exports__);
9946
9970
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils/index.ts");
9947
9971
  /* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
9948
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
+
9949
9975
 
9950
9976
 
9951
9977
 
@@ -10140,7 +10166,7 @@ var PivotModel = /** @class */ (function (_super) {
10140
10166
  });
10141
10167
  PivotModel.prototype.getSeriesValues = function () {
10142
10168
  var _this = this;
10143
- if (this.questionsY.length === 0) {
10169
+ if (!this.questionsY || this.questionsY.length === 0) {
10144
10170
  return this.options.seriesValues || [];
10145
10171
  }
10146
10172
  var seriesValues = [];
@@ -10329,658 +10355,45 @@ var PivotModel = /** @class */ (function (_super) {
10329
10355
  }
10330
10356
  return statistics;
10331
10357
  };
10358
+ PivotModel.prototype.getValueType = function () {
10359
+ return this.valueType;
10360
+ };
10361
+ PivotModel.prototype.isSupportSoftUpdateContent = function () {
10362
+ return false;
10363
+ };
10332
10364
  PivotModel.IntervalsCount = 10;
10333
10365
  PivotModel.UseIntervalsFrom = 10;
10334
10366
  return PivotModel;
10335
10367
  }(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
10336
10368
 
10369
+ _visualizationManager__WEBPACK_IMPORTED_MODULE_6__.VisualizationManager.registerPivotVisualizer(PivotModel);
10337
10370
 
10338
10371
 
10339
10372
  /***/ }),
10340
10373
 
10341
- /***/ "./src/plotly/boolean.ts":
10342
- /*!*******************************!*\
10343
- !*** ./src/plotly/boolean.ts ***!
10344
- \*******************************/
10345
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10346
-
10347
- "use strict";
10348
- __webpack_require__.r(__webpack_exports__);
10349
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10350
- /* harmony export */ BooleanPlotly: () => (/* binding */ BooleanPlotly),
10351
- /* harmony export */ PlotlyBoolChartAdapter: () => (/* binding */ PlotlyBoolChartAdapter)
10352
- /* harmony export */ });
10353
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10354
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10355
- /* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../boolean */ "./src/boolean.ts");
10356
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10357
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10358
-
10359
-
10360
-
10361
-
10362
-
10363
- var PlotlyBoolChartAdapter = /** @class */ (function (_super) {
10364
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PlotlyBoolChartAdapter, _super);
10365
- function PlotlyBoolChartAdapter(model) {
10366
- return _super.call(this, model) || this;
10367
- }
10368
- PlotlyBoolChartAdapter.prototype.patchConfigParameters = function (chartNode, traces, layout, config) {
10369
- var colors = this.model.getColors();
10370
- var boolColors = [
10371
- BooleanPlotly.trueColor || colors[0],
10372
- BooleanPlotly.falseColor || colors[1],
10373
- ];
10374
- if (this.model.showMissingAnswers) {
10375
- boolColors.push(colors[2]);
10376
- }
10377
- if (this.model.chartType === "pie" || this.model.chartType === "doughnut") {
10378
- traces.forEach(function (trace) {
10379
- trace.marker.colors = boolColors;
10380
- });
10381
- }
10382
- else if (this.model.chartType === "bar") {
10383
- traces.forEach(function (trace) {
10384
- trace.marker.color = boolColors;
10385
- });
10386
- }
10387
- };
10388
- return PlotlyBoolChartAdapter;
10389
- }(_selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter));
10390
-
10391
- var BooleanPlotly = /** @class */ (function (_super) {
10392
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BooleanPlotly, _super);
10393
- function BooleanPlotly(question, data, options, name) {
10394
- var _this = _super.call(this, question, data, options, name) || this;
10395
- _this.chartTypes = BooleanPlotly.types;
10396
- _this._chartType = _this.chartTypes[0];
10397
- _this._chartAdapter = new PlotlyBoolChartAdapter(_this);
10398
- return _this;
10399
- }
10400
- BooleanPlotly.prototype.destroyContent = function (container) {
10401
- this._chartAdapter.destroy(container.children[0]);
10402
- _super.prototype.destroyContent.call(this, container);
10403
- };
10404
- BooleanPlotly.prototype.renderContentAsync = function (container) {
10405
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10406
- var chartNode;
10407
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10408
- switch (_a.label) {
10409
- case 0:
10410
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
10411
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10412
- case 1:
10413
- _a.sent();
10414
- container.innerHTML = "";
10415
- container.appendChild(chartNode);
10416
- return [2 /*return*/, container];
10417
- }
10418
- });
10419
- });
10420
- };
10421
- BooleanPlotly.types = ["pie", "bar", "doughnut"];
10422
- return BooleanPlotly;
10423
- }(_boolean__WEBPACK_IMPORTED_MODULE_2__.BooleanModel));
10424
-
10425
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("boolean", BooleanPlotly);
10426
-
10427
-
10428
- /***/ }),
10429
-
10430
- /***/ "./src/plotly/histogram.ts":
10431
- /*!*********************************!*\
10432
- !*** ./src/plotly/histogram.ts ***!
10433
- \*********************************/
10434
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10435
-
10436
- "use strict";
10437
- __webpack_require__.r(__webpack_exports__);
10438
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10439
- /* harmony export */ HistogramPlotly: () => (/* binding */ HistogramPlotly)
10440
- /* harmony export */ });
10441
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10442
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10443
- /* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../histogram */ "./src/histogram.ts");
10444
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10445
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10446
-
10447
-
10448
-
10449
-
10450
-
10451
- var HistogramPlotly = /** @class */ (function (_super) {
10452
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(HistogramPlotly, _super);
10453
- function HistogramPlotly(question, data, options, name) {
10454
- var _this = _super.call(this, question, data, options, name) || this;
10455
- _this.chartTypes = HistogramPlotly.types;
10456
- _this._chartType = _this.chartTypes[0];
10457
- _this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
10458
- return _this;
10459
- }
10460
- HistogramPlotly.prototype.destroyContent = function (container) {
10461
- this._chartAdapter.destroy(container.children[0]);
10462
- _super.prototype.destroyContent.call(this, container);
10463
- };
10464
- HistogramPlotly.prototype.renderContentAsync = function (container) {
10465
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10466
- var chartNode;
10467
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10468
- switch (_a.label) {
10469
- case 0:
10470
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
10471
- container.innerHTML = "";
10472
- container.appendChild(chartNode);
10473
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10474
- case 1:
10475
- _a.sent();
10476
- return [2 /*return*/, container];
10477
- }
10478
- });
10479
- });
10480
- };
10481
- HistogramPlotly.prototype.getValueType = function () {
10482
- return this.valueType;
10483
- };
10484
- HistogramPlotly.types = ["vbar", "bar"];
10485
- return HistogramPlotly;
10486
- }(_histogram__WEBPACK_IMPORTED_MODULE_2__.HistogramModel));
10487
-
10488
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("date", HistogramPlotly);
10489
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("number", HistogramPlotly);
10490
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("rating", HistogramPlotly);
10491
-
10492
-
10493
- /***/ }),
10494
-
10495
- /***/ "./src/plotly/index.ts":
10496
- /*!*****************************!*\
10497
- !*** ./src/plotly/index.ts ***!
10498
- \*****************************/
10499
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10500
-
10501
- "use strict";
10502
- __webpack_require__.r(__webpack_exports__);
10503
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10504
- /* harmony export */ BooleanPlotly: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_3__.BooleanPlotly),
10505
- /* harmony export */ GaugePlotly: () => (/* reexport safe */ _rating__WEBPACK_IMPORTED_MODULE_7__.GaugePlotly),
10506
- /* harmony export */ HistogramPlotly: () => (/* reexport safe */ _histogram__WEBPACK_IMPORTED_MODULE_6__.HistogramPlotly),
10507
- /* harmony export */ MatrixDropdownGroupedPlotly: () => (/* reexport safe */ _matrixdropdown_grouped__WEBPACK_IMPORTED_MODULE_5__.MatrixDropdownGroupedPlotly),
10508
- /* harmony export */ MatrixPlotly: () => (/* reexport safe */ _matrix__WEBPACK_IMPORTED_MODULE_2__.MatrixPlotly),
10509
- /* harmony export */ PivotPlotly: () => (/* reexport safe */ _pivot__WEBPACK_IMPORTED_MODULE_8__.PivotPlotly),
10510
- /* harmony export */ PlotlyBoolChartAdapter: () => (/* reexport safe */ _boolean__WEBPACK_IMPORTED_MODULE_3__.PlotlyBoolChartAdapter),
10511
- /* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_1__.PlotlyChartAdapter),
10512
- /* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _rating__WEBPACK_IMPORTED_MODULE_7__.PlotlyGaugeAdapter),
10513
- /* harmony export */ PlotlySetup: () => (/* reexport safe */ _setup__WEBPACK_IMPORTED_MODULE_0__.PlotlySetup),
10514
- /* harmony export */ RankingPlotly: () => (/* reexport safe */ _ranking__WEBPACK_IMPORTED_MODULE_4__.RankingPlotly),
10515
- /* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_1__.SelectBasePlotly)
10516
- /* harmony export */ });
10517
- /* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
10518
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10519
- /* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./matrix */ "./src/plotly/matrix.ts");
10520
- /* harmony import */ var _boolean__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./boolean */ "./src/plotly/boolean.ts");
10521
- /* harmony import */ var _ranking__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ranking */ "./src/plotly/ranking.ts");
10522
- /* harmony import */ var _matrixdropdown_grouped__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./matrixdropdown-grouped */ "./src/plotly/matrixdropdown-grouped.ts");
10523
- /* harmony import */ var _histogram__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./histogram */ "./src/plotly/histogram.ts");
10524
- /* harmony import */ var _rating__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rating */ "./src/plotly/rating.ts");
10525
- /* harmony import */ var _pivot__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pivot */ "./src/plotly/pivot.ts");
10526
-
10527
-
10528
-
10529
-
10530
-
10531
-
10532
-
10533
-
10534
-
10535
-
10536
-
10537
- /***/ }),
10538
-
10539
- /***/ "./src/plotly/matrix.ts":
10540
- /*!******************************!*\
10541
- !*** ./src/plotly/matrix.ts ***!
10542
- \******************************/
10543
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10544
-
10545
- "use strict";
10546
- __webpack_require__.r(__webpack_exports__);
10547
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10548
- /* harmony export */ MatrixPlotly: () => (/* binding */ MatrixPlotly)
10549
- /* harmony export */ });
10550
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10551
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10552
- /* harmony import */ var _matrix__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../matrix */ "./src/matrix.ts");
10553
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10554
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10555
-
10556
-
10557
-
10558
-
10559
-
10560
- var MatrixPlotly = /** @class */ (function (_super) {
10561
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixPlotly, _super);
10562
- function MatrixPlotly(question, data, options, name) {
10563
- var _this = _super.call(this, question, data, options, name) || this;
10564
- _this.chartTypes = MatrixPlotly.types;
10565
- _this._chartType = _this.chartTypes[0];
10566
- _this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
10567
- return _this;
10568
- }
10569
- MatrixPlotly.prototype.destroyContent = function (container) {
10570
- this._chartAdapter.destroy(container.children[0]);
10571
- _super.prototype.destroyContent.call(this, container);
10572
- };
10573
- MatrixPlotly.prototype.renderContentAsync = function (container) {
10574
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10575
- var chartNode;
10576
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10577
- switch (_a.label) {
10578
- case 0:
10579
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
10580
- container.innerHTML = "";
10581
- container.appendChild(chartNode);
10582
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10583
- case 1:
10584
- _a.sent();
10585
- return [2 /*return*/, container];
10586
- }
10587
- });
10588
- });
10589
- };
10590
- MatrixPlotly.types = ["bar", "stackedbar", "pie", "doughnut"];
10591
- return MatrixPlotly;
10592
- }(_matrix__WEBPACK_IMPORTED_MODULE_2__.Matrix));
10593
-
10594
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("matrix", MatrixPlotly);
10595
-
10596
-
10597
- /***/ }),
10598
-
10599
- /***/ "./src/plotly/matrixdropdown-grouped.ts":
10600
- /*!**********************************************!*\
10601
- !*** ./src/plotly/matrixdropdown-grouped.ts ***!
10602
- \**********************************************/
10603
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10604
-
10605
- "use strict";
10606
- __webpack_require__.r(__webpack_exports__);
10607
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10608
- /* harmony export */ MatrixDropdownGroupedPlotly: () => (/* binding */ MatrixDropdownGroupedPlotly)
10609
- /* harmony export */ });
10610
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10611
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10612
- /* harmony import */ var _matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../matrixDropdownGrouped */ "./src/matrixDropdownGrouped.ts");
10613
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10614
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10615
-
10616
-
10617
-
10618
-
10619
-
10620
- var MatrixDropdownGroupedPlotly = /** @class */ (function (_super) {
10621
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(MatrixDropdownGroupedPlotly, _super);
10622
- function MatrixDropdownGroupedPlotly(question, data, options, name) {
10623
- var _this = _super.call(this, question, data, options, name) || this;
10624
- _this.chartTypes = MatrixDropdownGroupedPlotly.types;
10625
- _this._chartType = _this.chartTypes[0];
10626
- _this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_3__.PlotlyChartAdapter(_this);
10627
- return _this;
10628
- }
10629
- MatrixDropdownGroupedPlotly.prototype.destroyContent = function (container) {
10630
- this._chartAdapter.destroy(container.children[0]);
10631
- _super.prototype.destroyContent.call(this, container);
10632
- };
10633
- MatrixDropdownGroupedPlotly.prototype.renderContentAsync = function (container) {
10634
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10635
- var chartNode;
10636
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10637
- switch (_a.label) {
10638
- case 0:
10639
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
10640
- container.innerHTML = "";
10641
- container.appendChild(chartNode);
10642
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10643
- case 1:
10644
- _a.sent();
10645
- return [2 /*return*/, container];
10646
- }
10647
- });
10648
- });
10649
- };
10650
- MatrixDropdownGroupedPlotly.types = ["stackedbar", "bar", "pie", "doughnut"];
10651
- return MatrixDropdownGroupedPlotly;
10652
- }(_matrixDropdownGrouped__WEBPACK_IMPORTED_MODULE_2__.MatrixDropdownGrouped));
10653
-
10654
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("matrixdropdown-grouped", MatrixDropdownGroupedPlotly);
10655
-
10656
-
10657
- /***/ }),
10658
-
10659
- /***/ "./src/plotly/pivot.ts":
10660
- /*!*****************************!*\
10661
- !*** ./src/plotly/pivot.ts ***!
10662
- \*****************************/
10663
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10664
-
10665
- "use strict";
10666
- __webpack_require__.r(__webpack_exports__);
10667
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10668
- /* harmony export */ PivotPlotly: () => (/* binding */ PivotPlotly)
10669
- /* harmony export */ });
10670
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10671
- /* harmony import */ var _pivot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../pivot */ "./src/pivot.ts");
10672
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10673
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10674
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10675
-
10676
-
10677
-
10678
-
10679
-
10680
- var PivotPlotly = /** @class */ (function (_super) {
10681
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PivotPlotly, _super);
10682
- function PivotPlotly(questions, data, options, name) {
10683
- var _this = _super.call(this, questions, data, options, name) || this;
10684
- _this.chartTypes = PivotPlotly.types;
10685
- _this._chartType = _this.chartTypes[0];
10686
- _this._chartAdapter = new _selectBase__WEBPACK_IMPORTED_MODULE_2__.PlotlyChartAdapter(_this);
10687
- return _this;
10688
- }
10689
- PivotPlotly.prototype.destroyContent = function (container) {
10690
- this._chartAdapter.destroy(container.children[0]);
10691
- _super.prototype.destroyContent.call(this, container);
10692
- };
10693
- PivotPlotly.prototype.renderContentAsync = function (container) {
10694
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10695
- var chartNode;
10696
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10697
- switch (_a.label) {
10698
- case 0:
10699
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createElement("div");
10700
- container.innerHTML = "";
10701
- container.appendChild(chartNode);
10702
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10703
- case 1:
10704
- _a.sent();
10705
- return [2 /*return*/, container];
10706
- }
10707
- });
10708
- });
10709
- };
10710
- PivotPlotly.prototype.getValueType = function () {
10711
- return this.valueType;
10712
- };
10713
- PivotPlotly.types = ["vbar", "bar", "line", "stackedbar", "pie", "doughnut"]; // ["vbar", "bar"];
10714
- return PivotPlotly;
10715
- }(_pivot__WEBPACK_IMPORTED_MODULE_1__.PivotModel));
10716
-
10717
- _visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.registerPivotVisualizer(PivotPlotly);
10718
-
10719
-
10720
- /***/ }),
10721
-
10722
- /***/ "./src/plotly/ranking.ts":
10723
- /*!*******************************!*\
10724
- !*** ./src/plotly/ranking.ts ***!
10725
- \*******************************/
10726
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10727
-
10728
- "use strict";
10729
- __webpack_require__.r(__webpack_exports__);
10730
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10731
- /* harmony export */ RankingPlotly: () => (/* binding */ RankingPlotly)
10732
- /* harmony export */ });
10733
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10734
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10735
- /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./selectBase */ "./src/plotly/selectBase.ts");
10736
-
10737
-
10738
-
10739
- var RankingPlotly = /** @class */ (function (_super) {
10740
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(RankingPlotly, _super);
10741
- function RankingPlotly() {
10742
- return _super !== null && _super.apply(this, arguments) || this;
10743
- }
10744
- RankingPlotly.prototype.getQuestionResults = function () {
10745
- var name = this.question.name;
10746
- return this.data.map(function (dataItem) { return dataItem[name]; });
10747
- };
10748
- RankingPlotly.prototype.getEmptyData = function () {
10749
- var choices = this.getValues();
10750
- var data = [];
10751
- data.length = choices.length;
10752
- data.fill(0);
10753
- return data;
10754
- };
10755
- RankingPlotly.prototype.getCalculatedValuesCore = function () {
10756
- var _this = this;
10757
- var results = this.getQuestionResults();
10758
- var choices = this.getValues();
10759
- var plotlyData = this.getEmptyData();
10760
- results.forEach(function (result) {
10761
- _this.applyResultToPlotlyData(result, plotlyData, choices);
10762
- });
10763
- return [plotlyData];
10764
- };
10765
- RankingPlotly.prototype.applyResultToPlotlyData = function (result, plotlyData, choices) {
10766
- if (!result || !plotlyData || !choices)
10767
- return;
10768
- result.forEach(function (resultValue, resultValueIndex, result) {
10769
- var index = choices.indexOf(resultValue);
10770
- plotlyData[index] =
10771
- +plotlyData[index] + (result.length - resultValueIndex);
10772
- });
10773
- };
10774
- return RankingPlotly;
10775
- }(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBasePlotly));
10776
-
10777
- _visualizationManager__WEBPACK_IMPORTED_MODULE_1__.VisualizationManager.registerVisualizer("ranking", RankingPlotly);
10778
-
10779
-
10780
- /***/ }),
10781
-
10782
- /***/ "./src/plotly/rating.ts":
10783
- /*!******************************!*\
10784
- !*** ./src/plotly/rating.ts ***!
10785
- \******************************/
10786
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10787
-
10788
- "use strict";
10789
- __webpack_require__.r(__webpack_exports__);
10790
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10791
- /* harmony export */ GaugePlotly: () => (/* binding */ GaugePlotly),
10792
- /* harmony export */ PlotlyGaugeAdapter: () => (/* binding */ PlotlyGaugeAdapter)
10793
- /* harmony export */ });
10794
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10795
- /* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../number */ "./src/number.ts");
10796
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10797
- /* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/index */ "./src/utils/index.ts");
10798
- /* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../localizationManager */ "./src/localizationManager.ts");
10799
- /* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
10800
- /* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! plotly.js-dist-min */ "plotly.js-dist-min");
10801
- /* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__);
10802
-
10803
-
10804
-
10805
-
10806
-
10807
-
10808
-
10809
- var PlotlyGaugeAdapter = /** @class */ (function () {
10810
- function PlotlyGaugeAdapter(model) {
10811
- this.model = model;
10812
- this._chart = undefined;
10813
- }
10814
- Object.defineProperty(PlotlyGaugeAdapter.prototype, "chart", {
10815
- get: function () {
10816
- return this._chart;
10817
- },
10818
- enumerable: false,
10819
- configurable: true
10820
- });
10821
- PlotlyGaugeAdapter.prototype.create = function (chartNode) {
10822
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10823
- var question, _a, level, minValue, maxValue, rateValues, colors, data, chartMargin, layout, config, options, plot;
10824
- var _this = this;
10825
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
10826
- switch (_b.label) {
10827
- case 0:
10828
- question = this.model.question;
10829
- return [4 /*yield*/, this.model.getCalculatedValues()];
10830
- case 1:
10831
- _a = _b.sent(), level = _a[0], minValue = _a[1], maxValue = _a[2];
10832
- if (question.getType() === "rating") {
10833
- rateValues = question.visibleRateValues;
10834
- maxValue = rateValues[rateValues.length - 1].value;
10835
- minValue = rateValues[0].value;
10836
- }
10837
- colors = this.model.generateColors(maxValue, minValue, GaugePlotly.stepsCount);
10838
- if (GaugePlotly.showAsPercentage) {
10839
- level = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DataHelper.toPercentage(level, maxValue);
10840
- minValue = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DataHelper.toPercentage(minValue, maxValue);
10841
- maxValue = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DataHelper.toPercentage(maxValue, maxValue);
10842
- }
10843
- data = [
10844
- {
10845
- type: "indicator",
10846
- mode: "gauge+number",
10847
- gauge: {
10848
- axis: { range: [minValue, maxValue] },
10849
- shape: this.model.chartType,
10850
- bgcolor: "white",
10851
- bar: { color: colors[0] },
10852
- },
10853
- value: level,
10854
- text: question.name,
10855
- domain: { x: [0, 1], y: [0, 1] },
10856
- },
10857
- ];
10858
- chartMargin = this.model.chartType === "bullet" ? 60 : 30;
10859
- layout = {
10860
- height: 250,
10861
- margin: {
10862
- l: chartMargin,
10863
- r: chartMargin,
10864
- b: chartMargin,
10865
- t: chartMargin,
10866
- pad: 5
10867
- },
10868
- plot_bgcolor: this.model.backgroundColor,
10869
- paper_bgcolor: this.model.backgroundColor,
10870
- };
10871
- config = {
10872
- displayModeBar: true,
10873
- locale: _localizationManager__WEBPACK_IMPORTED_MODULE_4__.localization.currentLocale,
10874
- responsive: true,
10875
- displaylogo: false,
10876
- modeBarButtonsToRemove: ["toImage"],
10877
- modeBarButtonsToAdd: [
10878
- {
10879
- name: "toImageSjs",
10880
- title: _localizationManager__WEBPACK_IMPORTED_MODULE_4__.localization.getString("saveDiagramAsPNG"),
10881
- icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
10882
- click: function (gd) {
10883
- var options = {
10884
- format: _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.imageExportFormat,
10885
- // width: 800,
10886
- // height: 600,
10887
- filename: _this.model.question.name,
10888
- };
10889
- _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onImageSaving.fire(_this.model, options);
10890
- plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
10891
- },
10892
- },
10893
- ],
10894
- };
10895
- if (GaugePlotly.displayModeBar !== undefined) {
10896
- config.displayModeBar = GaugePlotly.displayModeBar;
10897
- }
10898
- options = {
10899
- data: data,
10900
- layout: layout,
10901
- config: config,
10902
- };
10903
- _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.onPlotCreating.fire(this.model, options);
10904
- plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().newPlot(chartNode, options.data, options.layout, options.config);
10905
- // setTimeout(() => Plotly.Plots.resize(chartNode), 10);
10906
- return [2 /*return*/, plot];
10907
- }
10908
- });
10909
- });
10910
- };
10911
- PlotlyGaugeAdapter.prototype.destroy = function (node) {
10912
- if (!!node) {
10913
- plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().purge(node);
10914
- }
10915
- this._chart = undefined;
10916
- };
10917
- return PlotlyGaugeAdapter;
10918
- }());
10919
-
10920
- var GaugePlotly = /** @class */ (function (_super) {
10921
- (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(GaugePlotly, _super);
10922
- function GaugePlotly(question, data, options, name) {
10923
- var _this = _super.call(this, question, data, options, name) || this;
10924
- _this.chartTypes = GaugePlotly.types;
10925
- _this.chartType = _this.chartTypes[0];
10926
- _this._chartAdapter = new PlotlyGaugeAdapter(_this);
10927
- return _this;
10928
- }
10929
- GaugePlotly.prototype.destroyContent = function (container) {
10930
- this._chartAdapter.destroy(container.children[0]);
10931
- _super.prototype.destroyContent.call(this, container);
10932
- };
10933
- GaugePlotly.prototype.renderContentAsync = function (container) {
10934
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10935
- var chartNode;
10936
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10937
- switch (_a.label) {
10938
- case 0:
10939
- chartNode = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createElement("div");
10940
- container.innerHTML = "";
10941
- container.appendChild(chartNode);
10942
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
10943
- case 1:
10944
- _a.sent();
10945
- return [2 /*return*/, container];
10946
- }
10947
- });
10948
- });
10949
- };
10950
- GaugePlotly.displayModeBar = undefined;
10951
- GaugePlotly.types = ["gauge", "bullet"];
10952
- return GaugePlotly;
10953
- }(_number__WEBPACK_IMPORTED_MODULE_1__.NumberModel));
10954
-
10955
- _visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.registerVisualizer("number", GaugePlotly);
10956
- _visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.registerVisualizer("rating", GaugePlotly);
10957
- _visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.registerVisualizer("expression", GaugePlotly);
10958
-
10959
-
10960
- /***/ }),
10961
-
10962
- /***/ "./src/plotly/selectBase.ts":
10963
- /*!**********************************!*\
10964
- !*** ./src/plotly/selectBase.ts ***!
10965
- \**********************************/
10374
+ /***/ "./src/plotly/chart-adapter.ts":
10375
+ /*!*************************************!*\
10376
+ !*** ./src/plotly/chart-adapter.ts ***!
10377
+ \*************************************/
10966
10378
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10967
10379
 
10968
10380
  "use strict";
10969
10381
  __webpack_require__.r(__webpack_exports__);
10970
10382
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10971
- /* harmony export */ PlotlyChartAdapter: () => (/* binding */ PlotlyChartAdapter),
10972
- /* harmony export */ SelectBasePlotly: () => (/* binding */ SelectBasePlotly)
10383
+ /* harmony export */ PlotlyChartAdapter: () => (/* binding */ PlotlyChartAdapter)
10973
10384
  /* harmony export */ });
10974
10385
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
10975
10386
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
10976
10387
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
10977
10388
  /* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../selectBase */ "./src/selectBase.ts");
10978
- /* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../visualizationManager */ "./src/visualizationManager.ts");
10979
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils/index.ts");
10980
- /* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../localizationManager */ "./src/localizationManager.ts");
10981
- /* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! plotly.js-dist-min */ "plotly.js-dist-min");
10982
- /* harmony import */ var plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6__);
10983
- /* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./setup */ "./src/plotly/setup.ts");
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
+
10984
10397
 
10985
10398
 
10986
10399
 
@@ -10994,7 +10407,32 @@ var PlotlyChartAdapter = /** @class */ (function () {
10994
10407
  this.model = model;
10995
10408
  this._chart = undefined;
10996
10409
  }
10997
- 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
+ };
10998
10436
  Object.defineProperty(PlotlyChartAdapter.prototype, "chart", {
10999
10437
  get: function () {
11000
10438
  return this._chart;
@@ -11002,45 +10440,73 @@ var PlotlyChartAdapter = /** @class */ (function () {
11002
10440
  enumerable: false,
11003
10441
  configurable: true
11004
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
+ };
11005
10468
  PlotlyChartAdapter.prototype.create = function (chartNode) {
11006
10469
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
11007
- var _a, plot, plotlyOptions, getDragLayer;
10470
+ var _a, plot, plotlyOptions, _model_1, getDragLayer;
11008
10471
  var _this = this;
11009
10472
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
11010
10473
  switch (_b.label) {
11011
10474
  case 0: return [4 /*yield*/, this.update(chartNode)];
11012
10475
  case 1:
11013
10476
  _a = _b.sent(), plot = _a[0], plotlyOptions = _a[1];
11014
- chartNode["on"]("plotly_click", function (data) {
11015
- var _a;
11016
- if (data.points.length > 0) {
11017
- var itemText = "";
11018
- if (!plotlyOptions.hasSeries) {
11019
- itemText = Array.isArray(data.points[0].customdata)
11020
- ? data.points[0].customdata[0]
11021
- : data.points[0].customdata;
11022
- var item = _this.model.getSelectedItemByText(itemText);
11023
- _this.model.setSelection(item);
11024
- }
11025
- else {
11026
- itemText = data.points[0].data.name;
11027
- var propertyLabel = data.points[0].label;
11028
- var seriesValues = _this.model.getSeriesValues();
11029
- var seriesLabels = _this.model.getSeriesLabels();
11030
- var propertyValue = seriesValues[seriesLabels.indexOf(propertyLabel)];
11031
- var selectedItem = _this.model.getSelectedItemByText(itemText);
11032
- var item = new survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue((_a = {}, _a[propertyValue] = selectedItem.value, _a), propertyLabel + ": " + selectedItem.text);
11033
- _this.model.setSelection(item);
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);
11034
10507
  }
11035
- // const itemText = plotlyOptions.hasSeries
11036
- // ? data.points[0].data.name
11037
- // : Array.isArray(data.points[0].customdata)
11038
- // ? data.points[0].customdata[0]
11039
- // : data.points[0].customdata;
11040
- // const item: ItemValue = this.model.getSelectedItemByText(itemText);
11041
- // this.model.setSelection(item);
11042
- }
11043
- });
10508
+ });
10509
+ }
11044
10510
  getDragLayer = function () {
11045
10511
  return chartNode.getElementsByClassName("nsewdrag")[0];
11046
10512
  };
@@ -11061,39 +10527,48 @@ var PlotlyChartAdapter = /** @class */ (function () {
11061
10527
  };
11062
10528
  PlotlyChartAdapter.prototype.update = function (chartNode) {
11063
10529
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
11064
- var answersData, plotlyOptions, config, options, plot;
10530
+ var answersData, _a, plotlyOptions, config, options, plot;
11065
10531
  var _this = this;
11066
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
11067
- switch (_a.label) {
11068
- case 0: return [4 /*yield*/, this.model.getAnswersData()];
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()];
11069
10537
  case 1:
11070
- answersData = _a.sent();
11071
- plotlyOptions = _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.setup(this.model.chartType, this.model, answersData);
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);
11072
10547
  config = {
11073
10548
  displaylogo: false,
11074
10549
  responsive: true,
11075
- locale: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.currentLocale,
10550
+ locale: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.currentLocale,
11076
10551
  modeBarButtonsToRemove: ["toImage"],
11077
10552
  modeBarButtonsToAdd: [
11078
10553
  {
11079
10554
  name: "toImageSjs",
11080
- title: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("saveDiagramAsPNG"),
11081
- icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
10555
+ title: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.getString("saveDiagramAsPNG"),
10556
+ icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().Icons).camera,
11082
10557
  click: function (gd) {
11083
10558
  var options = {
11084
- format: _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.imageExportFormat,
10559
+ format: _setup__WEBPACK_IMPORTED_MODULE_5__.PlotlySetup.imageExportFormat,
11085
10560
  // width: 800,
11086
10561
  // height: 600,
11087
10562
  filename: _this.model.question.name,
11088
10563
  };
11089
- _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onImageSaving.fire(_this.model, options);
11090
- plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
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);
11091
10566
  },
11092
10567
  },
11093
10568
  ],
11094
10569
  };
11095
- if (SelectBasePlotly.displayModeBar !== undefined) {
11096
- config.displayModeBar = SelectBasePlotly.displayModeBar;
10570
+ if (_legacy__WEBPACK_IMPORTED_MODULE_8__.SelectBasePlotly.displayModeBar !== undefined) {
10571
+ config.displayModeBar = _legacy__WEBPACK_IMPORTED_MODULE_8__.SelectBasePlotly.displayModeBar;
11097
10572
  }
11098
10573
  this.patchConfigParameters(chartNode, plotlyOptions.traces, plotlyOptions.layout, config);
11099
10574
  options = {
@@ -11101,8 +10576,8 @@ var PlotlyChartAdapter = /** @class */ (function () {
11101
10576
  layout: plotlyOptions.layout,
11102
10577
  config: config,
11103
10578
  };
11104
- _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onPlotCreating.fire(this.model, options);
11105
- plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().react(chartNode, options.traces, options.layout, options.config);
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);
11106
10581
  return [2 /*return*/, [plot, plotlyOptions]];
11107
10582
  }
11108
10583
  });
@@ -11110,70 +10585,157 @@ var PlotlyChartAdapter = /** @class */ (function () {
11110
10585
  };
11111
10586
  PlotlyChartAdapter.prototype.destroy = function (node) {
11112
10587
  if (!!node) {
11113
- plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().purge(node);
10588
+ plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_4___default().purge(node);
11114
10589
  }
11115
10590
  this._chart = undefined;
11116
10591
  };
11117
10592
  return PlotlyChartAdapter;
11118
10593
  }());
11119
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
+
11120
10666
  var SelectBasePlotly = /** @class */ (function (_super) {
11121
10667
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(SelectBasePlotly, _super);
11122
- function SelectBasePlotly(question, data, options, name) {
11123
- if (options === void 0) { options = {}; }
11124
- var _this = _super.call(this, question, data, options, name) || this;
11125
- _this.chartTypes = [].concat(SelectBasePlotly.types);
11126
- if (_this.getSeriesValues().length > 0 && _this.chartTypes.indexOf("stackedbar") === -1) {
11127
- _this.chartTypes.push("stackedbar");
11128
- }
11129
- if (options.allowExperimentalFeatures) {
11130
- // this.chartTypes.splice(1, 0, "vbar");
11131
- }
11132
- _this._chartType = _this.chartTypes[0];
11133
- if (_this.chartTypes.indexOf(options.defaultChartType) !== -1) {
11134
- _this._chartType = options.defaultChartType;
11135
- }
11136
- _this._chartAdapter = new PlotlyChartAdapter(_this);
11137
- return _this;
10668
+ function SelectBasePlotly() {
10669
+ return _super !== null && _super.apply(this, arguments) || this;
11138
10670
  }
11139
- SelectBasePlotly.prototype.destroyContent = function (container) {
11140
- this._chartAdapter.destroy(container.children[0]);
11141
- _super.prototype.destroyContent.call(this, container);
11142
- };
11143
- SelectBasePlotly.prototype.renderContentAsync = function (container) {
11144
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
11145
- var chartNode;
11146
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
11147
- switch (_a.label) {
11148
- case 0:
11149
- chartNode = _utils__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createElement("div");
11150
- container.innerHTML = "";
11151
- container.appendChild(chartNode);
11152
- return [4 /*yield*/, this._chartAdapter.create(chartNode)];
11153
- case 1:
11154
- _a.sent();
11155
- return [2 /*return*/, container];
11156
- }
11157
- });
11158
- });
11159
- };
11160
- SelectBasePlotly.prototype.updateContent = function () {
11161
- var _a;
11162
- var chartNode = (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.children[0];
11163
- if (chartNode) {
11164
- this._chartAdapter.update(chartNode);
11165
- }
11166
- };
11167
10671
  SelectBasePlotly.types = ["bar", "vbar", "pie", "doughnut"];
11168
10672
  SelectBasePlotly.displayModeBar = undefined;
11169
10673
  return SelectBasePlotly;
11170
10674
  }(_selectBase__WEBPACK_IMPORTED_MODULE_2__.SelectBase));
11171
10675
 
11172
- _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("checkbox", SelectBasePlotly);
11173
- _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("radiogroup", SelectBasePlotly);
11174
- _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("dropdown", SelectBasePlotly);
11175
- _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("imagepicker", SelectBasePlotly);
11176
- _visualizationManager__WEBPACK_IMPORTED_MODULE_3__.VisualizationManager.registerVisualizer("tagbox", SelectBasePlotly);
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
+
11177
10739
 
11178
10740
 
11179
10741
  /***/ }),
@@ -11192,6 +10754,10 @@ __webpack_require__.r(__webpack_exports__);
11192
10754
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "survey-core");
11193
10755
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_0__);
11194
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
+
11195
10761
 
11196
10762
 
11197
10763
  var PlotlySetup = /** @class */ (function () {
@@ -11557,6 +11123,49 @@ var PlotlySetup = /** @class */ (function () {
11557
11123
  }
11558
11124
  return { traces: traces, layout: layout, hasSeries: hasSeries };
11559
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
+ };
11560
11169
  PlotlySetup.imageExportFormat = "png";
11561
11170
  /**
11562
11171
  * Fires when end user clicks on the 'save as image' button.
@@ -11575,6 +11184,8 @@ var PlotlySetup = /** @class */ (function () {
11575
11184
  doughnut: PlotlySetup.setupPie,
11576
11185
  pie: PlotlySetup.setupPie,
11577
11186
  scatter: PlotlySetup.setupScatter,
11187
+ gauge: PlotlySetup.setupGauge,
11188
+ bullet: PlotlySetup.setupGauge,
11578
11189
  };
11579
11190
  PlotlySetup.getTruncatedLabel = function (label, labelTruncateLength) {
11580
11191
  var truncateSymbols = "...";
@@ -11592,6 +11203,66 @@ var PlotlySetup = /** @class */ (function () {
11592
11203
 
11593
11204
 
11594
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
+
11595
11266
  /***/ }),
11596
11267
 
11597
11268
  /***/ "./src/selectBase.ts":
@@ -11612,6 +11283,8 @@ __webpack_require__.r(__webpack_exports__);
11612
11283
  /* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
11613
11284
  /* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
11614
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
+
11615
11288
 
11616
11289
 
11617
11290
 
@@ -11722,6 +11395,20 @@ var SelectBase = /** @class */ (function (_super) {
11722
11395
  _this._hideEmptyAnswers = _this.options.hideEmptyAnswers === true;
11723
11396
  _this._answersOrder = _this.options.answersOrder || "default";
11724
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
+ }
11725
11412
  _this.registerToolbarItem("changeChartType", function () {
11726
11413
  if (_this.chartTypes.length > 1) {
11727
11414
  return _utils_index__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
@@ -11904,6 +11591,16 @@ var SelectBase = /** @class */ (function (_super) {
11904
11591
  var selectBaseQuestion = this.question;
11905
11592
  return resultValues.map(function (value) { return survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue.getTextOrHtmlByValue(selectBaseQuestion.choices, value); }).join(", ");
11906
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
+ };
11907
11604
  SelectBase.prototype.getSelectedItemByText = function (itemText) {
11908
11605
  var selBase = this.question;
11909
11606
  if (this.question.hasOther && itemText == selBase.otherText) {
@@ -12265,6 +11962,11 @@ var SelectBase = /** @class */ (function (_super) {
12265
11962
  return SelectBase;
12266
11963
  }(_visualizerBase__WEBPACK_IMPORTED_MODULE_2__.VisualizerBase));
12267
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);
12268
11970
 
12269
11971
 
12270
11972
  /***/ }),
@@ -14293,6 +13995,7 @@ var VisualizerBase = /** @class */ (function () {
14293
13995
  this.contentContainer = undefined;
14294
13996
  this.footerContainer = undefined;
14295
13997
  this._supportSelection = false;
13998
+ this._chartAdapter = undefined;
14296
13999
  /**
14297
14000
  * An event that is raised after the visualizer's content is rendered.
14298
14001
  *
@@ -14665,9 +14368,10 @@ var VisualizerBase = /** @class */ (function () {
14665
14368
  if (!!this.options && typeof this.options.destroyContent === "function") {
14666
14369
  this.options.destroyContent(container, this);
14667
14370
  }
14668
- else {
14669
- container.innerHTML = "";
14371
+ else if (this._chartAdapter) {
14372
+ this._chartAdapter.destroy(container.children[0]);
14670
14373
  }
14374
+ container.innerHTML = "";
14671
14375
  };
14672
14376
  VisualizerBase.prototype.renderHeader = function (container) {
14673
14377
  if (!!this.options && typeof this.options.renderHeader === "function") {
@@ -14681,11 +14385,23 @@ var VisualizerBase = /** @class */ (function () {
14681
14385
  };
14682
14386
  VisualizerBase.prototype.renderContentAsync = function (container) {
14683
14387
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
14388
+ var chartNode;
14684
14389
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
14685
- return [2 /*return*/, new Promise(function (resolve, reject) {
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:
14686
14401
  container.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("noVisualizerForQuestion");
14687
- resolve(container);
14688
- })];
14402
+ _a.label = 3;
14403
+ case 3: return [2 /*return*/, container];
14404
+ }
14689
14405
  });
14690
14406
  });
14691
14407
  };
@@ -14777,10 +14493,23 @@ var VisualizerBase = /** @class */ (function () {
14777
14493
  });
14778
14494
  }
14779
14495
  };
14780
- VisualizerBase.prototype.updateContent = function () {
14496
+ VisualizerBase.prototype.isSupportSoftUpdateContent = function () {
14497
+ return false;
14498
+ };
14499
+ VisualizerBase.prototype.softUpdateContent = function () {
14500
+ };
14501
+ VisualizerBase.prototype.hardUpdateContent = function () {
14781
14502
  this.destroyContent(this.contentContainer);
14782
14503
  this.renderContent(this.contentContainer);
14783
14504
  };
14505
+ VisualizerBase.prototype.updateContent = function () {
14506
+ if (!this.isSupportSoftUpdateContent()) {
14507
+ this.hardUpdateContent();
14508
+ }
14509
+ else {
14510
+ this.softUpdateContent();
14511
+ }
14512
+ };
14784
14513
  /**
14785
14514
  * Re-renders the visualizer and its content.
14786
14515
  */
@@ -14985,6 +14714,7 @@ var VisualizerBase = /** @class */ (function () {
14985
14714
  }
14986
14715
  };
14987
14716
  VisualizerBase.suppressVisualizerStubRendering = false;
14717
+ VisualizerBase.chartAdapterType = undefined;
14988
14718
  // public static otherCommentQuestionType = "comment"; // TODO: make it configureable - allow choose what kind of question/visualizer will be used for comments/others
14989
14719
  VisualizerBase.otherCommentCollapsed = true;
14990
14720
  VisualizerBase.customColors = [];
@@ -17056,11 +16786,10 @@ __webpack_require__.r(__webpack_exports__);
17056
16786
  /* harmony export */ NumberModel: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.NumberModel),
17057
16787
  /* harmony export */ PivotModel: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.PivotModel),
17058
16788
  /* harmony export */ PivotPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PivotPlotly),
17059
- /* harmony export */ PlotlyBoolChartAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlyBoolChartAdapter),
17060
16789
  /* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlyChartAdapter),
17061
- /* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlyGaugeAdapter),
17062
16790
  /* harmony export */ PlotlySetup: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.PlotlySetup),
17063
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),
17064
16793
  /* harmony export */ RankingPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.RankingPlotly),
17065
16794
  /* harmony export */ SelectBase: () => (/* reexport safe */ _summary_core__WEBPACK_IMPORTED_MODULE_1__.SelectBase),
17066
16795
  /* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_0__.SelectBasePlotly),