survey-analytics 1.9.84 → 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
@@ -20,7 +20,7 @@
20
20
  "lint": "eslint ./src --quiet",
21
21
  "pre-push-check": "npm run lint && npm run test"
22
22
  },
23
- "version": "1.9.84",
23
+ "version": "1.9.85",
24
24
  "name": "survey-analytics",
25
25
  "description": "SurveyJS analytics Library.",
26
26
  "main": "survey.analytics.js",
@@ -72,7 +72,7 @@
72
72
  "jquery": "3.5.0",
73
73
  "muuri": "^0.8.0",
74
74
  "plotly.js-dist-min": "^2.11.1",
75
- "survey-core": "1.9.84",
75
+ "survey-core": "1.9.85",
76
76
  "tabulator-tables": "4.8.4",
77
77
  "wordcloud": "^1.2.2"
78
78
  },
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.84
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;
@@ -825,60 +850,53 @@ declare module "visualizerBase" {
825
850
  }, _name?: string);
826
851
  protected get questionOptions(): any;
827
852
  protected onDataChanged(): void;
828
- /**
829
- * Name of the data field of data object from the data array.
830
- */
831
853
  get dataName(): string | Array<string>;
832
854
  /**
833
- * 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
834
857
  */
835
858
  get hasHeader(): boolean;
836
859
  /**
837
- * 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
838
862
  */
839
863
  get hasFooter(): boolean;
840
864
  protected createVisualizer<T = VisualizerBase>(question: Question): T;
841
865
  /**
842
- * Footer visualizer getter.
866
+ * Allows you to access the footer visualizer. Returns `undefined` if the footer is absent.
867
+ * @see hasFooter
843
868
  */
844
869
  get footerVisualizer(): VisualizerBase;
845
870
  /**
846
- * 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.
847
872
  */
848
873
  get supportSelection(): boolean;
849
- /**
850
- * Series values getter. Some questions (used in matrices) should be grouped by matrix rows. This groups are called series.
851
- */
852
874
  getSeriesValues(): Array<string>;
853
- /**
854
- * Series labels getter. Some questions (used in matrices) should be grouped by matrix rows. This groups are called series.
855
- */
856
875
  getSeriesLabels(): Array<string>;
857
- /**
858
- * Available values of question answers (available choices).
859
- */
860
876
  getValues(): Array<any>;
861
- /**
862
- * Available labels of question answers (human readable representation of available choices).
863
- */
864
877
  getLabels(): Array<string>;
865
878
  /**
866
- * 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.
867
882
  */
868
883
  registerToolbarItem(name: string, creator: (toolbar?: HTMLDivElement) => HTMLElement): void;
869
884
  /**
870
- * The name of the visaulizer.
885
+ * Returns the visualizer's name.
871
886
  */
872
887
  get name(): string;
873
888
  /**
874
- * 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.
875
892
  */
876
893
  protected get data(): {
877
894
  [index: string]: any;
878
895
  }[];
879
896
  protected get dataProvider(): DataProvider;
880
897
  /**
881
- * Updates visualizer data.
898
+ * Updates visualized data.
899
+ * @param data A data array with survey results to be visualized.
882
900
  */
883
901
  updateData(data: Array<{
884
902
  [index: string]: any;
@@ -886,11 +904,14 @@ declare module "visualizerBase" {
886
904
  onUpdate: () => void;
887
905
  invokeOnUpdate(): void;
888
906
  /**
889
- * Destroys visualizer.
907
+ * Deletes the visualizer and all its elements from the DOM.
908
+ * @see clear
890
909
  */
891
910
  destroy(): void;
892
911
  /**
893
- * 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.
894
915
  */
895
916
  clear(): void;
896
917
  protected createToolbarItems(toolbar: HTMLDivElement): void;
@@ -904,11 +925,12 @@ declare module "visualizerBase" {
904
925
  protected destroyFooter(container: HTMLElement): void;
905
926
  protected renderFooter(container: HTMLElement): void;
906
927
  /**
907
- * 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.
908
930
  */
909
931
  render(targetElement: HTMLElement | string): void;
910
932
  /**
911
- * Redraws visualizer and all inner content.
933
+ * Re-renders the visualizer and its content.
912
934
  */
913
935
  refresh(): void;
914
936
  protected processText(text: string): string;
@@ -922,36 +944,41 @@ declare module "visualizerBase" {
922
944
  private static colors;
923
945
  getColors(count?: number): any;
924
946
  /**
925
- * Returns whether the visualizer renders it header.
947
+ * Gets or sets the visibility of the visualizer's toolbar.
948
+ *
949
+ * Default value: `true`
926
950
  */
927
951
  get showHeader(): boolean;
928
- /**
929
- * Sets whether the visualizer renders it header.
930
- */
931
952
  set showHeader(newValue: boolean);
932
953
  /**
933
- * 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.
934
957
  */
935
958
  getData(): any;
936
959
  /**
937
- * Returns visualizer state - options control visualizer behavior and rendering.
938
- * Overriden in descendants
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
939
964
  */
940
965
  getState(): any;
941
966
  /**
942
- * Sets visualizer state - options control visualizer behavior and rendering.
943
- * Overriden in descendants
967
+ * Sets the visualizer's state.
968
+ *
969
+ * > This method is overriden in descendant classes.
970
+ * @see getState
944
971
  */
945
972
  setState(state: any): void;
946
973
  /**
947
- * Returns current locale of the visualizer.
948
- * If locales more than one, the language selection dropdown will be added in the toolbar
949
- * In order to use survey locales the survey instance object should be passed as 'survey' option for visualizer
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
950
980
  */
951
981
  get locale(): string;
952
- /**
953
- * Sets locale for visualization panel.
954
- */
955
982
  set locale(newLocale: string);
956
983
  protected setLocale(newLocale: string): void;
957
984
  }
@@ -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;
@@ -1306,7 +1332,11 @@ declare module "visualizationPanel" {
1306
1332
  * Visualization Panel configuration. Pass it as the third argument to the `VisualizationPanel` constructor:
1307
1333
  *
1308
1334
  * ```js
1309
- * const vizPanel = new SurveyAnalytics.VisualizationPanel(surveyQuestions, surveyResults, vizPanelOptions);
1335
+ * const vizPanel = new SurveyAnalytics.VisualizationPanel(
1336
+ * surveyQuestions,
1337
+ * surveyResults,
1338
+ * vizPanelOptions
1339
+ * );
1310
1340
  * ```
1311
1341
  */
1312
1342
  export interface IVisualizationPanelOptions {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.9.84
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.84
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.84
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.84
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
  */