VisualizerBase
A base object for all visualizers. Use it to implement a custom visualizer.
Constructor parameters:
question
:Question
A survey question to visualize.data
:Array<any>
Survey results.options
An object with the following properties:seriesValues
:Array<String>
Series values used to group data.seriesLabels
:Array<String>
Series labels to display. If this property is not set,seriesValues
are used as labels.survey
:SurveyModel
Pass aSurveyModel
instance if you want to use locales from the survey JSON schema.dataProvider
:DataProvider
A data provider for this visualizer.
type
:String
(Optional) The visualizer's type.
Events
Empties the toolbar, header, footer, and content containers.
If you want to empty and delete the visualizer and all its elements from the DOM, call the destroy()
method instead.
- Type:
- () => void
- Implemented in:
- VisualizerBase
Returns an array of survey results used to calculate values for visualization. If a user applies a filter, the array is also filtered.
To get an array of calculated and visualized values, call the getData()
method.
- Type:
- any readonly
- Implemented in:
- VisualizerBase
Deletes the visualizer and all its elements from the DOM.
- Type:
- () => void
- Implemented in:
- VisualizerBase
- See also:
- clear
Returns an array of calculated and visualized values. If a user applies a filter, the array is also filtered.
To get an array of source survey results, use the data
property.
- Type:
- () => any
- Implemented in:
- VisualizerBase
Returns an object with properties that describe a current visualizer state. The properties are different for each individual visualizer.
This method is overriden in descendant classes.
- Type:
- () => any
- Implemented in:
- VisualizerBase
- See also:
- setState
Indicates whether the visualizer displays a header. This property is true
when a visualized question has a correct answer.
- Type:
- boolean readonly
- Implemented in:
- VisualizerBase
- See also:
- hasFooter
Gets or sets the current locale.
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.
If the survey is translated into more than one language, the toolbar displays a language selection drop-down menu.
- Type:
- string writable
- Implemented in:
- VisualizerBase
- See also:
- onLocaleChanged
An event that is raised after the visualizer's content is rendered.
Parameters:
sender
:VisualizerBase
AVisualizerBase
instance that raised the event.options.htmlElement
:HTMLElement
A page element with the visualizer's content.
- Type:
- Event<(sender: VisualizerBase, options: any) => any, VisualizerBase, any>
- Implemented in:
- VisualizerBase
- See also:
- render * , refresh **
An event that is raised after a new locale is set.
Parameters:
sender
:VisualizerBase
AVisualizerBase
instance that raised the event.options.locale
:String
The indentifier of a new locale (for example, "en").
- Type:
- Event<(sender: VisualizerBase, options: { locale: string; }) => any, VisualizerBase, any>
- Implemented in:
- VisualizerBase
- See also:
- locale
Registers a function used to create a toolbar item for this visualizer.
- Type:
- (name: string, creator: (toolbar?: any) => any) => void
- Parameters:
-
name, type: string ,
A custom name for the toolbar item.
creator, type: (toolbar?: any) => any ,A function that accepts the toolbar and should return an
HTMLElement
with the toolbar item.
- Implemented in:
- VisualizerBase
Renders the visualizer in a specified container.
- Type:
- (targetElement: any) => void
- Parameters:
-
targetElement, type: any ,
An
HTMLElement
or anid
of a page element in which you want to render the visualizer.
- Implemented in:
- VisualizerBase
Sets the visualizer's state.
This method is overriden in descendant classes.
- Type:
- (state: any) => void
- Parameters:
-
state, type: any
- Implemented in:
- VisualizerBase
- See also:
- getState
Gets or sets the visibility of the visualizer's toolbar.
Default value: true
- Type:
- boolean writable
- Implemented in:
- VisualizerBase
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.
- Type:
- boolean readonly
- Implemented in:
- VisualizerBase
Updates visualized data.
- Type:
- (data: any) => void
- Parameters:
-
data, type: any ,
A data array with survey results to be visualized.
- Implemented in:
- VisualizerBase
Copyright © 2023 Devsoft Baltic OÜ. All rights reserved.