survey-analytics 2.5.16 → 3.0.0-beta.1

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 (237) hide show
  1. package/fesm/shared.mjs +759 -3180
  2. package/fesm/shared.mjs.map +1 -1
  3. package/fesm/shared2.mjs +10561 -8296
  4. package/fesm/shared2.mjs.map +1 -1
  5. package/fesm/shared3.mjs +4844 -0
  6. package/fesm/shared3.mjs.map +1 -0
  7. package/fesm/shared4.mjs +42 -0
  8. package/fesm/shared4.mjs.map +1 -0
  9. package/fesm/survey.analytics.apexcharts.mjs +1082 -0
  10. package/fesm/survey.analytics.apexcharts.mjs.map +1 -0
  11. package/fesm/survey.analytics.core.mjs +3 -3
  12. package/fesm/survey.analytics.mjs +7 -755
  13. package/fesm/survey.analytics.mjs.map +1 -1
  14. package/fesm/survey.analytics.mongo.mjs +1 -1
  15. package/fesm/survey.analytics.plotly.mjs +13 -0
  16. package/fesm/survey.analytics.plotly.mjs.map +1 -0
  17. package/fesm/survey.analytics.tabulator.mjs +341 -193
  18. package/fesm/survey.analytics.tabulator.mjs.map +1 -1
  19. package/fesm/themes/index.mjs +1942 -0
  20. package/fesm/themes/index.mjs.map +1 -0
  21. package/package.json +39 -10
  22. package/survey-analytics-plotly.types/alternativeVizualizersWrapper.d.ts +73 -0
  23. package/survey-analytics-plotly.types/analytics-localization/arabic.d.ts +100 -0
  24. package/survey-analytics-plotly.types/analytics-localization/dutch.d.ts +100 -0
  25. package/survey-analytics-plotly.types/analytics-localization/english.d.ts +142 -0
  26. package/survey-analytics-plotly.types/analytics-localization/farsi.d.ts +100 -0
  27. package/survey-analytics-plotly.types/analytics-localization/finnish.d.ts +100 -0
  28. package/survey-analytics-plotly.types/analytics-localization/french.d.ts +100 -0
  29. package/survey-analytics-plotly.types/analytics-localization/german.d.ts +100 -0
  30. package/survey-analytics-plotly.types/analytics-localization/italian.d.ts +100 -0
  31. package/survey-analytics-plotly.types/analytics-localization/japanese.d.ts +100 -0
  32. package/survey-analytics-plotly.types/analytics-localization/norwegian.d.ts +100 -0
  33. package/survey-analytics-plotly.types/analytics-localization/polish.d.ts +100 -0
  34. package/survey-analytics-plotly.types/analytics-localization/portuguese.d.ts +100 -0
  35. package/survey-analytics-plotly.types/analytics-localization/russian.d.ts +100 -0
  36. package/survey-analytics-plotly.types/analytics-localization/spanish.d.ts +100 -0
  37. package/survey-analytics-plotly.types/analytics-localization/swedish.d.ts +100 -0
  38. package/survey-analytics-plotly.types/axisDescription.d.ts +6 -0
  39. package/survey-analytics-plotly.types/boolean.d.ts +15 -0
  40. package/survey-analytics-plotly.types/card.d.ts +29 -0
  41. package/survey-analytics-plotly.types/chartConfig.d.ts +9 -0
  42. package/survey-analytics-plotly.types/config.d.ts +35 -0
  43. package/survey-analytics-plotly.types/dashboard.d.ts +51 -0
  44. package/survey-analytics-plotly.types/dataProvider.d.ts +69 -0
  45. package/survey-analytics-plotly.types/entries/plotly.d.ts +2 -0
  46. package/survey-analytics-plotly.types/entries/summary.core.d.ts +46 -0
  47. package/survey-analytics-plotly.types/filterInfo.d.ts +11 -0
  48. package/survey-analytics-plotly.types/histogram.d.ts +102 -0
  49. package/{survey-analytics.types/layoutEngine.d.ts → survey-analytics-plotly.types/layout-engine.d.ts} +0 -12
  50. package/survey-analytics-plotly.types/localizationManager.d.ts +164 -0
  51. package/survey-analytics-plotly.types/matrix.d.ts +17 -0
  52. package/survey-analytics-plotly.types/matrixDropdownGrouped.d.ts +15 -0
  53. package/survey-analytics-plotly.types/muuri-layout-engine.d.ts +13 -0
  54. package/survey-analytics-plotly.types/nps.d.ts +37 -0
  55. package/survey-analytics-plotly.types/number.d.ts +27 -0
  56. package/survey-analytics-plotly.types/pivot.d.ts +71 -0
  57. package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/chart-adapter.d.ts +11 -2
  58. package/survey-analytics-plotly.types/plotly/setup.d.ts +150 -0
  59. package/survey-analytics-plotly.types/ranking.d.ts +12 -0
  60. package/survey-analytics-plotly.types/selectBase.d.ts +117 -0
  61. package/survey-analytics-plotly.types/sideBarItemCreators.d.ts +7 -0
  62. package/survey-analytics-plotly.types/statisticCalculators.d.ts +9 -0
  63. package/survey-analytics-plotly.types/statistics-table.d.ts +28 -0
  64. package/survey-analytics-plotly.types/svgbundle.d.ts +2 -0
  65. package/survey-analytics-plotly.types/text.d.ts +25 -0
  66. package/survey-analytics-plotly.types/theme.d.ts +51 -0
  67. package/survey-analytics-plotly.types/themes/default-light.d.ts +965 -0
  68. package/survey-analytics-plotly.types/utils/calculationDateRanges.d.ts +35 -0
  69. package/survey-analytics-plotly.types/utils/dateRangeModel.d.ts +32 -0
  70. package/survey-analytics-plotly.types/utils/dateRangeWidget.d.ts +38 -0
  71. package/survey-analytics-plotly.types/utils/documentHelper.d.ts +28 -0
  72. package/survey-analytics-plotly.types/utils/dropdownActionWidget.d.ts +34 -0
  73. package/survey-analytics-plotly.types/utils/dropdownBase.d.ts +48 -0
  74. package/survey-analytics-plotly.types/utils/dropdownWidget.d.ts +46 -0
  75. package/survey-analytics-plotly.types/utils/editableSeriesListWidget.d.ts +34 -0
  76. package/survey-analytics-plotly.types/utils/elementVisibilityAction.d.ts +22 -0
  77. package/survey-analytics-plotly.types/utils/index.d.ts +25 -0
  78. package/survey-analytics-plotly.types/utils/sidebarWidget.d.ts +48 -0
  79. package/survey-analytics-plotly.types/utils/toggle.d.ts +17 -0
  80. package/survey-analytics-plotly.types/utils/utils.d.ts +9 -0
  81. package/survey-analytics-plotly.types/visualizationComposite.d.ts +8 -0
  82. package/survey-analytics-plotly.types/visualizationManager.d.ts +61 -0
  83. package/survey-analytics-plotly.types/visualizationMatrixDropdown.d.ts +23 -0
  84. package/survey-analytics-plotly.types/visualizationMatrixDynamic.d.ts +8 -0
  85. package/survey-analytics-plotly.types/visualizationPanel.d.ts +464 -0
  86. package/survey-analytics-plotly.types/visualizationPanelDynamic.d.ts +20 -0
  87. package/survey-analytics-plotly.types/visualizer-interfaces.d.ts +25 -0
  88. package/survey-analytics-plotly.types/visualizerBase.d.ts +435 -0
  89. package/survey-analytics-plotly.types/visualizerDescription.d.ts +4 -0
  90. package/survey-analytics-plotly.types/visualizerFactory.d.ts +41 -0
  91. package/survey-analytics-plotly.types/wordcloud/stopwords/dutch.d.ts +1 -0
  92. package/survey-analytics-plotly.types/wordcloud/stopwords/english.d.ts +1 -0
  93. package/survey-analytics-plotly.types/wordcloud/stopwords/index.d.ts +3 -0
  94. package/survey-analytics-plotly.types/wordcloud/stopwords/norwegian.d.ts +1 -0
  95. package/survey-analytics-plotly.types/wordcloud/stopwords/spanish.d.ts +1 -0
  96. package/survey-analytics-plotly.types/wordcloud/widget.d.ts +38 -0
  97. package/survey-analytics-plotly.types/wordcloud/wordcloud.d.ts +28 -0
  98. package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +40 -0
  99. package/survey-analytics-tabulator.types/entries/tabulator.d.ts +2 -25
  100. package/survey-analytics-tabulator.types/entries/tabulator.fontless.d.ts +26 -0
  101. package/survey-analytics-tabulator.types/localizationManager.d.ts +40 -0
  102. package/survey-analytics-tabulator.types/tables/columnbuilder.d.ts +16 -16
  103. package/survey-analytics-tabulator.types/tables/columns.d.ts +18 -18
  104. package/survey-analytics-tabulator.types/tables/config.d.ts +2 -2
  105. package/survey-analytics-tabulator.types/tables/extensions/footerextensions.d.ts +1 -0
  106. package/survey-analytics-tabulator.types/tables/extensions/tableextensions.d.ts +2 -1
  107. package/survey-analytics-tabulator.types/tables/table-interfaces.d.ts +56 -0
  108. package/survey-analytics-tabulator.types/tables/table.d.ts +4 -48
  109. package/survey-analytics-tabulator.types/tables/tabulator.d.ts +9 -1
  110. package/survey-analytics-tabulator.types/theme.d.ts +51 -0
  111. package/survey-analytics-tabulator.types/themes/default-light.d.ts +965 -0
  112. package/survey-analytics-tabulator.types/utils/documentHelper.d.ts +28 -0
  113. package/survey-analytics-tabulator.types/utils/dropdownActionWidget.d.ts +34 -0
  114. package/survey-analytics-tabulator.types/utils/dropdownBase.d.ts +48 -0
  115. package/survey-analytics-tabulator.types/utils/index.d.ts +1 -15
  116. package/survey-analytics.types/alternativeVizualizersWrapper.d.ts +9 -4
  117. package/survey-analytics.types/analytics-localization/english.d.ts +40 -0
  118. package/survey-analytics.types/apexcharts/chart-adapter.d.ts +29 -0
  119. package/survey-analytics.types/apexcharts/index.d.ts +2 -0
  120. package/survey-analytics.types/apexcharts/setup.d.ts +200 -0
  121. package/survey-analytics.types/axisDescription.d.ts +6 -0
  122. package/survey-analytics.types/boolean.d.ts +1 -1
  123. package/survey-analytics.types/card.d.ts +29 -0
  124. package/survey-analytics.types/chartConfig.d.ts +9 -0
  125. package/survey-analytics.types/config.d.ts +1 -33
  126. package/survey-analytics.types/dashboard.d.ts +51 -0
  127. package/survey-analytics.types/dataProvider.d.ts +17 -0
  128. package/survey-analytics.types/entries/apexcharts.d.ts +2 -0
  129. package/survey-analytics.types/entries/apexcharts.fontless.d.ts +2 -0
  130. package/survey-analytics.types/entries/summary.core.d.ts +9 -1
  131. package/survey-analytics.types/histogram.d.ts +29 -13
  132. package/survey-analytics.types/layout-engine.d.ts +29 -0
  133. package/survey-analytics.types/localizationManager.d.ts +40 -0
  134. package/survey-analytics.types/matrix.d.ts +3 -2
  135. package/survey-analytics.types/matrixDropdownGrouped.d.ts +3 -2
  136. package/survey-analytics.types/muuri-layout-engine.d.ts +13 -0
  137. package/survey-analytics.types/nps.d.ts +5 -10
  138. package/survey-analytics.types/number.d.ts +8 -7
  139. package/survey-analytics.types/pivot.d.ts +42 -40
  140. package/survey-analytics.types/ranking.d.ts +3 -2
  141. package/survey-analytics.types/selectBase.d.ts +13 -15
  142. package/survey-analytics.types/sideBarItemCreators.d.ts +7 -0
  143. package/survey-analytics.types/statisticCalculators.d.ts +8 -13
  144. package/survey-analytics.types/statistics-table.d.ts +2 -2
  145. package/survey-analytics.types/text.d.ts +4 -3
  146. package/survey-analytics.types/theme.d.ts +51 -0
  147. package/survey-analytics.types/themes/default-light.d.ts +965 -0
  148. package/survey-analytics.types/utils/calculationDateRanges.d.ts +35 -0
  149. package/survey-analytics.types/utils/dateRangeModel.d.ts +32 -0
  150. package/survey-analytics.types/utils/dateRangeWidget.d.ts +38 -0
  151. package/survey-analytics.types/utils/documentHelper.d.ts +28 -0
  152. package/survey-analytics.types/utils/dropdownActionWidget.d.ts +34 -0
  153. package/survey-analytics.types/utils/dropdownBase.d.ts +48 -0
  154. package/survey-analytics.types/utils/dropdownWidget.d.ts +46 -0
  155. package/survey-analytics.types/utils/editableSeriesListWidget.d.ts +34 -0
  156. package/survey-analytics.types/utils/elementVisibilityAction.d.ts +22 -0
  157. package/survey-analytics.types/utils/index.d.ts +1 -15
  158. package/survey-analytics.types/utils/sidebarWidget.d.ts +48 -0
  159. package/survey-analytics.types/utils/toggle.d.ts +17 -0
  160. package/survey-analytics.types/utils/utils.d.ts +9 -0
  161. package/survey-analytics.types/visualizationComposite.d.ts +1 -1
  162. package/survey-analytics.types/visualizationManager.d.ts +6 -5
  163. package/survey-analytics.types/visualizationMatrixDropdown.d.ts +2 -1
  164. package/survey-analytics.types/visualizationMatrixDynamic.d.ts +1 -1
  165. package/survey-analytics.types/visualizationPanel.d.ts +20 -3
  166. package/survey-analytics.types/visualizationPanelDynamic.d.ts +4 -3
  167. package/survey-analytics.types/visualizer-interfaces.d.ts +25 -0
  168. package/survey-analytics.types/visualizerBase.d.ts +80 -12
  169. package/survey-analytics.types/visualizerDescription.d.ts +4 -0
  170. package/survey-analytics.types/visualizerFactory.d.ts +11 -2
  171. package/survey-analytics.types/wordcloud/wordcloud.d.ts +6 -4
  172. package/survey.analytics.core.css +1534 -122
  173. package/survey.analytics.core.css.map +1 -1
  174. package/survey.analytics.core.d.ts +1 -0
  175. package/survey.analytics.core.js +6118 -1229
  176. package/survey.analytics.core.js.map +1 -1
  177. package/survey.analytics.core.min.css +11 -6
  178. package/survey.analytics.core.min.js +1 -1
  179. package/survey.analytics.core.min.js.LICENSE.txt +1 -1
  180. package/survey.analytics.css +1900 -129
  181. package/survey.analytics.css.map +1 -1
  182. package/survey.analytics.d.ts +2 -2
  183. package/survey.analytics.fontless.css +2009 -0
  184. package/survey.analytics.fontless.css.map +1 -0
  185. package/survey.analytics.fontless.min.css +16 -0
  186. package/survey.analytics.js +9764 -4539
  187. package/survey.analytics.js.map +1 -1
  188. package/survey.analytics.min.css +13 -6
  189. package/survey.analytics.min.js +1 -1
  190. package/survey.analytics.min.js.LICENSE.txt +1 -1
  191. package/survey.analytics.mongo.d.ts +1 -0
  192. package/survey.analytics.mongo.js +2 -2
  193. package/survey.analytics.mongo.js.map +1 -1
  194. package/survey.analytics.mongo.min.js +1 -1
  195. package/survey.analytics.mongo.min.js.LICENSE.txt +1 -1
  196. package/survey.analytics.plotly.css +2094 -0
  197. package/survey.analytics.plotly.css.map +1 -0
  198. package/survey.analytics.plotly.d.ts +2 -0
  199. package/survey.analytics.plotly.fontless.css +1872 -0
  200. package/survey.analytics.plotly.fontless.css.map +1 -0
  201. package/survey.analytics.plotly.fontless.min.css +15 -0
  202. package/survey.analytics.plotly.js +24673 -0
  203. package/survey.analytics.plotly.js.map +1 -0
  204. package/survey.analytics.plotly.min.css +16 -0
  205. package/survey.analytics.plotly.min.js +2 -0
  206. package/survey.analytics.plotly.min.js.LICENSE.txt +22 -0
  207. package/survey.analytics.tabulator.css +1005 -132
  208. package/survey.analytics.tabulator.css.map +1 -1
  209. package/survey.analytics.tabulator.d.ts +1 -0
  210. package/survey.analytics.tabulator.fontless.css +1134 -0
  211. package/survey.analytics.tabulator.fontless.css.map +1 -0
  212. package/survey.analytics.tabulator.fontless.min.css +6 -0
  213. package/survey.analytics.tabulator.js +2719 -476
  214. package/survey.analytics.tabulator.js.map +1 -1
  215. package/survey.analytics.tabulator.min.css +3 -2
  216. package/survey.analytics.tabulator.min.js +1 -1
  217. package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
  218. package/themes/default-dark.js +1032 -0
  219. package/themes/default-dark.js.map +1 -0
  220. package/themes/default-dark.min.js +2 -0
  221. package/themes/default-dark.min.js.LICENSE.txt +5 -0
  222. package/themes/default-light.js +1032 -0
  223. package/themes/default-light.js.map +1 -0
  224. package/themes/default-light.min.js +2 -0
  225. package/themes/default-light.min.js.LICENSE.txt +5 -0
  226. package/themes/index.js +2063 -0
  227. package/themes/index.js.map +1 -0
  228. package/themes/index.min.js +2 -0
  229. package/themes/index.min.js.LICENSE.txt +5 -0
  230. package/themes/themes/default-dark.d.ts +965 -0
  231. package/themes/themes/default-light.d.ts +965 -0
  232. package/themes/themes/index.d.ts +1934 -0
  233. package/themes/utils/helpers.d.ts +8 -0
  234. package/survey-analytics.types/plotly/setup.d.ts +0 -32
  235. /package/{survey-analytics.types/entries/summary.d.ts → survey-analytics-plotly.types/entries/plotly.fontless.d.ts} +0 -0
  236. /package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/index.d.ts +0 -0
  237. /package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/legacy.d.ts +0 -0
@@ -0,0 +1,1082 @@
1
+ /*!
2
+ * surveyjs - SurveyJS Dashboard library v3.0.0-beta.1
3
+ * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
+ * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
+ */
6
+
7
+ import { Event, ItemValue } from 'survey-core';
8
+ import { l as localization, d as DataHelper, D as DashboardTheme } from './shared3.mjs';
9
+ export { a as DocumentHelper, c as createActionDropdown, s as setupLocale, b as surveyStrings } from './shared3.mjs';
10
+ import { h as NumberModel, s as VisualizerBase, _ as __awaiter, S as SelectBase } from './shared2.mjs';
11
+ export { A as AlternativeVisualizersWrapper, B as BooleanModel, C as CardAdapter, a as CardVisualizer, b as CardVisualizerWidget, D as Dashboard, c as DataProvider, H as HistogramModel, L as LayoutEngine, M as Matrix, d as MatrixDropdownGrouped, e as MuuriLayoutEngine, N as NpsAdapter, f as NpsVisualizer, g as NpsVisualizerWidget, P as PivotModel, i as PostponeHelper, R as RankingModel, j as StatisticsTable, k as StatisticsTableAdapter, l as StatisticsTableBoolean, T as Text, m as TextTableAdapter, V as VisualizationComposite, n as VisualizationManager, o as VisualizationMatrixDropdown, p as VisualizationMatrixDynamic, q as VisualizationPanel, r as VisualizationPanelDynamic, t as VisualizerFactory, W as WordCloud, u as WordCloudAdapter, v as createDropdown, w as getBestIntervalMode, x as getVisualizerDescriptions, y as hideEmptyAnswersInData, z as intervalCalculators, E as textHelper } from './shared2.mjs';
12
+ import { i as isAllZeros, r as reverseAll, a as removeUndefinedProperties } from './shared4.mjs';
13
+ import ApexCharts from 'apexcharts';
14
+
15
+ class ApexChartsSetup {
16
+ static defaultDataLabelsConfig(theme) {
17
+ const insideLabelFont = theme.insideLabelFont;
18
+ return {
19
+ enabled: true,
20
+ style: {
21
+ colors: [insideLabelFont.color],
22
+ fontSize: insideLabelFont.size,
23
+ fontFamily: insideLabelFont.family,
24
+ fontWeight: insideLabelFont.weight,
25
+ }
26
+ };
27
+ }
28
+ static defaultTooltipConfig(theme) {
29
+ const font = theme.tooltipFont;
30
+ return {
31
+ enabled: true,
32
+ fillSeriesColor: false,
33
+ style: {
34
+ fontSize: font.size,
35
+ fontFamily: font.family,
36
+ },
37
+ marker: {
38
+ show: false,
39
+ },
40
+ x: {
41
+ formatter: () => "",
42
+ },
43
+ y: {
44
+ formatter: function (val) {
45
+ return val.toString();
46
+ },
47
+ title: {
48
+ formatter: () => "",
49
+ },
50
+ }
51
+ };
52
+ }
53
+ static defaultLegendConfig(model) {
54
+ const font = model.theme.legendLabelFont;
55
+ return {
56
+ position: model.legendPosition,
57
+ horizontalAlign: "left",
58
+ verticalAlign: "top",
59
+ fontSize: font.size,
60
+ fontFamily: font.family,
61
+ fontWeight: font.weight,
62
+ labels: {
63
+ colors: font.color
64
+ },
65
+ markers: {
66
+ size: 10,
67
+ strokeWidth: 1,
68
+ shape: "square",
69
+ // customHTML: function() {
70
+ // return '<span class="sa-legend-item-marker"><i class="sa-legend-item-text"></i></span>';
71
+ // }
72
+ },
73
+ };
74
+ }
75
+ static defaultAxisZerolineConfig(theme) {
76
+ return {
77
+ show: false,
78
+ color: theme.axisGridColor,
79
+ };
80
+ }
81
+ static defaultGridConfig(theme) {
82
+ return {
83
+ borderColor: theme.axisGridColor,
84
+ strokeDashArray: 4,
85
+ position: "back",
86
+ xaxis: {
87
+ lines: {
88
+ show: false,
89
+ }
90
+ },
91
+ yaxis: {
92
+ lines: {
93
+ show: false,
94
+ }
95
+ }
96
+ };
97
+ }
98
+ static defaultAxisTitleFont(theme) {
99
+ const font = theme.axisTitleFont;
100
+ return {
101
+ colors: font.color,
102
+ fontSize: font.size,
103
+ fontFamily: font.family,
104
+ fontWeight: font.weight,
105
+ };
106
+ }
107
+ static defaultAxisLabelFont(theme) {
108
+ const font = theme.axisLabelFont;
109
+ return {
110
+ colors: font.color,
111
+ fontSize: font.size,
112
+ fontFamily: font.family,
113
+ fontWeight: font.weight,
114
+ };
115
+ }
116
+ static defaultAxisConfig(theme) {
117
+ return {
118
+ title: {
119
+ style: Object.assign({}, ApexChartsSetup.defaultAxisTitleFont(theme)),
120
+ },
121
+ min: 0,
122
+ labels: {
123
+ trim: true,
124
+ hideOverlappingLabels: false,
125
+ style: Object.assign({}, ApexChartsSetup.defaultAxisLabelFont(theme)),
126
+ },
127
+ };
128
+ }
129
+ static defaultGaugeValueFont(theme) {
130
+ const font = theme.gaugeValueFont;
131
+ return {
132
+ colors: font.color,
133
+ fontSize: font.size,
134
+ fontFamily: font.family,
135
+ fontWeight: font.weight,
136
+ };
137
+ }
138
+ static defaultGaugeTickFont(theme) {
139
+ const font = theme.gaugeTickFont;
140
+ return {
141
+ colors: font.color,
142
+ fontSize: font.size,
143
+ fontFamily: font.family,
144
+ fontWeight: font.weight,
145
+ };
146
+ }
147
+ static defaultNoDataConfig(theme) {
148
+ const font = theme.noDataFont;
149
+ return {
150
+ text: localization.getString("noData"),
151
+ align: "center",
152
+ verticalAlign: "middle",
153
+ offsetX: 0,
154
+ offsetY: 0,
155
+ style: {
156
+ color: font.color,
157
+ fontSize: font.size,
158
+ fontFamily: font.family
159
+ }
160
+ };
161
+ }
162
+ static dataListFormatter(model, text, value) {
163
+ if (model.showPercentages) {
164
+ if (model.showOnlyPercentages) {
165
+ return text + "%";
166
+ }
167
+ else {
168
+ return value + " (" + text + "%)";
169
+ }
170
+ }
171
+ return value;
172
+ }
173
+ static setup(charType, model, answersData) {
174
+ return this.setups[charType](model, answersData);
175
+ }
176
+ static setupPie(model, answersData) {
177
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
178
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
179
+ // Prepare data series
180
+ let series = [];
181
+ if (hasSeries) {
182
+ // For matrix questions or multiple series
183
+ datasets.forEach((dataset, index) => {
184
+ if (!isAllZeros(dataset)) {
185
+ series.push({
186
+ series: dataset,
187
+ labels: labels,
188
+ title: seriesLabels[index]
189
+ });
190
+ }
191
+ });
192
+ }
193
+ else {
194
+ // For simple questions
195
+ if (!isAllZeros(datasets[0])) {
196
+ series = datasets[0];
197
+ }
198
+ }
199
+ const diameter = labels.length < 10 ? labels.length * 50 + 100 : 550;
200
+ // Chart settings
201
+ const chart = {
202
+ type: model.chartType === "doughnut" ? "donut" : "pie",
203
+ height: diameter,
204
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
205
+ background: "transparent"
206
+ };
207
+ // Data label settings
208
+ const dataLabels = Object.assign(Object.assign({}, ApexChartsSetup.defaultDataLabelsConfig(model.theme)), { formatter: function (val, opts) {
209
+ const name = opts.w.globals.labels[opts.seriesIndex];
210
+ const text = name.length > 15 ? name.substring(0, 15) + "..." : name;
211
+ return [text, val.toFixed(model.percentagePrecision) + "%"];
212
+ } });
213
+ // Chart options settings
214
+ const plotOptions = {
215
+ pie: {
216
+ donut: {
217
+ size: model.chartType === "doughnut" ? "40%" : "0%",
218
+ },
219
+ customScale: 1,
220
+ offsetX: 0,
221
+ offsetY: 0,
222
+ startAngle: 0,
223
+ endAngle: 360,
224
+ expandOnClick: true,
225
+ dataLabels: {
226
+ offset: model.chartType === "doughnut" ? -10 : -25,
227
+ }
228
+ }
229
+ };
230
+ // Tooltip settings
231
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
232
+ tooltip.y.title.formatter = (seriesName, opts) => {
233
+ const val = opts.w.globals.seriesPercent[opts.seriesIndex][0];
234
+ return [seriesName, val.toFixed(model.percentagePrecision) + "%"];
235
+ };
236
+ const legend = {
237
+ show: false,
238
+ };
239
+ const options = {
240
+ series,
241
+ chart,
242
+ labels: hasSeries ? seriesLabels : labels,
243
+ colors,
244
+ plotOptions,
245
+ dataLabels,
246
+ legend,
247
+ noData: ApexChartsSetup.defaultNoDataConfig(model.theme),
248
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
249
+ tooltip,
250
+ hasSeries
251
+ };
252
+ if (hasSeries) {
253
+ options.title = {
254
+ align: "center",
255
+ style: Object.assign({}, ApexChartsSetup.defaultAxisLabelFont(model.theme)),
256
+ };
257
+ }
258
+ return options;
259
+ }
260
+ static setupBar(model, answersData) {
261
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
262
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
263
+ const isHistogram = model.type === "histogram";
264
+ if (!isHistogram) {
265
+ const reversedAnswersData = reverseAll(labels, seriesLabels, colors, hasSeries, texts, datasets);
266
+ labels = reversedAnswersData.labels;
267
+ datasets = reversedAnswersData.datasets;
268
+ }
269
+ // Prepare data series
270
+ let series = [];
271
+ if (hasSeries) {
272
+ // For matrix questions or multiple series
273
+ datasets.forEach((dataset, index) => {
274
+ series.push({
275
+ name: seriesLabels[index],
276
+ data: dataset
277
+ });
278
+ });
279
+ }
280
+ else {
281
+ // For simple questions
282
+ series.push({
283
+ name: "Values",
284
+ data: datasets[0]
285
+ });
286
+ }
287
+ let lineHeight = 30;
288
+ let margin = 35;
289
+ let height = (labels.length) * lineHeight + 2 * margin;
290
+ if (hasSeries && (model.legendPosition === "top" || model.legendPosition === "bottom")) {
291
+ height += (labels.length * seriesLabels.length) * lineHeight;
292
+ }
293
+ else if (hasSeries) {
294
+ height = (labels.length * seriesLabels.length) * lineHeight + 2 * margin;
295
+ }
296
+ // Chart settings
297
+ const chart = {
298
+ type: "bar",
299
+ height: height,
300
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
301
+ background: "transparent"
302
+ };
303
+ // Axis settings
304
+ const xaxis = Object.assign(Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme)), { categories: labels, axisBorder: {
305
+ show: false,
306
+ } });
307
+ const yaxis = Object.assign(Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme)), { axisBorder: Object.assign({}, ApexChartsSetup.defaultAxisZerolineConfig(model.theme)) });
308
+ const grid = Object.assign(Object.assign({}, ApexChartsSetup.defaultGridConfig(model.theme)), { xaxis: {
309
+ lines: {
310
+ show: true
311
+ }
312
+ } });
313
+ // Legend settings
314
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries });
315
+ // Data label settings
316
+ const dataLabels = Object.assign(Object.assign({}, ApexChartsSetup.defaultDataLabelsConfig(model.theme)), { formatter: function (val, opts) {
317
+ return ApexChartsSetup.dataListFormatter(model, texts[opts.seriesIndex][opts.dataPointIndex], val);
318
+ } });
319
+ // Chart options settings
320
+ const plotOptions = {
321
+ bar: {
322
+ horizontal: true,
323
+ distributed: !isHistogram && !hasSeries,
324
+ barHeight: isHistogram ? "100%" : (1 - ApexChartsSetup.defaultBarGap) * 100 + "%",
325
+ }
326
+ };
327
+ // Tooltip settings
328
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
329
+ // RTL language handling
330
+ if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
331
+ chart.direction = "rtl";
332
+ }
333
+ return {
334
+ series,
335
+ chart,
336
+ labels,
337
+ colors,
338
+ plotOptions,
339
+ dataLabels,
340
+ legend,
341
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
342
+ tooltip,
343
+ hasSeries,
344
+ grid,
345
+ xaxis,
346
+ yaxis
347
+ };
348
+ }
349
+ static setupVBar(model, answersData) {
350
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
351
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
352
+ const isHistogram = model.type === "histogram";
353
+ if (!isHistogram && model.type !== "pivot") {
354
+ ({ labels, seriesLabels, colors, texts, datasets } = reverseAll(labels, seriesLabels, colors, hasSeries, texts, datasets));
355
+ }
356
+ // Prepare data series
357
+ let series = [];
358
+ if (hasSeries) {
359
+ // For matrix questions or multiple series
360
+ datasets.forEach((dataset, index) => {
361
+ series.push({
362
+ name: seriesLabels[index],
363
+ data: dataset
364
+ });
365
+ });
366
+ }
367
+ else {
368
+ // For simple questions
369
+ series.push({
370
+ name: "Values",
371
+ data: datasets[0]
372
+ });
373
+ }
374
+ // Chart settings
375
+ const chart = {
376
+ type: "bar",
377
+ height: ApexChartsSetup.defaultChartHeight,
378
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
379
+ background: "transparent"
380
+ };
381
+ // Axis settings
382
+ const xaxis = Object.assign(Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme)), { categories: labels, axisBorder: Object.assign({}, ApexChartsSetup.defaultAxisZerolineConfig(model.theme)) });
383
+ const yaxis = model.getYAxisInfo().map(info => {
384
+ const setting = Object.assign(ApexChartsSetup.defaultAxisConfig(model.theme), info);
385
+ setting.title.style = Object.assign({}, ApexChartsSetup.defaultAxisTitleFont(model.theme));
386
+ return setting;
387
+ });
388
+ const grid = Object.assign(Object.assign({}, ApexChartsSetup.defaultGridConfig(model.theme)), { yaxis: {
389
+ lines: {
390
+ show: true
391
+ }
392
+ } });
393
+ // Legend settings
394
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries });
395
+ // Data label settings
396
+ const dataLabels = Object.assign(Object.assign({}, ApexChartsSetup.defaultDataLabelsConfig(model.theme)), { formatter: function (val, opts) {
397
+ return ApexChartsSetup.dataListFormatter(model, texts[opts.seriesIndex][opts.dataPointIndex], val);
398
+ } });
399
+ // Chart options settings
400
+ const plotOptions = {
401
+ bar: {
402
+ horizontal: false,
403
+ distributed: !isHistogram && !hasSeries,
404
+ columnWidth: isHistogram ? "100%" : (1 - ApexChartsSetup.defaultBarGap) * 100 + "%",
405
+ }
406
+ };
407
+ // Tooltip settings
408
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
409
+ // RTL language handling
410
+ if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
411
+ chart.direction = "rtl";
412
+ }
413
+ return {
414
+ series,
415
+ chart,
416
+ labels,
417
+ colors,
418
+ plotOptions,
419
+ dataLabels,
420
+ legend,
421
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
422
+ tooltip,
423
+ hasSeries,
424
+ grid,
425
+ xaxis,
426
+ yaxis
427
+ };
428
+ }
429
+ static setupLine(model, answersData) {
430
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
431
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
432
+ // Prepare data series
433
+ let series = [];
434
+ if (hasSeries) {
435
+ // For matrix questions or multiple series
436
+ datasets.forEach((dataset, index) => {
437
+ series.push({
438
+ name: seriesLabels[index],
439
+ data: dataset
440
+ });
441
+ });
442
+ }
443
+ else {
444
+ // For simple questions
445
+ series.push({
446
+ name: "Values",
447
+ data: datasets[0]
448
+ });
449
+ }
450
+ // Chart settings
451
+ const chart = {
452
+ type: "line",
453
+ height: ApexChartsSetup.defaultChartHeight,
454
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
455
+ background: "transparent"
456
+ };
457
+ // Axis settings
458
+ const xaxis = {
459
+ axisBorder: Object.assign({}, ApexChartsSetup.defaultAxisZerolineConfig(model.theme)),
460
+ categories: labels,
461
+ labels: {
462
+ style: Object.assign({}, ApexChartsSetup.defaultAxisLabelFont(model.theme))
463
+ }
464
+ };
465
+ const yaxis = model.getYAxisInfo().map(info => {
466
+ const setting = Object.assign(ApexChartsSetup.defaultAxisConfig(model.theme), info);
467
+ setting.title.style = Object.assign({}, ApexChartsSetup.defaultAxisTitleFont(model.theme));
468
+ return setting;
469
+ });
470
+ // Legend settings
471
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries });
472
+ // Data label settings
473
+ const dataLabels = {
474
+ enabled: false
475
+ };
476
+ // Chart options settings
477
+ const plotOptions = {
478
+ line: {
479
+ curve: "smooth"
480
+ }
481
+ };
482
+ // Tooltip settings
483
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
484
+ // RTL language handling
485
+ if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
486
+ chart.direction = "rtl";
487
+ }
488
+ return {
489
+ series,
490
+ chart,
491
+ labels,
492
+ colors,
493
+ plotOptions,
494
+ dataLabels,
495
+ legend,
496
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
497
+ tooltip,
498
+ hasSeries,
499
+ xaxis,
500
+ yaxis
501
+ };
502
+ }
503
+ static setupStackedBar(model, answersData) {
504
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
505
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
506
+ const reversedAnswersData = reverseAll(labels, seriesLabels, colors, hasSeries, texts, datasets);
507
+ labels = reversedAnswersData.labels;
508
+ datasets = reversedAnswersData.datasets;
509
+ // Prepare data series
510
+ let series = [];
511
+ if (hasSeries) {
512
+ // For matrix questions or multiple series
513
+ datasets.forEach((dataset, index) => {
514
+ series.push({
515
+ name: seriesLabels[index],
516
+ data: dataset
517
+ });
518
+ });
519
+ }
520
+ else {
521
+ // For simple questions
522
+ series.push({
523
+ name: "Values",
524
+ data: datasets[0]
525
+ });
526
+ }
527
+ let lineHeight = 30;
528
+ let margin = 35;
529
+ let height = labels.length * lineHeight + 2 * margin;
530
+ if (hasSeries && (model.legendPosition === "top" || model.legendPosition === "bottom")) {
531
+ height += labels.length * lineHeight;
532
+ }
533
+ // Chart settings
534
+ const chart = {
535
+ type: "bar",
536
+ stacked: true,
537
+ height: height,
538
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
539
+ background: "transparent"
540
+ };
541
+ // Axis settings
542
+ const maxValue = Math.max(...series[0].data.map((_, index) => series.reduce((sum, s) => sum + s.data[index], 0)));
543
+ const xaxis = Object.assign(Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme)), { categories: labels, max: Math.ceil(maxValue), axisBorder: Object.assign({}, ApexChartsSetup.defaultAxisZerolineConfig(model.theme)) });
544
+ const yaxis = Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme));
545
+ const grid = Object.assign(Object.assign({}, ApexChartsSetup.defaultGridConfig(model.theme)), { xaxis: {
546
+ lines: {
547
+ show: true
548
+ }
549
+ } });
550
+ // Legend settings
551
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries });
552
+ // Data label settings
553
+ const dataLabels = Object.assign({}, ApexChartsSetup.defaultDataLabelsConfig(model.theme));
554
+ // Chart options settings
555
+ const plotOptions = {
556
+ bar: {
557
+ horizontal: true,
558
+ barHeight: (1 - ApexChartsSetup.defaultBarGap) * 100 + "%",
559
+ }
560
+ };
561
+ // Tooltip settings
562
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
563
+ // RTL language handling
564
+ if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
565
+ chart.direction = "rtl";
566
+ }
567
+ return {
568
+ series,
569
+ chart,
570
+ labels,
571
+ colors,
572
+ plotOptions,
573
+ dataLabels,
574
+ legend,
575
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
576
+ tooltip,
577
+ hasSeries,
578
+ grid,
579
+ xaxis,
580
+ yaxis
581
+ };
582
+ }
583
+ static setupScatter(model, answersData) {
584
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
585
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
586
+ // Prepare data series
587
+ let series = [];
588
+ if (hasSeries) {
589
+ // For matrix questions or multiple series
590
+ datasets.forEach((dataset, index) => {
591
+ const scatterData = dataset.map((value, valueIndex) => ({
592
+ x: valueIndex,
593
+ y: value
594
+ }));
595
+ series.push({
596
+ name: seriesLabels[index],
597
+ data: scatterData
598
+ });
599
+ });
600
+ }
601
+ else {
602
+ // For simple questions
603
+ const scatterData = datasets[0].map((value, index) => ({
604
+ x: index,
605
+ y: value
606
+ }));
607
+ series.push({
608
+ name: "Values",
609
+ data: scatterData
610
+ });
611
+ }
612
+ // Chart settings
613
+ const chart = {
614
+ type: "scatter",
615
+ height: ApexChartsSetup.defaultChartHeight,
616
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
617
+ background: "transparent"
618
+ };
619
+ // Axis settings
620
+ const xaxis = {
621
+ categories: labels,
622
+ axisBorder: Object.assign({}, ApexChartsSetup.defaultAxisZerolineConfig(model.theme)),
623
+ labels: {
624
+ style: Object.assign({}, ApexChartsSetup.defaultAxisLabelFont(model.theme))
625
+ }
626
+ };
627
+ const yaxis = Object.assign({}, ApexChartsSetup.defaultAxisConfig(model.theme));
628
+ // Legend settings
629
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries });
630
+ // Data label settings
631
+ const dataLabels = {
632
+ enabled: false
633
+ };
634
+ // Chart options settings
635
+ const plotOptions = {
636
+ scatter: {
637
+ size: 6
638
+ }
639
+ };
640
+ // Tooltip settings
641
+ const tooltip = ApexChartsSetup.defaultTooltipConfig(model.theme);
642
+ // RTL language handling
643
+ if (["ar", "fa"].indexOf(localization.currentLocale) !== -1) {
644
+ chart.direction = "rtl";
645
+ }
646
+ return {
647
+ series,
648
+ chart,
649
+ labels,
650
+ colors,
651
+ plotOptions,
652
+ dataLabels,
653
+ legend,
654
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
655
+ tooltip,
656
+ hasSeries,
657
+ xaxis,
658
+ yaxis
659
+ };
660
+ }
661
+ static setupGauge(model, answersData) {
662
+ let value = answersData.datasets[0][answersData.values.indexOf(model.displayValueName || "value")];
663
+ let minValue = answersData.datasets[0][answersData.values.indexOf("min")] || 0;
664
+ let maxValue = answersData.datasets[0][answersData.values.indexOf("max")] || value * 1.25;
665
+ if (model.dataType === "rating") {
666
+ const rateValues = model.question.visibleRateValues;
667
+ maxValue = rateValues[rateValues.length - 1].value;
668
+ minValue = rateValues[0].value;
669
+ }
670
+ if (NumberModel.showAsPercentage) {
671
+ value = DataHelper.toPercentage(value, maxValue);
672
+ minValue = DataHelper.toPercentage(minValue, maxValue);
673
+ maxValue = DataHelper.toPercentage(maxValue, maxValue);
674
+ }
675
+ const chart = {
676
+ type: "radialBar",
677
+ height: ApexChartsSetup.defaultChartHeight,
678
+ background: "transparent",
679
+ toolbar: {
680
+ show: false
681
+ }
682
+ };
683
+ const plotOptions = {
684
+ radialBar: {
685
+ startAngle: -90,
686
+ endAngle: 90,
687
+ track: {
688
+ background: model.theme.gaugeBackground,
689
+ strokeWidth: "97%",
690
+ },
691
+ dataLabels: {
692
+ name: {
693
+ show: false,
694
+ },
695
+ value: Object.assign(Object.assign({}, ApexChartsSetup.defaultGaugeValueFont(model.theme)), { show: true, offsetY: -10, formatter: function (val) {
696
+ return isNaN(value) ? "_" : value.toString();
697
+ } })
698
+ }
699
+ }
700
+ };
701
+ const percent = ((value - minValue) / (maxValue - minValue)) * 100;
702
+ const yaxis = {
703
+ min: minValue,
704
+ max: maxValue,
705
+ labels: {
706
+ formatter: (val) => {
707
+ const realValue = minValue + (val / 100) * (maxValue - minValue);
708
+ return realValue.toFixed(1);
709
+ }
710
+ }
711
+ };
712
+ const series = [percent];
713
+ const labels = [model.name];
714
+ const colors = [model.theme.gaugeBarColor];
715
+ return {
716
+ series,
717
+ chart,
718
+ labels,
719
+ colors,
720
+ plotOptions,
721
+ yaxis,
722
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
723
+ // dataLabels,
724
+ };
725
+ }
726
+ static setupBullet(model, answersData) {
727
+ let value = answersData.datasets[0][answersData.values.indexOf(model.displayValueName || "value")];
728
+ let minValue = answersData.datasets[0][answersData.values.indexOf("min")] || 0;
729
+ let maxValue = answersData.datasets[0][answersData.values.indexOf("max")] || value * 1.25;
730
+ if (model.dataType === "rating") {
731
+ const rateValues = model.question.visibleRateValues;
732
+ maxValue = rateValues[rateValues.length - 1].value;
733
+ minValue = rateValues[0].value;
734
+ }
735
+ if (NumberModel.showAsPercentage) {
736
+ value = DataHelper.toPercentage(value, maxValue);
737
+ minValue = DataHelper.toPercentage(minValue, maxValue);
738
+ maxValue = DataHelper.toPercentage(maxValue, maxValue);
739
+ }
740
+ const chart = {
741
+ type: "bar",
742
+ height: 100,
743
+ background: "transparent",
744
+ toolbar: {
745
+ show: false
746
+ }
747
+ };
748
+ const plotOptions = {
749
+ bar: {
750
+ horizontal: true,
751
+ }
752
+ };
753
+ const dataLabels = {
754
+ enabled: false
755
+ };
756
+ const xaxis = {
757
+ min: minValue,
758
+ max: maxValue,
759
+ style: ApexChartsSetup.defaultGaugeTickFont(model.theme),
760
+ axisBorder: {
761
+ color: model.theme.gaugeBackground,
762
+ },
763
+ };
764
+ const yaxis = {
765
+ axisBorder: {
766
+ color: model.theme.gaugeBackground,
767
+ },
768
+ labels: {
769
+ offsetY: 10,
770
+ style: ApexChartsSetup.defaultGaugeValueFont(model.theme)
771
+ }
772
+ };
773
+ // Tooltip settings
774
+ const tooltip = { enabled: false };
775
+ const series = [{
776
+ data: [{
777
+ x: "",
778
+ y: value,
779
+ goals: [{
780
+ value: maxValue,
781
+ strokeWidth: 1,
782
+ strokeColor: model.theme.gaugeBackground,
783
+ }]
784
+ }]
785
+ }];
786
+ const labels = [value];
787
+ const colors = [model.theme.gaugeBarColor];
788
+ return {
789
+ series,
790
+ chart,
791
+ labels,
792
+ colors,
793
+ plotOptions,
794
+ xaxis,
795
+ yaxis,
796
+ dataLabels,
797
+ tooltip,
798
+ };
799
+ }
800
+ static setupRadar(model, answersData) {
801
+ let { datasets, labels, colors, texts, seriesLabels, } = answersData;
802
+ const hasSeries = seriesLabels.length > 1 || model.dataType === "matrix";
803
+ const series = datasets.map((dataset, index) => {
804
+ const seriesName = hasSeries ? seriesLabels[index] : "";
805
+ return {
806
+ name: seriesName,
807
+ data: dataset
808
+ };
809
+ });
810
+ const chart = {
811
+ type: "radar",
812
+ height: ApexChartsSetup.defaultChartHeight,
813
+ background: "transparent",
814
+ toolbar: Object.assign({}, ApexChartsSetup.defaultToolbarConfig),
815
+ };
816
+ const plotOptions = {
817
+ radar: {
818
+ polygons: {
819
+ strokeColors: model.theme.axisGridColor,
820
+ }
821
+ }
822
+ };
823
+ const radarLabelFont = model.theme.radarLabelFont;
824
+ const xaxis = {
825
+ labels: {
826
+ style: {
827
+ colors: radarLabelFont.color,
828
+ fontSize: radarLabelFont.size,
829
+ fontFamily: radarLabelFont.family,
830
+ fontWeight: radarLabelFont.weight,
831
+ },
832
+ },
833
+ categories: labels,
834
+ };
835
+ xaxis.labels.style.colors = Array(labels.length).fill(model.theme.axisLabelFont.color);
836
+ const yaxis = {
837
+ show: true,
838
+ labels: {
839
+ show: true,
840
+ style: Object.assign({}, ApexChartsSetup.defaultAxisLabelFont(model.theme))
841
+ },
842
+ tickAmount: 5
843
+ };
844
+ const legend = Object.assign(Object.assign({}, ApexChartsSetup.defaultLegendConfig(model)), { show: hasSeries, markers: {
845
+ width: 12,
846
+ height: 12,
847
+ radius: 6
848
+ } });
849
+ const tooltip = {
850
+ enabled: true,
851
+ style: Object.assign({}, ApexChartsSetup.defaultTooltipConfig(model.theme)),
852
+ y: {
853
+ formatter: function (val, opts) {
854
+ const seriesName = opts.w.globals.seriesNames[opts.seriesIndex];
855
+ const label = opts.w.globals.labels[opts.dataPointIndex];
856
+ return !!seriesName ? `${seriesName}: ${val} (${label})` : `${label}: ${val}`;
857
+ }
858
+ }
859
+ };
860
+ return {
861
+ series,
862
+ chart,
863
+ labels,
864
+ colors,
865
+ plotOptions,
866
+ xaxis,
867
+ yaxis,
868
+ tooltip,
869
+ legend,
870
+ responsive: [Object.assign({}, ApexChartsSetup.defaultResponsive)],
871
+ };
872
+ }
873
+ }
874
+ ApexChartsSetup.imageExportFormat = "png";
875
+ ApexChartsSetup.defaultChartHeight = 450;
876
+ ApexChartsSetup.defaultBarGap = DashboardTheme.barGap;
877
+ ApexChartsSetup.defaultToolbarConfig = {
878
+ show: true,
879
+ tools: {
880
+ download: true,
881
+ selection: true,
882
+ zoom: true,
883
+ zoomin: true,
884
+ zoomout: true,
885
+ pan: true,
886
+ reset: true
887
+ }
888
+ };
889
+ ApexChartsSetup.defaultStrokeConfig = {
890
+ width: 2,
891
+ curve: "smooth"
892
+ };
893
+ ApexChartsSetup.defaultFillConfig = {
894
+ type: "solid",
895
+ opacity: 0.8
896
+ };
897
+ ApexChartsSetup.defaultResponsive = {
898
+ breakpoint: 600,
899
+ options: {
900
+ legend: {
901
+ position: "bottom"
902
+ }
903
+ }
904
+ };
905
+ /**
906
+ * Fires when end user clicks on the 'save as image' button.
907
+ */
908
+ ApexChartsSetup.onImageSaving = new Event();
909
+ /**
910
+ * Fires before chart will be created. User can change series, chart options and config of the chart.
911
+ * Options is an object with the following fields: series, chart, xaxis, yaxis, labels, colors, plotOptions, dataLabels, legend, tooltip, grid and hasSeries.
912
+ */
913
+ ApexChartsSetup.onChartCreating = new Event();
914
+ ApexChartsSetup.setups = {
915
+ bar: ApexChartsSetup.setupBar,
916
+ vbar: ApexChartsSetup.setupVBar,
917
+ line: ApexChartsSetup.setupLine,
918
+ stackedbar: ApexChartsSetup.setupStackedBar,
919
+ doughnut: ApexChartsSetup.setupPie,
920
+ pie: ApexChartsSetup.setupPie,
921
+ scatter: ApexChartsSetup.setupScatter,
922
+ gauge: ApexChartsSetup.setupGauge,
923
+ bullet: ApexChartsSetup.setupBullet,
924
+ radar: ApexChartsSetup.setupRadar,
925
+ histogram: ApexChartsSetup.setupBar,
926
+ vhistogram: ApexChartsSetup.setupVBar,
927
+ stackedhistogram: ApexChartsSetup.setupStackedBar,
928
+ };
929
+
930
+ const chartTypes = {
931
+ "boolean": ["pie", "doughnut", "bar"],
932
+ "number": ["gauge", "bullet"],
933
+ "average": ["gauge", "bullet"],
934
+ "selectBase": ["bar", "vbar", "pie", "doughnut"],
935
+ "histogram": ["vhistogram", "histogram"],
936
+ "matrix": ["bar", "stackedbar", "pie", "doughnut"],
937
+ "matrixDropdownGrouped": ["stackedbar", "bar", "pie", "doughnut"],
938
+ "pivot": ["vbar", "bar", "line", "stackedbar", "pie", "doughnut"], // ["vbar", "bar"];
939
+ "ranking": ["bar", "vbar", "pie", "doughnut", "radar"],
940
+ };
941
+ class ApexChartsAdapter {
942
+ static getChartTypesByVisualizerType(vType) {
943
+ return (chartTypes[vType] || []).slice();
944
+ }
945
+ updatePieCharts(options, chartOptions, chartNode) {
946
+ if (this._pieCharts) {
947
+ this._pieCharts.forEach((chart) => chart.updateOptions(options));
948
+ }
949
+ else {
950
+ chartNode.classList.add("sa-pie-charts");
951
+ this._pieCharts = chartOptions.series.map((s, i) => {
952
+ const chartDiv = document.createElement("div");
953
+ chartDiv.id = "sa-chart" + i;
954
+ chartDiv.classList.add("sa-pie-chart");
955
+ chartNode.appendChild(chartDiv);
956
+ const _options = Object.assign({}, options, {
957
+ series: s.series,
958
+ labels: s.labels
959
+ });
960
+ _options.title.text = s.title;
961
+ removeUndefinedProperties(_options);
962
+ const chart = new ApexCharts(chartDiv, _options);
963
+ return chart;
964
+ });
965
+ this._pieCharts.forEach((chart) => chart.render());
966
+ }
967
+ }
968
+ constructor(model) {
969
+ this.model = model;
970
+ this._chart = undefined;
971
+ this._pieCharts = undefined;
972
+ }
973
+ patchConfigParameters(chartNode, options) { }
974
+ get chart() {
975
+ return this._chart;
976
+ }
977
+ getChartTypes() {
978
+ const visualizerType = this.model.type;
979
+ const chartCtypes = chartTypes[visualizerType];
980
+ return (chartCtypes || []).slice();
981
+ }
982
+ create(chartNode) {
983
+ return __awaiter(this, void 0, void 0, function* () {
984
+ yield this.update(chartNode);
985
+ const currentCharts = this._pieCharts || [this._chart];
986
+ if (this.model instanceof SelectBase) {
987
+ // Handle chart clicks
988
+ this.model;
989
+ }
990
+ return currentCharts;
991
+ });
992
+ }
993
+ update(chartNode) {
994
+ return __awaiter(this, void 0, void 0, function* () {
995
+ const _chartType = this.model.chartType;
996
+ const answersData = yield this.model.getAnswersData();
997
+ var chartOptions = ApexChartsSetup.setup(_chartType, this.model, answersData);
998
+ if (this.model instanceof SelectBase && this.model.supportSelection) {
999
+ const _model = this.model;
1000
+ chartOptions.chart.events = {
1001
+ dataPointMouseEnter: function () { chartNode.style.cursor = "pointer"; },
1002
+ dataPointMouseLeave: function () { chartNode.style.cursor = ""; },
1003
+ dataPointSelection: function (event, chartContext, opts) {
1004
+ if (opts.dataPointIndex !== undefined && opts.seriesIndex !== undefined) {
1005
+ let itemText = "";
1006
+ if (!chartOptions.hasSeries) {
1007
+ itemText = config.labels[opts.dataPointIndex];
1008
+ const item = _model.getSelectedItemByText(itemText);
1009
+ _model.setSelection(item);
1010
+ }
1011
+ else {
1012
+ itemText = config.series[opts.seriesIndex].name;
1013
+ const propertyLabel = config.labels[opts.dataPointIndex];
1014
+ const seriesValues = _model.getSeriesValues();
1015
+ const seriesLabels = _model.getSeriesLabels();
1016
+ const propertyValue = seriesValues[seriesLabels.indexOf(propertyLabel)];
1017
+ const selectedItem = _model.getSelectedItemByText(itemText);
1018
+ const item = new ItemValue({ [propertyValue]: selectedItem.value }, propertyLabel + ": " + selectedItem.text);
1019
+ _model.setSelection(item);
1020
+ }
1021
+ }
1022
+ // The last parameter opts contains additional information like `seriesIndex` and `dataPointIndex` for cartesian charts
1023
+ /*if (data.points.length > 0) {
1024
+ let itemText = "";
1025
+ if (!chartOptions.hasSeries) {
1026
+ itemText = Array.isArray(data.points[0].customdata)
1027
+ ? data.points[0].customdata[0]
1028
+ : data.points[0].customdata;
1029
+ const item: ItemValue = _model.getSelectedItemByText(itemText);
1030
+ _model.setSelection(item);
1031
+ } else {
1032
+ itemText = data.points[0].data.name;
1033
+ const propertyLabel = data.points[0].label;
1034
+ // const seriesValues = this.model.getSeriesValues();
1035
+ // const seriesLabels = this.model.getSeriesLabels();
1036
+ // const propertyValue = seriesValues[seriesLabels.indexOf(propertyLabel)];
1037
+ // const selectedItem: ItemValue = _model.getSelectedItemByText(itemText);
1038
+ // const item = new ItemValue({ [propertyValue]: selectedItem.value }, propertyLabel + ": " + selectedItem.text);
1039
+ // _model.setSelection(item);
1040
+ }
1041
+ }*/
1042
+ }
1043
+ };
1044
+ }
1045
+ let config = Object.assign({ chart: Object.assign(Object.assign({}, chartOptions.chart), { locales: [{
1046
+ name: localization.currentLocale,
1047
+ }], defaultLocale: localization.currentLocale }) }, chartOptions);
1048
+ this.patchConfigParameters(chartNode, config);
1049
+ let options = Object.assign({}, config);
1050
+ ApexChartsSetup.onChartCreating.fire(this.model, options);
1051
+ if ((_chartType === "pie" || _chartType === "doughnut") && chartOptions.series.length > 0 && typeof chartOptions.series[0] !== "number") {
1052
+ this.updatePieCharts(options, chartOptions, chartNode);
1053
+ }
1054
+ else {
1055
+ const availableUpdateOptions = this._chart && !!this._chart["el"] && this._chart["el"].getRootNode() === document;
1056
+ if (availableUpdateOptions) {
1057
+ yield this._chart.updateOptions({ series: options.series });
1058
+ }
1059
+ else {
1060
+ removeUndefinedProperties(options);
1061
+ this._chart = new ApexCharts(chartNode, options);
1062
+ yield this._chart.render();
1063
+ }
1064
+ }
1065
+ return chartOptions;
1066
+ });
1067
+ }
1068
+ destroy(node) {
1069
+ if (this._chart) {
1070
+ this._chart.destroy();
1071
+ this._chart = undefined;
1072
+ }
1073
+ if (this._pieCharts) {
1074
+ this._pieCharts.forEach(ch => ch.destroy());
1075
+ this._pieCharts = undefined;
1076
+ }
1077
+ }
1078
+ }
1079
+ VisualizerBase.chartAdapterType = ApexChartsAdapter;
1080
+
1081
+ export { ApexChartsAdapter, ApexChartsSetup, DashboardTheme, NumberModel, SelectBase, VisualizerBase, chartTypes, localization };
1082
+ //# sourceMappingURL=survey.analytics.apexcharts.mjs.map