survey-analytics 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm/shared.mjs +1426 -265
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +90 -46
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +3 -3
- package/fesm/survey.analytics.tabulator.mjs +3 -3
- package/package.json +2 -2
- package/survey-analytics-tabulator.types/analytics-localization/arabic.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/dutch.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +5 -0
- package/survey-analytics-tabulator.types/analytics-localization/farsi.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/finnish.d.ts +7 -0
- package/survey-analytics-tabulator.types/analytics-localization/french.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/german.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/italian.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/japanese.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/norwegian.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/polish.d.ts +15 -0
- package/survey-analytics-tabulator.types/analytics-localization/portuguese.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/russian.d.ts +15 -0
- package/survey-analytics-tabulator.types/analytics-localization/spanish.d.ts +16 -0
- package/survey-analytics-tabulator.types/analytics-localization/swedish.d.ts +3 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +12 -0
- package/survey-analytics-tabulator.types/utils/index.d.ts +2 -2
- package/survey-analytics.types/analytics-localization/arabic.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/dutch.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/english.d.ts +5 -0
- package/survey-analytics.types/analytics-localization/farsi.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/finnish.d.ts +7 -0
- package/survey-analytics.types/analytics-localization/french.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/german.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/italian.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/japanese.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/norwegian.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/polish.d.ts +15 -0
- package/survey-analytics.types/analytics-localization/portuguese.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/russian.d.ts +15 -0
- package/survey-analytics.types/analytics-localization/spanish.d.ts +16 -0
- package/survey-analytics.types/analytics-localization/swedish.d.ts +3 -0
- package/survey-analytics.types/histogram.d.ts +4 -4
- package/survey-analytics.types/localizationManager.d.ts +12 -0
- package/survey-analytics.types/pivot.d.ts +7 -4
- package/survey-analytics.types/utils/index.d.ts +2 -2
- package/survey.analytics.core.css +53 -22
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.js +1522 -308
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +2 -2
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +53 -22
- package/survey.analytics.css.map +1 -1
- package/survey.analytics.js +1523 -308
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +2 -2
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.min.js.LICENSE.txt +1 -1
- package/survey.analytics.tabulator.css +53 -21
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.js +1435 -264
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +2 -2
- package/survey.analytics.tabulator.min.js +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/fesm/shared2.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.3.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.3.2
|
|
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
|
*/
|
|
6
6
|
|
|
7
|
-
import { D as DocumentHelper, l as localization,
|
|
7
|
+
import { D as DocumentHelper, l as localization, g as createLoadingIndicator, b as DataHelper, f as svgTemplate, e as createCommercialLicenseLink, t as toPrecision } from './shared.mjs';
|
|
8
8
|
import { Event, QuestionCommentModel, settings, ItemValue, hasLicense, surveyLocalization, IsTouch } from 'survey-core';
|
|
9
9
|
|
|
10
10
|
/******************************************************************************
|
|
@@ -1915,7 +1915,7 @@ class HistogramModel extends SelectBase {
|
|
|
1915
1915
|
super(question, data, options, name || "histogram");
|
|
1916
1916
|
this.valueType = "number";
|
|
1917
1917
|
this._cachedValues = undefined;
|
|
1918
|
-
this.
|
|
1918
|
+
this._continuousData = undefined;
|
|
1919
1919
|
this._cachedIntervals = undefined;
|
|
1920
1920
|
this._intervalPrecision = 2;
|
|
1921
1921
|
this._transposeData = false;
|
|
@@ -1931,11 +1931,11 @@ class HistogramModel extends SelectBase {
|
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
1933
|
reset() {
|
|
1934
|
-
this.
|
|
1934
|
+
this._continuousData = undefined;
|
|
1935
1935
|
this._cachedValues = undefined;
|
|
1936
1936
|
this._cachedIntervals = undefined;
|
|
1937
1937
|
}
|
|
1938
|
-
|
|
1938
|
+
getContinuousValue(value) {
|
|
1939
1939
|
if (this.valueType === "date") {
|
|
1940
1940
|
return Date.parse(value);
|
|
1941
1941
|
}
|
|
@@ -1952,7 +1952,7 @@ class HistogramModel extends SelectBase {
|
|
|
1952
1952
|
return Math.round(base * value) / base;
|
|
1953
1953
|
}
|
|
1954
1954
|
getSelectedItemByText(itemText) {
|
|
1955
|
-
if (this.hasCustomIntervals || this.
|
|
1955
|
+
if (this.hasCustomIntervals || this.getContinuousValues().length > HistogramModel.UseIntervalsFrom) {
|
|
1956
1956
|
const interval = this.intervals.filter(interval => interval.label === itemText)[0];
|
|
1957
1957
|
return new ItemValue(interval, interval !== undefined ? interval.label : "");
|
|
1958
1958
|
}
|
|
@@ -1971,26 +1971,26 @@ class HistogramModel extends SelectBase {
|
|
|
1971
1971
|
this.reset();
|
|
1972
1972
|
super.onDataChanged();
|
|
1973
1973
|
}
|
|
1974
|
-
|
|
1974
|
+
getContinuousValues() {
|
|
1975
1975
|
if (this._cachedValues === undefined) {
|
|
1976
1976
|
const series = this.getSeriesValues();
|
|
1977
1977
|
if (series.length === 0) {
|
|
1978
1978
|
series.push("");
|
|
1979
1979
|
}
|
|
1980
|
-
this.
|
|
1981
|
-
series.forEach(seriesValue => this.
|
|
1980
|
+
this._continuousData = {};
|
|
1981
|
+
series.forEach(seriesValue => this._continuousData[seriesValue] = []);
|
|
1982
1982
|
const hash = {};
|
|
1983
1983
|
this.data.forEach(dataItem => {
|
|
1984
1984
|
const answerData = dataItem[this.name];
|
|
1985
1985
|
if (answerData !== undefined) {
|
|
1986
1986
|
const seriesValue = dataItem[DataProvider.seriesMarkerKey] || "";
|
|
1987
|
-
// TODO:
|
|
1988
|
-
this.
|
|
1987
|
+
// TODO: _continuousData should be sorted in order to speed-up statistics calculation in the getData function
|
|
1988
|
+
this._continuousData[seriesValue].push(this.getContinuousValue(answerData));
|
|
1989
1989
|
hash[answerData] = answerData;
|
|
1990
1990
|
}
|
|
1991
1991
|
});
|
|
1992
|
-
this._cachedValues = Object.keys(hash).map(key => ({ original: hash[key],
|
|
1993
|
-
this._cachedValues.sort((a, b) => a.
|
|
1992
|
+
this._cachedValues = Object.keys(hash).map(key => ({ original: hash[key], continuous: this.getContinuousValue(key) }));
|
|
1993
|
+
this._cachedValues.sort((a, b) => a.continuous - b.continuous);
|
|
1994
1994
|
}
|
|
1995
1995
|
return this._cachedValues;
|
|
1996
1996
|
}
|
|
@@ -2036,11 +2036,11 @@ class HistogramModel extends SelectBase {
|
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
2038
|
if (this._cachedIntervals === undefined) {
|
|
2039
|
-
const
|
|
2039
|
+
const continuousValues = this.getContinuousValues();
|
|
2040
2040
|
this._cachedIntervals = [];
|
|
2041
|
-
if (
|
|
2042
|
-
let start =
|
|
2043
|
-
const end =
|
|
2041
|
+
if (continuousValues.length) {
|
|
2042
|
+
let start = continuousValues[0].continuous;
|
|
2043
|
+
const end = continuousValues[continuousValues.length - 1].continuous;
|
|
2044
2044
|
const intervalsCount = HistogramModel.IntervalsCount;
|
|
2045
2045
|
const delta = (end - start) / intervalsCount;
|
|
2046
2046
|
for (let i = 0; i < intervalsCount; ++i) {
|
|
@@ -2062,8 +2062,8 @@ class HistogramModel extends SelectBase {
|
|
|
2062
2062
|
return [externalCalculatedData];
|
|
2063
2063
|
}
|
|
2064
2064
|
getCalculatedValuesCore() {
|
|
2065
|
-
this.
|
|
2066
|
-
return histogramStatisticsCalculator(this.
|
|
2065
|
+
this.getContinuousValues();
|
|
2066
|
+
return histogramStatisticsCalculator(this._continuousData, this.intervals, this.getSeriesValues());
|
|
2067
2067
|
}
|
|
2068
2068
|
getValueType() {
|
|
2069
2069
|
return this.valueType;
|
|
@@ -2163,7 +2163,7 @@ class PivotModel extends SelectBase {
|
|
|
2163
2163
|
this.questions = questions;
|
|
2164
2164
|
this.valueType = "enum";
|
|
2165
2165
|
this._cachedValues = undefined;
|
|
2166
|
-
this.
|
|
2166
|
+
this._continuousData = undefined;
|
|
2167
2167
|
this._cachedIntervals = undefined;
|
|
2168
2168
|
this._intervalPrecision = 2;
|
|
2169
2169
|
this.axisYSelectors = [];
|
|
@@ -2179,7 +2179,12 @@ class PivotModel extends SelectBase {
|
|
|
2179
2179
|
value: question.name,
|
|
2180
2180
|
text: question.title || question.name,
|
|
2181
2181
|
};
|
|
2182
|
-
}), (option) => this.axisXQuestionName === option.value, (e) => {
|
|
2182
|
+
}), (option) => this.axisXQuestionName === option.value, (e) => {
|
|
2183
|
+
this.axisXQuestionName = e.target.value;
|
|
2184
|
+
this.updateQuestionsSelection();
|
|
2185
|
+
this.updateToolbar();
|
|
2186
|
+
this.setupPivot();
|
|
2187
|
+
}, () => this.isXYChart() ? localization.getString("axisXSelectorTitle") : localization.getString("axisXAlternativeSelectorTitle")));
|
|
2183
2188
|
this.registerToolbarItem("axisYSelector0", this.createYSelecterGenerator());
|
|
2184
2189
|
this.setupPivot();
|
|
2185
2190
|
}
|
|
@@ -2191,6 +2196,9 @@ class PivotModel extends SelectBase {
|
|
|
2191
2196
|
selector = this.createAxisYSelector(selectorIndex);
|
|
2192
2197
|
this.axisYSelectors.push(selector);
|
|
2193
2198
|
}
|
|
2199
|
+
else {
|
|
2200
|
+
selector["__updateSelect"] && selector["__updateSelect"]();
|
|
2201
|
+
}
|
|
2194
2202
|
return selector;
|
|
2195
2203
|
};
|
|
2196
2204
|
}
|
|
@@ -2211,26 +2219,62 @@ class PivotModel extends SelectBase {
|
|
|
2211
2219
|
}
|
|
2212
2220
|
this.axisYSelectors = this.axisYSelectors.slice(0, index + 1);
|
|
2213
2221
|
this.axisYQuestionNames = this.axisYQuestionNames.slice(0, index + 1);
|
|
2214
|
-
this.updateToolbar();
|
|
2215
2222
|
}
|
|
2216
2223
|
}
|
|
2217
2224
|
else {
|
|
2218
2225
|
if (!!value) {
|
|
2219
2226
|
this.registerToolbarItem("axisYSelector" + this.axisYSelectors.length, this.createYSelecterGenerator());
|
|
2220
|
-
this.updateToolbar();
|
|
2221
2227
|
}
|
|
2222
2228
|
}
|
|
2229
|
+
this.updateQuestionsSelection();
|
|
2230
|
+
this.updateToolbar();
|
|
2223
2231
|
this.setupPivot();
|
|
2224
2232
|
}
|
|
2233
|
+
updateQuestionsSelection() {
|
|
2234
|
+
const selectedQuestions = [this.axisXQuestionName];
|
|
2235
|
+
for (let i = 0; i < this.axisYQuestionNames.length; ++i) {
|
|
2236
|
+
const questionName = this.axisYQuestionNames[i];
|
|
2237
|
+
if (selectedQuestions.indexOf(questionName) !== -1) {
|
|
2238
|
+
this.onAxisYSelectorChanged(i, undefined);
|
|
2239
|
+
break;
|
|
2240
|
+
}
|
|
2241
|
+
else {
|
|
2242
|
+
selectedQuestions.push(questionName);
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2225
2246
|
createAxisYSelector(selectorIndex) {
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2247
|
+
const getChoices = () => {
|
|
2248
|
+
const choices = this.questions.filter(q => {
|
|
2249
|
+
if (q.name === this.axisXQuestionName) {
|
|
2250
|
+
return false;
|
|
2251
|
+
}
|
|
2252
|
+
const usedIndex = this.axisYQuestionNames.indexOf(q.name);
|
|
2253
|
+
return usedIndex == -1 || usedIndex >= selectorIndex;
|
|
2254
|
+
}).map((question) => {
|
|
2255
|
+
return {
|
|
2256
|
+
value: question.name,
|
|
2257
|
+
text: question.title || question.name,
|
|
2258
|
+
};
|
|
2259
|
+
});
|
|
2260
|
+
return [{ value: "", text: localization.getString("notSelected") }].concat(choices);
|
|
2261
|
+
};
|
|
2262
|
+
if (getChoices().length == 1) {
|
|
2263
|
+
return undefined;
|
|
2264
|
+
}
|
|
2265
|
+
const selector = DocumentHelper.createSelector(getChoices, (option) => this.axisYQuestionNames[selectorIndex] === option.value, (e) => { this.onAxisYSelectorChanged(selectorIndex, e.target.value); }, () => selectorIndex ? undefined : (this.isXYChart() ? localization.getString("axisYSelectorTitle") : localization.getString("axisYAlternativeSelectorTitle")));
|
|
2232
2266
|
return selector;
|
|
2233
2267
|
}
|
|
2268
|
+
setChartType(chartType) {
|
|
2269
|
+
const prev2Dchart = this.isXYChart();
|
|
2270
|
+
super.setChartType(chartType);
|
|
2271
|
+
if (prev2Dchart !== this.isXYChart()) {
|
|
2272
|
+
this.updateToolbar();
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
isXYChart() {
|
|
2276
|
+
return ["pie", "doughnut"].indexOf(this.chartType) === -1;
|
|
2277
|
+
}
|
|
2234
2278
|
getQuestionValueType(question) {
|
|
2235
2279
|
const questionType = question.getType();
|
|
2236
2280
|
if (questionType === "text" && (question["inputType"] === "date" || question["inputType"] === "datetime")) {
|
|
@@ -2257,11 +2301,11 @@ class PivotModel extends SelectBase {
|
|
|
2257
2301
|
this.onDataChanged();
|
|
2258
2302
|
}
|
|
2259
2303
|
reset() {
|
|
2260
|
-
this.
|
|
2304
|
+
this._continuousData = undefined;
|
|
2261
2305
|
this._cachedValues = undefined;
|
|
2262
2306
|
this._cachedIntervals = undefined;
|
|
2263
2307
|
}
|
|
2264
|
-
|
|
2308
|
+
getContinuousValue(value) {
|
|
2265
2309
|
if (this.valueType === "date") {
|
|
2266
2310
|
return Date.parse(value);
|
|
2267
2311
|
}
|
|
@@ -2278,7 +2322,7 @@ class PivotModel extends SelectBase {
|
|
|
2278
2322
|
return Math.round(base * value) / base;
|
|
2279
2323
|
}
|
|
2280
2324
|
getSelectedItemByText(itemText) {
|
|
2281
|
-
if (this.hasCustomIntervals || this.
|
|
2325
|
+
if (this.hasCustomIntervals || this.getContinuousValues().length > PivotModel.UseIntervalsFrom) {
|
|
2282
2326
|
const interval = this.intervals.filter(interval => interval.label === itemText)[0];
|
|
2283
2327
|
return new ItemValue(interval, interval !== undefined ? interval.label : "");
|
|
2284
2328
|
}
|
|
@@ -2297,9 +2341,9 @@ class PivotModel extends SelectBase {
|
|
|
2297
2341
|
this.reset();
|
|
2298
2342
|
super.onDataChanged();
|
|
2299
2343
|
}
|
|
2300
|
-
|
|
2344
|
+
getContinuousValues() {
|
|
2301
2345
|
if (this._cachedValues === undefined) {
|
|
2302
|
-
this.
|
|
2346
|
+
this._continuousData = [];
|
|
2303
2347
|
if (this.valueType === "enum") {
|
|
2304
2348
|
this._cachedValues = [];
|
|
2305
2349
|
return this._cachedValues;
|
|
@@ -2308,13 +2352,13 @@ class PivotModel extends SelectBase {
|
|
|
2308
2352
|
this.data.forEach(dataItem => {
|
|
2309
2353
|
const answerData = dataItem[this.name];
|
|
2310
2354
|
if (answerData !== undefined) {
|
|
2311
|
-
// TODO:
|
|
2312
|
-
this.
|
|
2355
|
+
// TODO: _continuousData should be sorted in order to speed-up statistics calculation in the getData function
|
|
2356
|
+
this._continuousData.push({ continuous: this.getContinuousValue(answerData), row: dataItem });
|
|
2313
2357
|
hash[answerData] = { value: answerData, row: dataItem };
|
|
2314
2358
|
}
|
|
2315
2359
|
});
|
|
2316
|
-
this._cachedValues = Object.keys(hash).map(key => ({ original: hash[key].value,
|
|
2317
|
-
this._cachedValues.sort((a, b) => a.
|
|
2360
|
+
this._cachedValues = Object.keys(hash).map(key => ({ original: hash[key].value, continuous: this.getContinuousValue(key), row: hash[key].row }));
|
|
2361
|
+
this._cachedValues.sort((a, b) => a.continuous - b.continuous);
|
|
2318
2362
|
}
|
|
2319
2363
|
return this._cachedValues;
|
|
2320
2364
|
}
|
|
@@ -2399,11 +2443,11 @@ class PivotModel extends SelectBase {
|
|
|
2399
2443
|
}
|
|
2400
2444
|
}
|
|
2401
2445
|
if (this._cachedIntervals === undefined) {
|
|
2402
|
-
const
|
|
2446
|
+
const continuousValues = this.getContinuousValues();
|
|
2403
2447
|
this._cachedIntervals = [];
|
|
2404
|
-
if (
|
|
2405
|
-
let start =
|
|
2406
|
-
const end =
|
|
2448
|
+
if (continuousValues.length) {
|
|
2449
|
+
let start = continuousValues[0].continuous;
|
|
2450
|
+
const end = continuousValues[continuousValues.length - 1].continuous;
|
|
2407
2451
|
const intervalsCount = PivotModel.IntervalsCount;
|
|
2408
2452
|
const delta = (end - start) / intervalsCount;
|
|
2409
2453
|
for (let i = 0; i < intervalsCount; ++i) {
|
|
@@ -2485,14 +2529,14 @@ class PivotModel extends SelectBase {
|
|
|
2485
2529
|
});
|
|
2486
2530
|
}
|
|
2487
2531
|
else {
|
|
2488
|
-
this.
|
|
2532
|
+
this.getContinuousValues();
|
|
2489
2533
|
const intervals = this.intervals;
|
|
2490
2534
|
for (var i = 0; i < series.length; ++i) {
|
|
2491
2535
|
statistics.push(intervals.map(i => 0));
|
|
2492
2536
|
}
|
|
2493
|
-
this.
|
|
2537
|
+
this._continuousData.forEach(dataValue => {
|
|
2494
2538
|
for (let valueIndex = 0; valueIndex < intervals.length; ++valueIndex) {
|
|
2495
|
-
if (intervals[valueIndex].start <= dataValue.
|
|
2539
|
+
if (intervals[valueIndex].start <= dataValue.continuous && (dataValue.continuous < intervals[valueIndex].end || valueIndex == intervals.length - 1)) {
|
|
2496
2540
|
if (this.questionsY.length === 0) {
|
|
2497
2541
|
statistics[0][valueIndex]++;
|
|
2498
2542
|
}
|
|
@@ -9835,7 +9879,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9835
9879
|
const localeChoices = this.locales.map((element) => {
|
|
9836
9880
|
return {
|
|
9837
9881
|
value: element,
|
|
9838
|
-
text: localization.
|
|
9882
|
+
text: localization.getLocaleName(element)
|
|
9839
9883
|
};
|
|
9840
9884
|
});
|
|
9841
9885
|
// localeChoices.unshift({
|