survey-analytics 3.0.0-beta.0 → 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.
- package/README.md +1 -1
- package/fesm/shared.mjs +46 -42
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +981 -216
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/shared3.mjs +384 -522
- package/fesm/shared3.mjs.map +1 -1
- package/fesm/shared4.mjs +1 -1
- package/fesm/survey.analytics.apexcharts.mjs +35 -14
- package/fesm/survey.analytics.apexcharts.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +3 -3
- package/fesm/survey.analytics.mjs +3 -3
- package/fesm/survey.analytics.mongo.mjs +1 -1
- package/fesm/survey.analytics.plotly.mjs +3 -3
- package/fesm/survey.analytics.tabulator.mjs +10 -7
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/fesm/themes/index.mjs +1 -1
- package/package.json +6 -4
- package/survey-analytics-plotly.types/analytics-localization/english.d.ts +12 -0
- package/survey-analytics-plotly.types/axisDescription.d.ts +6 -0
- package/survey-analytics-plotly.types/dashboard.d.ts +1 -1
- package/survey-analytics-plotly.types/entries/summary.core.d.ts +3 -1
- package/survey-analytics-plotly.types/localizationManager.d.ts +12 -0
- package/survey-analytics-plotly.types/pivot.d.ts +20 -8
- package/survey-analytics-plotly.types/plotly/setup.d.ts +1 -1
- package/survey-analytics-plotly.types/selectBase.d.ts +1 -0
- package/survey-analytics-plotly.types/sideBarItemCreators.d.ts +7 -0
- package/survey-analytics-plotly.types/theme.d.ts +1 -0
- package/survey-analytics-plotly.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics-plotly.types/utils/dropdownActionWidget.d.ts +3 -0
- package/survey-analytics-plotly.types/utils/dropdownBase.d.ts +1 -0
- package/survey-analytics-plotly.types/utils/dropdownWidget.d.ts +6 -0
- package/survey-analytics-plotly.types/utils/editableSeriesListWidget.d.ts +34 -0
- package/survey-analytics-plotly.types/utils/elementVisibilityAction.d.ts +22 -0
- package/survey-analytics-plotly.types/utils/index.d.ts +0 -37
- package/survey-analytics-plotly.types/utils/sidebarWidget.d.ts +48 -0
- package/survey-analytics-plotly.types/visualizationManager.d.ts +1 -0
- package/survey-analytics-plotly.types/visualizationPanelDynamic.d.ts +2 -2
- package/survey-analytics-plotly.types/visualizer-interfaces.d.ts +25 -0
- package/survey-analytics-plotly.types/visualizerBase.d.ts +24 -11
- package/survey-analytics-plotly.types/visualizerDescription.d.ts +1 -16
- package/survey-analytics-plotly.types/visualizerFactory.d.ts +1 -1
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +12 -0
- package/survey-analytics-tabulator.types/entries/tabulator.fontless.d.ts +1 -1
- package/survey-analytics-tabulator.types/localizationManager.d.ts +12 -0
- package/survey-analytics-tabulator.types/tables/columnbuilder.d.ts +16 -16
- package/survey-analytics-tabulator.types/tables/columns.d.ts +18 -18
- package/survey-analytics-tabulator.types/tables/config.d.ts +2 -2
- package/survey-analytics-tabulator.types/tables/table-interfaces.d.ts +56 -0
- package/survey-analytics-tabulator.types/tables/table.d.ts +4 -47
- package/survey-analytics-tabulator.types/tables/tabulator.d.ts +2 -1
- package/survey-analytics-tabulator.types/theme.d.ts +1 -0
- package/survey-analytics-tabulator.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics-tabulator.types/utils/dropdownActionWidget.d.ts +3 -0
- package/survey-analytics-tabulator.types/utils/dropdownBase.d.ts +1 -0
- package/survey-analytics-tabulator.types/utils/index.d.ts +0 -37
- package/survey-analytics.types/analytics-localization/english.d.ts +12 -0
- package/survey-analytics.types/apexcharts/setup.d.ts +16 -1
- package/survey-analytics.types/axisDescription.d.ts +6 -0
- package/survey-analytics.types/dashboard.d.ts +1 -1
- package/survey-analytics.types/entries/summary.core.d.ts +3 -1
- package/survey-analytics.types/localizationManager.d.ts +12 -0
- package/survey-analytics.types/pivot.d.ts +20 -8
- package/survey-analytics.types/selectBase.d.ts +1 -0
- package/survey-analytics.types/sideBarItemCreators.d.ts +7 -0
- package/survey-analytics.types/theme.d.ts +1 -0
- package/survey-analytics.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics.types/utils/dropdownActionWidget.d.ts +3 -0
- package/survey-analytics.types/utils/dropdownBase.d.ts +1 -0
- package/survey-analytics.types/utils/dropdownWidget.d.ts +6 -0
- package/survey-analytics.types/utils/editableSeriesListWidget.d.ts +34 -0
- package/survey-analytics.types/utils/elementVisibilityAction.d.ts +22 -0
- package/survey-analytics.types/utils/index.d.ts +0 -37
- package/survey-analytics.types/utils/sidebarWidget.d.ts +48 -0
- package/survey-analytics.types/visualizationManager.d.ts +1 -0
- package/survey-analytics.types/visualizationPanelDynamic.d.ts +2 -2
- package/survey-analytics.types/visualizer-interfaces.d.ts +25 -0
- package/survey-analytics.types/visualizerBase.d.ts +24 -11
- package/survey-analytics.types/visualizerDescription.d.ts +1 -16
- package/survey-analytics.types/visualizerFactory.d.ts +1 -1
- package/survey.analytics.core.css +382 -2
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.d.ts +1 -0
- package/survey.analytics.core.js +1577 -749
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +4 -2
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +382 -2
- package/survey.analytics.css.map +1 -1
- package/survey.analytics.d.ts +1 -0
- package/survey.analytics.fontless.css +382 -2
- package/survey.analytics.fontless.css.map +1 -1
- package/survey.analytics.fontless.min.css +4 -2
- package/survey.analytics.js +1602 -749
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +4 -2
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.min.js.LICENSE.txt +1 -1
- package/survey.analytics.mongo.d.ts +1 -0
- package/survey.analytics.mongo.js +1 -1
- package/survey.analytics.mongo.js.map +1 -1
- package/survey.analytics.mongo.min.js.LICENSE.txt +1 -1
- package/survey.analytics.plotly.css +382 -2
- package/survey.analytics.plotly.css.map +1 -1
- package/survey.analytics.plotly.d.ts +1 -0
- package/survey.analytics.plotly.fontless.css +382 -2
- package/survey.analytics.plotly.fontless.css.map +1 -1
- package/survey.analytics.plotly.fontless.min.css +4 -2
- package/survey.analytics.plotly.js +1620 -776
- package/survey.analytics.plotly.js.map +1 -1
- package/survey.analytics.plotly.min.css +4 -2
- package/survey.analytics.plotly.min.js +1 -1
- package/survey.analytics.plotly.min.js.LICENSE.txt +1 -1
- package/survey.analytics.tabulator.css +15 -2
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.d.ts +1 -0
- package/survey.analytics.tabulator.fontless.css +15 -2
- package/survey.analytics.tabulator.fontless.css.map +1 -1
- package/survey.analytics.tabulator.fontless.min.css +2 -2
- package/survey.analytics.tabulator.js +365 -483
- 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/themes/default-dark.js +1 -1
- package/themes/default-dark.min.js.LICENSE.txt +1 -1
- package/themes/default-light.js +1 -1
- package/themes/default-light.min.js.LICENSE.txt +1 -1
- package/themes/index.js +1 -1
- package/themes/index.min.js.LICENSE.txt +1 -1
- package/survey-analytics-tabulator.types/utils/dropdownWidget.d.ts +0 -40
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<video src="https://github.com/surveyjs/survey-analytics/assets/22315929/2ebc84e1-dc43-4873-8c72-a1b4125e8749"></video>
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
[](https://dev.azure.com/SurveyJS/V2%20Libraries/_build/latest?definitionId=161&repoName=surveyjs%2Fsurvey-analytics&branchName=master)
|
|
8
8
|
<a href="https://github.com/microsoft/playwright">
|
|
9
9
|
<img alt="Tested with Playwright" src="https://img.shields.io/badge/tested%20with-Playwright-2fa4cf.svg">
|
|
10
10
|
</a>
|
package/fesm/shared.mjs
CHANGED
|
@@ -1,51 +1,27 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v3.0.0-beta.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v3.0.0-beta.1
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { h as NumberModel, S as SelectBase, B as BooleanModel, H as HistogramModel, M as Matrix, d as MatrixDropdownGrouped, P as PivotModel, R as RankingModel, s as VisualizerBase, _ as __awaiter } from './shared2.mjs';
|
|
8
|
-
import { Event, ItemValue } from 'survey-core';
|
|
9
|
-
import { l as localization,
|
|
8
|
+
import { Event, getRGBaColor, ItemValue } from 'survey-core';
|
|
9
|
+
import { l as localization, d as DataHelper, D as DashboardTheme } from './shared3.mjs';
|
|
10
10
|
import Plotly from 'plotly.js-dist-min';
|
|
11
11
|
import { i as isAllZeros, r as reverseAll } from './shared4.mjs';
|
|
12
12
|
|
|
13
13
|
class PlotlySetup {
|
|
14
|
-
static getRgbaColor(propertyValue) {
|
|
15
|
-
let str = propertyValue;
|
|
16
|
-
if (!str)
|
|
17
|
-
return null;
|
|
18
|
-
const canvasElement = document.createElement("canvas");
|
|
19
|
-
if (!canvasElement)
|
|
20
|
-
return null;
|
|
21
|
-
const ctx = canvasElement.getContext("2d");
|
|
22
|
-
ctx.fillStyle = str;
|
|
23
|
-
if (ctx.fillStyle == "#000000") {
|
|
24
|
-
ctx.fillStyle = propertyValue;
|
|
25
|
-
}
|
|
26
|
-
const newStr = ctx.fillStyle;
|
|
27
|
-
const match = newStr.match(/color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*\/\s*([\d.]+)\)/);
|
|
28
|
-
if (!match) {
|
|
29
|
-
return newStr;
|
|
30
|
-
}
|
|
31
|
-
const r = parseFloat(match[1]);
|
|
32
|
-
const g = parseFloat(match[2]);
|
|
33
|
-
const b = parseFloat(match[3]);
|
|
34
|
-
const alpha = parseFloat(match[4]);
|
|
35
|
-
const result = `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
14
|
static defaultModebarConfig(theme) {
|
|
39
15
|
return {
|
|
40
16
|
bgcolor: "transparent",
|
|
41
|
-
activecolor:
|
|
42
|
-
color:
|
|
17
|
+
activecolor: getRGBaColor(theme.modebarActiveColor),
|
|
18
|
+
color: getRGBaColor(theme.modebarColor),
|
|
43
19
|
};
|
|
44
20
|
}
|
|
45
21
|
static defaultTooltipConfig(theme) {
|
|
46
22
|
const font = Object.assign(Object.assign({}, theme.tooltipFont), { size: parseFloat(theme.tooltipFont.size) });
|
|
47
23
|
return {
|
|
48
|
-
bgcolor:
|
|
24
|
+
bgcolor: getRGBaColor(theme.tooltipBackground),
|
|
49
25
|
font: font,
|
|
50
26
|
};
|
|
51
27
|
}
|
|
@@ -81,7 +57,7 @@ class PlotlySetup {
|
|
|
81
57
|
delete axisLabelFont.family;
|
|
82
58
|
}
|
|
83
59
|
return {
|
|
84
|
-
zerolinecolor:
|
|
60
|
+
zerolinecolor: getRGBaColor(theme.axisGridColor),
|
|
85
61
|
automargin: true,
|
|
86
62
|
tickfont: axisLabelFont
|
|
87
63
|
};
|
|
@@ -94,20 +70,34 @@ class PlotlySetup {
|
|
|
94
70
|
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisConfig(theme)), { ticklabelstandoff: 8 });
|
|
95
71
|
}
|
|
96
72
|
static defaultAxisXWithGridLineConfig(theme) {
|
|
97
|
-
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisXConfig(theme)), { gridcolor:
|
|
73
|
+
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisXConfig(theme)), { gridcolor: getRGBaColor(theme.axisGridColor), griddash: "dot" });
|
|
98
74
|
}
|
|
99
75
|
static defaultAxisYConfig(theme) {
|
|
100
76
|
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisConfig(theme)), { ticklabelstandoff: 16 });
|
|
101
77
|
}
|
|
102
78
|
static defaultAxisYWithGridLineConfig(theme) {
|
|
103
|
-
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisYConfig(theme)), { gridcolor:
|
|
79
|
+
return Object.assign(Object.assign({}, PlotlySetup.defaultAxisYConfig(theme)), { gridcolor: getRGBaColor(theme.axisGridColor), griddash: "dot" });
|
|
80
|
+
}
|
|
81
|
+
static defaultAxisTitleFont(theme) {
|
|
82
|
+
const font = theme.axisTitleFont;
|
|
83
|
+
const result = {
|
|
84
|
+
size: parseFloat(font.size),
|
|
85
|
+
color: font.color,
|
|
86
|
+
};
|
|
87
|
+
if (theme.isAxisLabelFontLoaded && theme.isAxisLabelFontLoaded()) {
|
|
88
|
+
result.family = font.family;
|
|
89
|
+
}
|
|
90
|
+
if (font.weight != null) {
|
|
91
|
+
result.weight = font.weight;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
104
94
|
}
|
|
105
95
|
static defaultGaugeConfig(theme) {
|
|
106
96
|
return {
|
|
107
|
-
bgcolor:
|
|
108
|
-
bordercolor:
|
|
97
|
+
bgcolor: getRGBaColor(theme.gaugeBackground),
|
|
98
|
+
bordercolor: getRGBaColor(theme.gaugeBackground),
|
|
109
99
|
bar: {
|
|
110
|
-
color:
|
|
100
|
+
color: getRGBaColor(theme.gaugeBarColor),
|
|
111
101
|
thickness: 0.5,
|
|
112
102
|
},
|
|
113
103
|
};
|
|
@@ -335,6 +325,7 @@ class PlotlySetup {
|
|
|
335
325
|
return { traces, layout, hasSeries };
|
|
336
326
|
}
|
|
337
327
|
static setupVBar(model, answersData) {
|
|
328
|
+
var _a, _b, _c, _d;
|
|
338
329
|
let topMargin = 30;
|
|
339
330
|
let bottomMargin = 30;
|
|
340
331
|
let { datasets, labels, colors, texts, seriesLabels, labelsTitle, valuesTitle } = answersData;
|
|
@@ -358,12 +349,22 @@ class PlotlySetup {
|
|
|
358
349
|
traceConfig.mode = "markers";
|
|
359
350
|
traceConfig.marker = { color: colors };
|
|
360
351
|
}
|
|
352
|
+
const yAxisInfo = model.getYAxisInfo();
|
|
353
|
+
const hasDualAxis = yAxisInfo.length >= 2;
|
|
361
354
|
datasets.forEach((dataset, index) => {
|
|
362
355
|
var trace = Object.assign({}, traceConfig, {
|
|
363
356
|
y: dataset,
|
|
364
357
|
name: hasSeries ? seriesLabels[index] : labels[index],
|
|
365
358
|
text: texts[index],
|
|
359
|
+
offsetgroup: index,
|
|
366
360
|
});
|
|
361
|
+
if (hasDualAxis && hasSeries) {
|
|
362
|
+
const seriesName = seriesLabels[index];
|
|
363
|
+
const onSecondary = yAxisInfo[1].seriesName && yAxisInfo[1].seriesName.indexOf(seriesName) !== -1;
|
|
364
|
+
if (onSecondary) {
|
|
365
|
+
trace.yaxis = "y2";
|
|
366
|
+
}
|
|
367
|
+
}
|
|
367
368
|
if (model.showPercentages) {
|
|
368
369
|
let texttemplate = model.showOnlyPercentages ? "%{text}%" : "%{value} (%{text}%)";
|
|
369
370
|
trace.texttemplate = texttemplate;
|
|
@@ -372,6 +373,8 @@ class PlotlySetup {
|
|
|
372
373
|
});
|
|
373
374
|
const maxTicks = 50;
|
|
374
375
|
const tickStep = Math.ceil(labels.length / maxTicks);
|
|
376
|
+
const primaryYAxisTitle = ((_b = (_a = yAxisInfo[0]) === null || _a === void 0 ? void 0 : _a.title) === null || _b === void 0 ? void 0 : _b.text) || valuesTitle;
|
|
377
|
+
const secondaryYAxisTitle = ((_d = (_c = yAxisInfo[1]) === null || _c === void 0 ? void 0 : _c.title) === null || _d === void 0 ? void 0 : _d.text) || "";
|
|
375
378
|
const layout = {
|
|
376
379
|
margin: {
|
|
377
380
|
t: topMargin,
|
|
@@ -385,7 +388,7 @@ class PlotlySetup {
|
|
|
385
388
|
paper_bgcolor: "transparent",
|
|
386
389
|
showlegend: hasSeries,
|
|
387
390
|
bargap: isHistogram ? 0 : PlotlySetup.defaultBarGap,
|
|
388
|
-
yaxis: Object.assign(Object.assign({}, PlotlySetup.defaultAxisYWithGridLineConfig(model.theme)), { rangemode: "nonnegative", automargin: true }),
|
|
391
|
+
yaxis: Object.assign(Object.assign({}, PlotlySetup.defaultAxisYWithGridLineConfig(model.theme)), { rangemode: "nonnegative", automargin: true, title: primaryYAxisTitle ? { text: primaryYAxisTitle, font: PlotlySetup.defaultAxisTitleFont(model.theme) } : undefined }),
|
|
389
392
|
xaxis: Object.assign(Object.assign({}, PlotlySetup.defaultAxisXConfig(model.theme)), { automargin: true, type: "category", tickmode: "array", tickvals: labels, ticktext: labels.map((label, index) => {
|
|
390
393
|
if (labels.length > maxTicks && index % tickStep !== 0) {
|
|
391
394
|
return "";
|
|
@@ -397,15 +400,16 @@ class PlotlySetup {
|
|
|
397
400
|
if (labelsTitle) {
|
|
398
401
|
layout.xaxis.title = { text: labelsTitle };
|
|
399
402
|
}
|
|
400
|
-
if (
|
|
401
|
-
layout.
|
|
402
|
-
}
|
|
403
|
-
if (model.showPercentages && model.showOnlyPercentages) {
|
|
404
|
-
layout.yaxis = Object.assign(Object.assign({}, PlotlySetup.defaultAxisYWithGridLineConfig(model.theme)), { tickformat: ".0%", range: [0, 1], ticklen: model.showOnlyPercentages ? 25 : 5, tickcolor: "transparent" });
|
|
403
|
+
if (hasDualAxis) {
|
|
404
|
+
layout.yaxis2 = Object.assign(Object.assign({}, PlotlySetup.defaultAxisYWithGridLineConfig(model.theme)), { overlaying: "y", anchor: "x", side: "right", title: secondaryYAxisTitle ? { text: secondaryYAxisTitle, font: PlotlySetup.defaultAxisTitleFont(model.theme) } : undefined });
|
|
405
405
|
}
|
|
406
|
+
if (model.showPercentages && model.showOnlyPercentages) ;
|
|
406
407
|
if (!model.getValueType || model.getValueType() != "date") {
|
|
407
408
|
layout.xaxis = Object.assign(Object.assign({}, PlotlySetup.defaultAxisXConfig(model.theme)), { type: "category" });
|
|
408
409
|
}
|
|
410
|
+
if (hasDualAxis) {
|
|
411
|
+
layout.xaxis.domain = [0.1, 0.9];
|
|
412
|
+
}
|
|
409
413
|
return { traces, layout, hasSeries };
|
|
410
414
|
}
|
|
411
415
|
static setupScatter(model, answersData) {
|