Class: Bars

Represents a bar chart visualization component.

The Bars class is responsible for rendering a bar chart visualization based on the provided data and configuration. It handles the creation of the necessary HTML elements, rendering of the bars, and management of user interactions such as scrolling, searching, and sorting.

Extends

Constructors

Constructor

new Bars(container, config?): Bars

Constructs a new instance of the Bars class, which is responsible for rendering a bar chart visualization.

Parameters

ParameterTypeDescription
containerHTMLElementThe HTML element that will contain the bar chart.
config?BarsConfigInterfaceAn optional configuration object that can be used to customize the behavior of the bar chart.

Returns

Bars

Overrides

DisplayStateManager.constructor

Accessors

_maxDisplayedItems

Get Signature

get _maxDisplayedItems(): number

Returns

number

Methods

extractConfig()

static extractConfig(config, defaultConfig): DisplayStateConfigInterface

Parameters

ParameterType
configDisplayStateConfigInterface
defaultConfigDisplayStateConfigInterface

Returns

DisplayStateConfigInterface

Inherited from

DisplayStateManager.extractConfig


showState()

showState(text?): void

Shows the DisplayState element with the specified text

Parameters

ParameterTypeDescription
text?stringOptional text to display, defaults to noDataMessage

Returns

void

Inherited from

DisplayStateManager.showState


hideState()

hideState(): void

Hides the DisplayState element

Returns

void

Inherited from

DisplayStateManager.hideState


setDisplayStateConfig()

setDisplayStateConfig(config): void

Updates the DisplayState configuration

Parameters

ParameterType
configDisplayStateConfigInterface

Returns

void

Inherited from

DisplayStateManager.setDisplayStateConfig


getConfig()

getConfig(): BarsConfigInterface

Returns the current configuration of the bars module.

Returns

BarsConfigInterface

The current configuration.


setConfig()

setConfig(config?): void

Sets the configuration for the bars module.

Parameters

ParameterTypeDescription
config?BarsConfigInterfaceThe configuration object to set.

Returns

void


setData()

setData(values?): void

Sets the data for the bars module.

Parameters

ParameterTypeDefault valueDescription
values?any[][]The array of values to set as the data.

Returns

void


sortByCount()

sortByCount(ascending?): void

Sorts the data in the bars module by the count of each item, in ascending or descending order.

Parameters

ParameterTypeDefault valueDescription
ascending?booleanfalseIf true, sorts the data in ascending order by count. Otherwise, sorts in descending order.

Returns

void


sortAlphabetically()

sortAlphabetically(ascending?): void

Sorts the data in the bars module alphabetically by the label of each item, in ascending or descending order.

Parameters

ParameterTypeDefault valueDescription
ascending?booleantrueIf true, sorts the data in ascending alphabetical order by label. Otherwise, sorts in descending alphabetical order.

Returns

void


destroy()

destroy(): void

Destroys the bars module by removing event listeners, clearing the container, and resetting internal data structures. This method should be called when the bars module is no longer needed to clean up any resources it has allocated.

Returns

void

Overrides

DisplayStateManager.destroy


resetList()

resetList(): void

Returns

void


setSelectedItem()

setSelectedItem(item?): void

Sets the currently selected item in the bars module.

Parameters

ParameterTypeDescription
item?BarDataThe bar data item to select, or undefined to clear the selection.

Returns

void


setLoadingState()

setLoadingState(): void

Sets the loading state of the bars module by updating the text content of a fallback div. This method is typically called when data is being loaded asynchronously to provide a visual indication to the user.

Returns

void

Overrides

DisplayStateManager.setLoadingState