CoreVitalsSummaryController

CoreVitalsSummaryController

Stimulus controller that populates the mean core vitals score per vital type.

Constructor

new CoreVitalsSummaryController()

Source:

Extends

  • Controller

Methods

alertColor()

Source:

Return the color depending on the time in relation to the KPI

calculateMeanCoreVital()

Source:

connect()

Source:

Subscribe to the store.

contextData()

Source:

Get the data within the 75th percentile of all current results for the given context

coreVitalsGroupingCount()

Source:

Get the total count of results plus the number of results within each context.

dataForStackedBarChart()

Source:

Get the percentage for each context. The cumulative value informs the data viz at which x axis value the bar should start at. The bar class modifier is used in the CSS to change the bar colour

destroySingleStackedBarDisplay()

Source:

Destroy stacked bar charts for each context and set them to undefined so they will be created from scratch again

isDataVizEmpty()

Source:

Checks if the visualisation has been created yet

loadSummary()

Source:

Shows the loading indicator for the mean core vital values and hides the stacked bar charts and then destroys them so they can be created from scratch again when the new data is fetched from the database.

reconnect()

Source:

Handles a repeated Turbo visit to the dashboard page.

removeAlertColors()

Source:

Remove all of the color classes for the given target

resize()

Source:

Handles a resize of the screen by width but ignores height changes. Deletes the current visualisation and the instances of the stacked bar charts so they will be created from scratch again.

singleStackedBar()

Source:

Creates a new instance of the SingleStackedBar class if not created, otherwise returns the instance of the class

singleStackedBarDisplay()

Source:

Changes the visibility of the stacked bar charts to either show the data vis or a loading indicator

storeUpdated()

Source:

Triggered by the store whenever any store data changes.

updateContextDistribution()

Source:

Update the datavisualisation showing the split of good, okay, bad for the context

updateMeanCoreVitalsValue()

Source:

Sets the text for the mean core vital for the given context and alters to color to indicate whether it's good, needs improvement or poor.

updateSummary()

Source:

Update the summary details for the mean values and stacked bar charts