survey-analytics 1.9.83 → 1.9.85

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/package.json CHANGED
@@ -13,13 +13,14 @@
13
13
  "watch:dev": "webpack --env.buildType dev --watch",
14
14
  "build:dev": "webpack --env.buildType dev",
15
15
  "build:prod": "npm run build:dev && webpack --env.buildType prod",
16
+ "build": "npm run build:prod",
16
17
  "build:types:summary": "tsc --p tsconfig.summary.json && echo \"declare module 'survey-analytics' { import main = require('entries/summary'); export = main; }\" >> packages/survey.analytics.d.ts",
17
18
  "build:types:datatables": "tsc --p tsconfig.datatables.json && echo \"declare module 'survey-analytics/survey.analytics.datatables' { import main = require('entries/datatables'); export = main; }\" >> packages/survey.analytics.datatables.d.ts",
18
19
  "build:types:tabulator": "tsc --p tsconfig.tabulator.json && echo \"declare module 'survey-analytics/survey.analytics.tabulator' { import main = require('entries/tabulator'); export = main; }\" >> packages/survey.analytics.tabulator.d.ts",
19
20
  "lint": "eslint ./src --quiet",
20
21
  "pre-push-check": "npm run lint && npm run test"
21
22
  },
22
- "version": "1.9.83",
23
+ "version": "1.9.85",
23
24
  "name": "survey-analytics",
24
25
  "description": "SurveyJS analytics Library.",
25
26
  "main": "survey.analytics.js",
@@ -71,7 +72,7 @@
71
72
  "jquery": "3.5.0",
72
73
  "muuri": "^0.8.0",
73
74
  "plotly.js-dist-min": "^2.11.1",
74
- "survey-core": "1.9.83",
75
+ "survey-core": "1.9.85",
75
76
  "tabulator-tables": "4.8.4",
76
77
  "wordcloud": "^1.2.2"
77
78
  },
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.83
2
+ * surveyjs - SurveyJS Dashboard library v1.9.85
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -770,20 +770,28 @@ declare module "visualizerBase" {
770
770
  import { IDataInfo, DataProvider } from "dataProvider";
771
771
  import { Event } from "survey-core";
772
772
  /**
773
- * VisualizerBase is a base object for all visuzlizers. It responsible for the rendering and destroying visualizer.
773
+ * A base object for all visualizers. Use it to implement a custom visualizer.
774
774
  *
775
- * constructor parameters:
776
- * question - a survey question to visualize,
777
- * data - an array of answers in format of survey result,
778
- * options - object with the following options,
779
- * name - visualizer name
775
+ * Constructor parameters:
780
776
  *
781
- * options:
782
- * seriesValues - an array of series values in data to group data by series,
783
- * seriesLabels - labels for series to display, if not passed the seriesValues are used as labels,
784
- * survey - pass survey instance to use localses from the survey JSON,
785
- * dataProvider - dataProvider for this visualizer,
777
+ * - `question`: [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question)\
778
+ * A survey question to visualize.
779
+ * - `data`: `Array<any>`\
780
+ * Survey results.
781
+ * - `options`\
782
+ * An object with the following properties:
783
+ * - `seriesValues`: `Array<String>`\
784
+ * Series values used to group data.
785
+ * - `seriesLabels`: `Array<String>`\
786
+ * Series labels to display. If this property is not set, `seriesValues` are used as labels.
787
+ * - `survey`: [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model)\
788
+ * Pass a `SurveyModel` instance if you want to use locales from the survey JSON schema.
789
+ * - `dataProvider`: `DataProvider`\
790
+ * A data provider for this visualizer.
791
+ * - `name`: `String`\
792
+ * *(Optional)* The visualizer's name.
786
793
  *
794
+ * [View Demo](https://surveyjs.io/dashboard/examples/how-to-plot-survey-data-in-custom-bar-chart/ (linkStyle))
787
795
  */
788
796
  export class VisualizerBase implements IDataInfo {
789
797
  question: Question;
@@ -803,14 +811,31 @@ declare module "visualizerBase" {
803
811
  protected _supportSelection: boolean;
804
812
  static otherCommentCollapsed: boolean;
805
813
  /**
806
- * The event is fired right after a visualizer's content is rendered in DOM.
814
+ * An event that is raised after the visualizer's content is rendered.
815
+ *
816
+ * Parameters:
817
+ *
818
+ * - `sender`: `VisualizerBase`\
819
+ * A `VisualizerBase` instance that raised the event.
820
+ *
821
+ * - `options.htmlElement`: `HTMLElement`\
822
+ * A page element with the visualizer's content.
823
+ * @see render
824
+ * @see refresh
807
825
  **/
808
826
  onAfterRender: Event<(sender: VisualizerBase, options: any) => any, VisualizerBase, any>;
809
827
  protected afterRender(contentContainer: HTMLElement): void;
810
828
  /**
811
- * Fires when visualizer locale changed.
812
- * sender - this visualizer
813
- * locale - new locale of the visualizer
829
+ * An event that is raised after a new locale is set.
830
+ *
831
+ * Parameters:
832
+ *
833
+ * - `sender`: `VisualizerBase`\
834
+ * A `VisualizerBase` instance that raised the event.
835
+ *
836
+ * - `options.locale`: `String`\
837
+ * The indentifier of a new locale (for example, "en").
838
+ * @see locale
814
839
  */
815
840
  onLocaleChanged: Event<(sender: VisualizerBase, options: {
816
841
  locale: string;
@@ -824,68 +849,54 @@ declare module "visualizerBase" {
824
849
  [index: string]: any;
825
850
  }, _name?: string);
826
851
  protected get questionOptions(): any;
827
- /**
828
- * This method is called then data has been changed for some reason, e.g. filter was set.
829
- * This method should be overriden if descendant computes own statistics or process data somehow.
830
- */
831
852
  protected onDataChanged(): void;
832
- /**
833
- * Name of the data field of data object from the data array.
834
- */
835
853
  get dataName(): string | Array<string>;
836
854
  /**
837
- * Indicates whether visualizer has header. Usually it is true then a question has correct answer.
855
+ * Indicates whether the visualizer displays a header. This property is `true` when a visualized question has a correct answer.
856
+ * @see hasFooter
838
857
  */
839
858
  get hasHeader(): boolean;
840
859
  /**
841
- * Indicates whether visualizer has footer. Usually it is true then a question has comment or choices question has other item.
860
+ * Indicates whether the visualizer displays a footer. This property is `true` when a visualized question has a comment.
861
+ * @see hasHeader
842
862
  */
843
863
  get hasFooter(): boolean;
844
864
  protected createVisualizer<T = VisualizerBase>(question: Question): T;
845
865
  /**
846
- * Footer visualizer getter.
866
+ * Allows you to access the footer visualizer. Returns `undefined` if the footer is absent.
867
+ * @see hasFooter
847
868
  */
848
869
  get footerVisualizer(): VisualizerBase;
849
870
  /**
850
- * Indicates whether visualizer supports selection. Visualizers of questions with choices allow to select choice by clicking on the diagram bar and filter other data for the selected item.
871
+ * Indicates whether users can select series points to cross-filter charts. To allow or disallow selection, set the `allowSelection` property of the `options` object in the constructor.
851
872
  */
852
873
  get supportSelection(): boolean;
853
- /**
854
- * Series values getter. Some questions (used in matrices) should be grouped by matrix rows. This groups are called series.
855
- */
856
874
  getSeriesValues(): Array<string>;
857
- /**
858
- * Series labels getter. Some questions (used in matrices) should be grouped by matrix rows. This groups are called series.
859
- */
860
875
  getSeriesLabels(): Array<string>;
861
- /**
862
- * Available values of question answers (available choices).
863
- */
864
876
  getValues(): Array<any>;
865
- /**
866
- * Available labels of question answers (human readable representation of available choices).
867
- */
868
877
  getLabels(): Array<string>;
869
878
  /**
870
- * Registers creator of visualizer toolbar item.
879
+ * Registers a function used to create a toolbar item for this visualizer.
880
+ * @param name A custom name for the toolbar item.
881
+ * @param creator A function that accepts the toolbar and should return an `HTMLElement` with the toolbar item.
871
882
  */
872
883
  registerToolbarItem(name: string, creator: (toolbar?: HTMLDivElement) => HTMLElement): void;
873
884
  /**
874
- * The name of the visaulizer.
885
+ * Returns the visualizer's name.
875
886
  */
876
887
  get name(): string;
877
888
  /**
878
- * The actual data of the visaulizer.
889
+ * Returns an array of survey results used to calculate values for visualization. If a user applies a filter, the array is also filtered.
890
+ *
891
+ * To get an array of calculated and visualized values, call the [`getData()`](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase#getData) method.
879
892
  */
880
893
  protected get data(): {
881
894
  [index: string]: any;
882
895
  }[];
883
- /**
884
- * The data provider is used by the visaulizer.
885
- */
886
896
  protected get dataProvider(): DataProvider;
887
897
  /**
888
- * Updates visualizer data.
898
+ * Updates visualized data.
899
+ * @param data A data array with survey results to be visualized.
889
900
  */
890
901
  updateData(data: Array<{
891
902
  [index: string]: any;
@@ -893,57 +904,33 @@ declare module "visualizerBase" {
893
904
  onUpdate: () => void;
894
905
  invokeOnUpdate(): void;
895
906
  /**
896
- * Destroys visualizer.
907
+ * Deletes the visualizer and all its elements from the DOM.
908
+ * @see clear
897
909
  */
898
910
  destroy(): void;
899
911
  /**
900
- * Method for clearing all rendered elements from outside.
912
+ * Empties the toolbar, footer, and content containers.
913
+ *
914
+ * If you want to empty and delete the visualizer and all its elements from the DOM, call the [`destroy()`](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase#destroy) method instead.
901
915
  */
902
916
  clear(): void;
903
917
  protected createToolbarItems(toolbar: HTMLDivElement): void;
904
918
  protected getCorrectAnswerText(): string;
905
- /**
906
- * Destroys visualizer toolbar.
907
- */
908
919
  protected destroyToolbar(container: HTMLElement): void;
909
- /**
910
- * Renderss visualizer toolbar.
911
- */
912
920
  protected renderToolbar(container: HTMLElement): void;
913
- /**
914
- * Destroys visualizer header.
915
- * Usually overriden in descendants.
916
- */
917
921
  protected destroyHeader(container: HTMLElement): void;
918
- /**
919
- * Destroys visualizer content.
920
- * Usually overriden in descendants.
921
- */
922
922
  protected destroyContent(container: HTMLElement): void;
923
- /**
924
- * Renders visualizer header.
925
- * Usually overriden in descendants.
926
- */
927
923
  protected renderHeader(container: HTMLElement): void;
928
- /**
929
- * Renders visualizer content.
930
- * Usually overriden in descendants.
931
- */
932
924
  protected renderContent(container: HTMLElement): void;
933
- /**
934
- * Destroys visualizer footer.
935
- */
936
925
  protected destroyFooter(container: HTMLElement): void;
937
- /**
938
- * Renders visualizer footer.
939
- */
940
926
  protected renderFooter(container: HTMLElement): void;
941
927
  /**
942
- * Renders visualizer in the given container.
928
+ * Renders the visualizer in a specified container.
929
+ * @param targetElement An `HTMLElement` or an `id` of a page element in which you want to render the visualizer.
943
930
  */
944
931
  render(targetElement: HTMLElement | string): void;
945
932
  /**
946
- * Redraws visualizer and all inner content.
933
+ * Re-renders the visualizer and its content.
947
934
  */
948
935
  refresh(): void;
949
936
  protected processText(text: string): string;
@@ -956,23 +943,42 @@ declare module "visualizerBase" {
956
943
  static customColors: string[];
957
944
  private static colors;
958
945
  getColors(count?: number): any;
946
+ /**
947
+ * Gets or sets the visibility of the visualizer's toolbar.
948
+ *
949
+ * Default value: `true`
950
+ */
959
951
  get showHeader(): boolean;
960
952
  set showHeader(newValue: boolean);
961
953
  /**
962
- * Returns data to be used in the visualizer.
954
+ * Returns an array of calculated and visualized values. If a user applies a filter, the array is also filtered.
955
+ *
956
+ * To get an array of source survey results, use the [`data`](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase#data) property.
963
957
  */
964
958
  getData(): any;
959
+ /**
960
+ * Returns an object with properties that describe a current visualizer state. The properties are different for each individual visualizer.
961
+ *
962
+ * > This method is overriden in descendant classes.
963
+ * @see setState
964
+ */
965
965
  getState(): any;
966
- setState(state: any): void;
967
966
  /**
968
- * Returns current locale of the visualizer.
969
- * If locales more than one, the language selection dropdown will be added in the toolbar
970
- * In order to use survey locales the survey instance object should be passed as 'survey' option for visualizer
967
+ * Sets the visualizer's state.
968
+ *
969
+ * > This method is overriden in descendant classes.
970
+ * @see getState
971
971
  */
972
- get locale(): string;
972
+ setState(state: any): void;
973
973
  /**
974
- * Sets locale for visualization panel.
974
+ * Gets or sets the current locale.
975
+ *
976
+ * If you want to inherit the locale from a visualized survey, assign a `SurveyModel` instance to the `survey` property of the `options` object in the constructor.
977
+ *
978
+ * If the survey is [translated into more than one language](https://surveyjs.io/form-library/examples/survey-localization/), the toolbar displays a language selection drop-down menu.
979
+ * @see onLocaleChanged
975
980
  */
981
+ get locale(): string;
976
982
  set locale(newLocale: string);
977
983
  protected setLocale(newLocale: string): void;
978
984
  }
@@ -1042,7 +1048,12 @@ declare module "selectBase" {
1042
1048
  [index: string]: any;
1043
1049
  }>, options?: any, name?: string);
1044
1050
  protected chartTypes: string[];
1045
- chartType: string;
1051
+ protected _chartType: string;
1052
+ /**
1053
+ * Chart type - current chart type.
1054
+ */
1055
+ get chartType(): string;
1056
+ set chartType(newChartType: string);
1046
1057
  private updateEmptyAnswersBtn;
1047
1058
  private updateTransposeDataBtn;
1048
1059
  private updateOrderSelector;
@@ -1055,19 +1066,37 @@ declare module "selectBase" {
1055
1066
  getSelectedItemByText(itemText: string): any;
1056
1067
  setSelection(item: ItemValue): void;
1057
1068
  get selection(): ItemValue;
1069
+ /**
1070
+ * Gets and sets whether chart should show percentages only.
1071
+ */
1058
1072
  get showOnlyPercentages(): boolean;
1059
1073
  set showOnlyPercentages(val: boolean);
1074
+ /**
1075
+ * Gets and sets whether chart should show values and percentages.
1076
+ */
1060
1077
  get showPercentages(): boolean;
1061
1078
  set showPercentages(val: boolean);
1079
+ /**
1080
+ * Gets and sets chart elements order.
1081
+ */
1062
1082
  get answersOrder(): string;
1063
1083
  set answersOrder(value: string);
1084
+ /**
1085
+ * Set to true if need to hide empty chart elements (e.g. bars vith zero value).
1086
+ */
1064
1087
  get hideEmptyAnswers(): boolean;
1065
1088
  set hideEmptyAnswers(value: boolean);
1066
1089
  get transposeData(): boolean;
1067
1090
  set transposeData(value: boolean);
1091
+ /**
1092
+ * Set to some value if need to show top N chart elements.
1093
+ */
1068
1094
  get topN(): number;
1069
1095
  set topN(value: number);
1070
1096
  protected isSupportMissingAnswers(): boolean;
1097
+ /**
1098
+ * Set to true if you want to see chart elements for missing answers (e.g. radiogroup items never been selected by surveyee).
1099
+ */
1071
1100
  get showMissingAnswers(): boolean;
1072
1101
  set showMissingAnswers(value: boolean);
1073
1102
  refreshContent(): void;
@@ -1120,7 +1149,6 @@ declare module "boolean" {
1120
1149
  import { SelectBase } from "selectBase";
1121
1150
  export class BooleanModel extends SelectBase {
1122
1151
  protected chartTypes: string[];
1123
- chartType: string;
1124
1152
  constructor(question: Question, data: Array<{
1125
1153
  [index: string]: any;
1126
1154
  }>, options?: Object, name?: string);
@@ -1143,7 +1171,6 @@ declare module "histogram" {
1143
1171
  private _cachedIntervals;
1144
1172
  private _intervalPrecision;
1145
1173
  protected chartTypes: string[];
1146
- chartType: string;
1147
1174
  static IntervalsCount: number;
1148
1175
  static UseIntervalsFrom: number;
1149
1176
  constructor(question: Question, data: Array<{
@@ -1223,7 +1250,6 @@ declare module "config" {
1223
1250
  displayName: string;
1224
1251
  isVisible: boolean;
1225
1252
  isPublic: boolean;
1226
- type?: string;
1227
1253
  chartType?: string;
1228
1254
  answersOrder?: string;
1229
1255
  hideEmptyAnswers?: boolean;
@@ -1252,6 +1278,10 @@ declare module "filterInfo" {
1252
1278
  }
1253
1279
  }
1254
1280
  declare module "layoutEngine" {
1281
+ /**
1282
+ * LayoutEngine controls visualizer layoput in a visualization panel.
1283
+ * You can create a descendant of this class in order to override layout.
1284
+ */
1255
1285
  export class LayoutEngine {
1256
1286
  protected _allowed: boolean;
1257
1287
  constructor(_allowed: boolean);
@@ -1259,8 +1289,17 @@ declare module "layoutEngine" {
1259
1289
  protected stopCore(): void;
1260
1290
  protected updateCore(): void;
1261
1291
  get allowed(): boolean;
1292
+ /**
1293
+ * Initilizes layout engine in the given HTML element.
1294
+ */
1262
1295
  start(container: HTMLElement): void;
1296
+ /**
1297
+ * Deactivates layouting: stops elements auto-positioning
1298
+ */
1263
1299
  stop(): void;
1300
+ /**
1301
+ * Updates layout: performs elements auto-positioning
1302
+ */
1264
1303
  update(): void;
1265
1304
  add(elements: Array<HTMLElement>, options?: any): void;
1266
1305
  remove(elements: Array<HTMLElement>, options?: any): void;
@@ -1293,7 +1332,11 @@ declare module "visualizationPanel" {
1293
1332
  * Visualization Panel configuration. Pass it as the third argument to the `VisualizationPanel` constructor:
1294
1333
  *
1295
1334
  * ```js
1296
- * const vizPanel = new SurveyAnalytics.VisualizationPanel(surveyQuestions, surveyResults, vizPanelOptions);
1335
+ * const vizPanel = new SurveyAnalytics.VisualizationPanel(
1336
+ * surveyQuestions,
1337
+ * surveyResults,
1338
+ * vizPanelOptions
1339
+ * );
1297
1340
  * ```
1298
1341
  */
1299
1342
  export interface IVisualizationPanelOptions {
@@ -1613,9 +1656,6 @@ declare module "visualizationPanel" {
1613
1656
  * Fires when permissions changed
1614
1657
  */
1615
1658
  onPermissionsChangedCallback: any;
1616
- /**
1617
- * Renders given panel element.
1618
- */
1619
1659
  protected renderPanelElement(element: IVisualizerPanelRenderedElement, container: HTMLElement): HTMLElement;
1620
1660
  protected renderToolbar(container: HTMLElement): void;
1621
1661
  /**
@@ -1623,9 +1663,6 @@ declare module "visualizationPanel" {
1623
1663
  * container - HTML element to render the panel
1624
1664
  */
1625
1665
  renderContent(container: HTMLElement): void;
1626
- /**
1627
- * Destroys visualizer and all inner content.
1628
- */
1629
1666
  protected destroyContent(container: HTMLElement): void;
1630
1667
  /**
1631
1668
  * Redraws visualizer toobar and all inner content.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.83
2
+ * surveyjs - SurveyJS Dashboard library v1.9.85
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.83
2
+ * surveyjs - SurveyJS Dashboard library v1.9.85
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.83
2
+ * surveyjs - SurveyJS Dashboard library v1.9.85
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.83
2
+ * surveyjs - SurveyJS Dashboard library v1.9.85
3
3
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */