- Information
- License (MIT)
- Recent Changes
- Supported Languages
- Supported Export Types
- Supported Import Types
- Setup
- Getting Started
- CDN Links
- Navigation
- Shortcut Keys
- API
- Public Functions
- Configuration
- Main Options
- Text Options
- Binding Options
- Basic Options
- Side Menu
- Title Bar
- Yearly Statistics
- Description
- Guide
- Zooming
- ToolTip
- Holiday
- Dynamic Color Range
- Color Range
- Date Formatting
- Custom Triggers
Class Instance Functions
Explore this comprehensive list of all public API functions available in a Heat.js. Use these methods to integrate, customize, and extend your map functionality.
Example
const activeView = $heat.getActiveView( "heat-map" );
Manage Dates
addType( elementId, type, [triggerRefresh] ):
Adds a new empty trend type.
Fires: onAddType
Parameter: elementId: string - The Heat.js element ID that should show the new trend type.
Parameter: type: string - The trend type.
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
removeType( elementId, type, [triggerRefresh] ):
Removes an existing trend type.
Fires: onRemoveType
Parameter: elementId: string - The Heat.js element ID that should remove the existing trend type.
Parameter: type: string - The trend type.
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
addDates( elementId, dates, [type], [triggerRefresh] ):
Adds an array of dates for a specific element ID, and refreshes the UI (if specified). If the date already exists, its value is increased by one.
Fires: onAddDate
Parameter: elementId: string - The Heat.js element ID that should show the new date.
Parameter: dates: Date[] - The dates to add.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
addDate( elementId, date, [type], [triggerRefresh] ):
Adds a date for a specific element ID, and refreshes the UI (if specified). If the date already exists, its value is increased by one.
Fires: onAddDate
Parameter: elementId: string - The Heat.js element ID that should show the new date.
Parameter: date: Date - The date to add.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
updateDate( elementId, date, count, [type], [triggerRefresh] ):
Updates a date for a specific element ID, and refreshes the UI (if specified).
Fires: onUpdateDate
Parameter: elementId: string - The Heat.js element ID that should show the updated date.
Parameter: date: Date - The date to update.
Parameter: count: number - The count that should be shown.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
removeDates( elementId, dates, [type], [triggerRefresh] ):
Removes an array of dates for a specific element ID, and refreshes the UI (if specified). If the dates already exist, their values are decreased by one.
Fires: onRemoveDate
Parameter: elementId: string - The Heat.js element ID that should show the updated date.
Parameter: dates: Date[] - The dates to remove.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
removeDate( elementId, date, [type], [triggerRefresh] ):
Removes a date for a specific element ID, and refreshes the UI (if specified). If the date already exists, its value is decreased by one.
Fires: onRemoveDate
Parameter: elementId: string - The Heat.js element ID that should show the updated date.
Parameter: date: Date - The date to remove.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
clearDate( elementId, date, [type], [triggerRefresh] ):
Clears a date for a specific element ID, and refreshes the UI (if specified).
Fires: onClearDate
Parameter: elementId: string - The Heat.js element ID that should show the updated date.
Parameter: date: Date - The date to clear.
Parameter: [type]: string - The trend type (defaults to "Unknown").
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
resetAll( [triggerRefresh] ):
Removes all the dates for all the elements, and refreshes the UI (if specified).
Fires: onReset
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
reset( elementId, [triggerRefresh] ):
Removes all the dates for a specific element ID, and refreshes the UI (if specified).
Fires: onReset
Parameter: elementId: string - The Heat.js element ID that should be updated.
Parameter: [triggerRefresh]: boolean - States if the UI for the element ID should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
Import/Export
import( elementId, [files] ):
Imports data from an array of file objects (or opens the import dialog if files are not supplied).
Fires: onImport
Parameter: elementId: string - The Heat.js element ID whose data should be updated.
Parameter: [files]: Object - The file objects that the data should be imported from.
Returns: Object - The Heat.js class instance.
export( elementId, [exportType] ):
Exports all the data for a specific element ID.
Fires: onExport
Parameter: elementId: string - The Heat.js element ID whose data should be exported.
Parameter: [exportType]: string - The export type to use (defaults to "json", also accepts "csv", "xml", "txt", "md", "html", "tsv", "yaml", and "toml").
Returns: Object - The Heat.js class instance.
Manage Instances
refresh( elementId ):
Refreshes a Heat.js instance.
Fires: onRefresh
Parameter: elementId: string - The Heat.js element ID that should be refreshed.
Returns: Object - The Heat.js class instance.
refreshAll():
Refreshes all the rendered Heat.js instances.
Fires: onRefresh
Returns: Object - The Heat.js class instance.
setYear( elementId, year ):
Sets the year to be displayed.
Fires: onSetYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Parameter: year: number - The year that should be shown.
Returns: Object - The Heat.js class instance.
setYearToHighest( elementId ):
Sets the year to the highest year available.
Fires: onSetYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Returns: Object - The Heat.js class instance.
setYearToLowest( elementId ):
Sets the year to the lowest year available.
Fires: onSetYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Returns: Object - The Heat.js class instance.
moveToPreviousYear( elementId ):
Moves the year back one.
Fires: onBackYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Returns: Object - The Heat.js class instance.
moveToNextYear( elementId ):
Moves the year forward one.
Fires: onNextYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Returns: Object - The Heat.js class instance.
moveToCurrentYear( elementId ):
Moves to the current year.
Fires: onSetYear
Parameter: elementId: string - The Heat.js element ID that should be updated.
Returns: Object - The Heat.js class instance.
getYear( elementId ):
Gets the year currently being displayed.
Parameter: elementId: string - The Heat.js element ID.
Returns: Object - The year being displayed (or null).
render( element, options ):
Renders a new map on an element using the options specified.
Parameter: element: Object - The element to convert to a heat map.
Parameter: options: Object - The options to use (refer to "Binding Options" documentation for properties).
Returns: Object - The Heat.js class instance.
renderAll():
Finds all new map elements and renders them.
Returns: Object - The Heat.js class instance.
switchView( elementId, viewName ):
Switches the view on an element to either Map, Chart, or Statistics.
Fires: onViewSwitch
Parameter: elementId: string - The Heat.js element ID.
Parameter: viewName: string - The name of the view to switch to (either "map", "line", "chart", "days", "months", or "color-ranges").
Returns: Object - The Heat.js class instance.
switchType( elementId, type ):
Switches the selected trend type on an element.
Fires: onTypeSwitch
Parameter: elementId: string - The Heat.js element ID.
Parameter: type: string - The name of the type to switch to.
Returns: Object - The Heat.js class instance.
updateBindingOptions( elementId, bindingOptions ):
Updates the original binding options for an element and refreshes it.
Fires: onRefresh
Fires: onBindingOptionsUpdate
Parameter: elementId: string - The Heat.js element ID.
Parameter: bindingOptions: Object - The new binding options to want to apply to the element.
Returns: Object - The Heat.js class instance.
getActiveView( elementId ):
Gets the active view being displayed.
Parameter: elementId: string - The Heat.js element ID.
Returns: Object - The view being displayed.
Destroying
destroy( elementId ):
Reverts an element to its original state (without render attributes).
Fires: onDestroy
Parameter: elementId: string - The Heat.js element ID to destroy.
Returns: Object - The Heat.js class instance.
destroyAll():
Reverts all rendered elements to their original state (without render attributes).
Fires: onDestroy
Returns: Object - The Heat.js class instance.
Configuration
setConfiguration( configurationOptions, [triggerRefresh] ):
Sets the specific configuration options that should be used.
Fires: onRefresh
Parameter: configurationOptions: Object - All the configuration options that should be set (refer to "Configuration Options" documentation for properties).
Parameter: [triggerRefresh]: boolean - States if the UI for each element should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
setLocale( configurationTextOptions, [triggerRefresh] ):
Sets the specific configuration options that should be used.
Fires: onRefresh
Parameter: configurationTextOptions: Object - All the configuration text options that should be set (refer to "Text Options" documentation for properties).
Parameter: [triggerRefresh]: boolean - States if the UI for each element should be refreshed (defaults to true).
Returns: Object - The Heat.js class instance.
Additional Data
getIds():
Returns an array of element IDs that have been rendered.
Returns: string[] - The element IDs that have been rendered.
getVersion():
Returns the version of Heat.js.
Returns: string - The version number.