MCPcopy
hub / github.com/RomRider/apexcharts-card

github.com/RomRider/apexcharts-card @v2.2.3 sqlite

repository ↗ · DeepWiki ↗ · release v2.2.3 ↗
172 symbols 341 edges 17 files 0 documented · 0%
README

License HACS Supported Downloads GitHub Activity Stable Beta Community Forum

ApexCharts Card by @RomRider

Header

This is a highly customizable graph card for Home-Assistant's Lovelace UI.

It is based on ApexCharts.js and offers most of the features of the library.

It is also inspired by the great mini-graph-card by @kalkih

However, some things might be broken :grin:

Table of Content

Installation

HACS (recommended)

This card is available in HACS (Home Assistant Community Store). HACS is a third-party community store and is not included in Home Assistant out of the box.

Manual install

  1. Download and copy apexcharts-card.js from the latest release into your config/www directory.

  2. Add the resource reference as described below.

CLI install

  1. Move into your config/www directory.

  2. Grab apexcharts-card.js:

$ wget https://github.com/RomRider/apexcharts-card/releases/download/v2.2.3/apexcharts-card.js
  1. Add the resource reference as described below.

Add resource reference

If you configure Lovelace via YAML, add a reference to apexcharts-card.js inside your configuration.yaml:

resources:
  - url: /local/apexcharts-card.js?v=2.2.3
    type: module

Else, if you prefer the graphical editor, use the menu to add the resource:

  1. Make sure, advanced mode is enabled in your user profile (click on your user name to get there)
  2. Navigate to Dashboard --> Edit Dashboard --> Manage resources. Click the '+ Add Resource' icon in bottom-right.
  3. Enter URL /local/apexcharts-card.js and select type "JavaScript Module".
  4. Restart Home Assistant.

Data processing steps

This diagram shows how your data goes through all the steps allowed by this card:

data_processing_steps

Using the card

Main Options

:warning: Since this card is in its debut, you should expect breaking changes moving forward. :warning:

The card strictly validates all the options available (but not for the apex_config object). If there is an error in your configuration, it will tell you where and display a red error card.

:white_check_mark: means required.

Name Type Default Since Description
:white_check_mark: type string v1.0.0 custom:apexcharts-card
:white_check_mark: series array v1.0.0 See series
section_mode boolean false v2.2.0 Set to true when the card is used in a section view (sets CSS height to 100%). See Sections Views
config_templates array v1.6.0 Define a configuration once and reuse it multiple times. See config_templates
color_list array v1.6.0 Define the array of colors applied to the series. Will be overridden by each series's color if defined. Useful for config_templates mainly.
all_series_config object v1.6.0 If something is defined here it will apply this config to all the series. It accepts the same options as a series minus entity. It is useful to avoid repetition but the same thing can be achieved in each series individually. See series and all_series_config for an example
chart_type string line v1.4.0 See chart_type
update_interval string v1.1.0 By default the card updates on every state change. Setting this overrides the behaviour. Valid values are any time string, eg: 1h, 12min, 1d, 1h25, 10sec, ...
update_delay string 1500ms v1.4.0 If the chart doesn't display the last state but the one before, you'll want to increase this value, don't go over 10s, it's not necessary. You'll also want to increase this value if you are using attribute in the series. Valid values are any time strings. This is because of how Home-Assistant works with history, see here
graph_span string 24h v1.1.0 The span of the graph as a time interval. Valid values are any time string, eg: 1h, 12min, 1d, 1h25, 10sec, ...
span object v1.2.0 See span
show object v1.0.0 See show
hours_12 boolean v1.8.0 If undefined, it will follow Home-Assistant's user time format. If true, it will force time to be displayed in 12h format. If false it will force the time to be displayed in 24h format.
cache boolean true v1.0.0 Use in-browser data caching to reduce the load on Home Assistant's server
stacked boolean false v1.0.0 Enable if you want the data to be stacked on the graph
layout string v1.0.0 See layouts
header object v1.0.0 See header
now object v1.5.0 See now
~~y_axis_precision~~ ~~number~~ ~~1~~ ~~v1.2.0~~ DEPRECATED since v1.10.0 ~~The float precision used to display numbers on the Y axis. Only works if yaxis is undefined.~~
yaxis array v1.9.0 See yaxis
apex_config object v1.0.0 Apexcharts API 1:1 mapping. You can see all the options here --> Options (Reference) in the Menu. See Apex Charts
experimental object v1.6.0 See experimental
locale string v1.7.0 Default is to inherit from Home-Assistant's user configuration. This overrides it and forces the locale. Eg: en, or fr. Reverts to en if the locale is unknown.
brush object v1.8.0 See brush

series Options

Name Type Default Since Description
:white_check_mark: entity string v1.0.0 The entity_id of the sensor to display
attribute string v1.4.0 Instead of retrieving the state, it will retrieve an attribute of the entity. Make sure you increase update_delay if the chart doesn't reflect the last value of the attribute
name string v1.0.0 Override the name of the entity
stack_group string v2.1.0 When stacked is true, groups the different series with the name stack_group together. Only works for type: column. All series' names need to be be unique because of a bug in apexcharts.js
color string v1.1.0 Color of the serie. Supported formats: yellow, #aabbcc, rgb(128, 128, 128) or var(--css-color-variable)
opacity number 0.7 for area

else 1 | v1.6.0 | The opacity of the line or filled area, between 0 and 1 | | stroke_width | number | 5 | v1.6.0 | Change the width of the line. Only works for area and line | | stroke_dash | number or array | 0 | v2.1.0 | Creates a dashed line. The higher the number, the bigger the dash. An array can be used to specify more complex patterns. | | type | string | line | v1.0.0 | line, area or column are supported for now | | curve | string | smooth | v1.0.0 | smooth (nice curve), straight (direct line between points) or stepline (flat line until next point then straight up or down), monotoneCubic (create a monotone cubic spline) | | ~~extend_to_end~~ | ~~boolean~~ | ~~true~~ | ~~v1.0.0~~ | DEPRECATED since v2.0.0 ~~If the last data is older than the end time displayed on the graph, setting to true will extend the value until the end of the timeline. Only works for line and area types.~~ | | extend_to | boolean or string | end | v2.0.0 | If the value is end, it will extend the line/area to the end of the chart. With now, it will extend it to the current time (usefull for chart showing current and future data). If false it will not do anything. Only available for line and area types. | | unit | string | | v1.0.0 | Override the unit of the sensor | | float_precision | number | 1 | v1.2.0 | The precision used to display data in the legend and the tooltip. It doesn't impact how the data is displayed on the graph | | fill_raw | string | 'null' | v1.5.0 | If there is any missing value in the history, last will replace them with the last non-empty state, zero will fill missing values with 0, 'null' will fill missing values with null. This is applied before group_by options | | group_by | object | | v1.0.0 | See group_by | | invert | boolean | false | v1.2.0 | Negates the data (1 -> -1). Useful to display opposite values like network in (standard)/out (inverted) | | transform | string | | v1.5.0 | Transform your raw data in any way you like. See transform | | data_generator | string | | v1.2.0 | See data_generator | | statistics | object | | v2.0.0 | Use HA statistical data (long-term). See statistics | | offset | string | | v1.3.0 | This is different from the main offset parameter. This is at the series level. It is only useful if you want to display data from for eg. yesterday on top of the data from today for the same sensor and compare the data. The time displayed in the tooltip will be wrong as will the x-axis information. Valid values are any negative time string, eg: -1h, -12min, -1d, -1h25, -10sec, ... month (365.25 days / 12) and year (365.25 days) as unit will generate an inconsistent result, you should use days instead. | | time_delta | string | | v2.0.0 | This applies a time delta to all the data points of your chart after fetching them. You can cumulate it with offset. Valid values are any time strings starting with + or -, eg: -30min, +2h, -2d, ... | | min | number | 0 | v1.4.0 | Only used when chart_type = radialBar, see chart_type. Used to convert the value into a percentage. Minimum value of the sensor | | max | number | 100 | v1.4.0 | Only used when chart_type = radialBar, see chart_type. Used to convert the value into a percentage. Maximum value of the sensor | | color_threshold | object | | v1.6.0 | See experimental | | yaxis_id | string | | v1.9.0 | The identification name of the y-axis to which this series should be associated. See yaxis | | `

Extension points exported contracts — how you extend this code

ActionHandler (Interface)
(no doc) [1 implementers]
src/action-handler-directive.ts
ChartCardExternalConfig (Interface)
(no doc)
src/types-config.ts
HASSDomEvents (Interface)
(no doc)
src/fire-event.ts
OverrideFrontendLocaleData (Interface)
(no doc)
src/types-ha.ts
ChartCardConfig (Interface)
(no doc)
src/types.ts
ActionHandlerElement (Interface)
(no doc)
src/action-handler-directive.ts
ChartCardBrushExtConfig (Interface)
(no doc)
src/types-config.ts
HASSDomEvent (Interface)
(no doc)
src/fire-event.ts

Core symbols most depended-on inside this repo

computeColor
called by 13
src/utils.ts
myFormatNumber
called by 9
src/utils.ts
isObject
called by 8
src/utils.ts
mergeDeep
called by 6
src/utils.ts
validateInterval
called by 6
src/utils.ts
computeName
called by 5
src/utils.ts
is12Hour
called by 4
src/utils.ts
fireEvent
called by 4
src/fire-event.ts

Shape

Function 82
Method 39
Interface 38
Class 7
Enum 6

Languages

TypeScript100%

Modules by API surface

src/graphEntry.ts34 symbols
src/utils.ts28 symbols
src/apexcharts-card.ts28 symbols
src/types-config.ts21 symbols
src/apex-layouts.ts21 symbols
src/action-handler-directive.ts16 symbols
src/types.ts12 symbols
src/types-ha.ts6 symbols
src/fire-event.ts3 symbols
src/locales.ts2 symbols
src/deep-equal.ts1 symbols

Dependencies from manifests, versioned

@babel/core7.24.7 · 1×
@babel/preset-env7.24.7 · 1×
@babel/preset-typescript7.24.7 · 1×
@ctrl/tinycolor3.6.1 · 1×
@material/mwc-ripple0.25.3 · 1×
@rollup/plugin-babel5.3.1 · 1×
@rollup/plugin-commonjs21.1.0 · 1×
@rollup/plugin-json4.1.0 · 1×
@rollup/plugin-node-resolve13.3.0 · 1×
@semantic-release/changelog6.0.3 · 1×
@semantic-release/commit-analyzer13.0.1 · 1×
@semantic-release/exec7.1.0 · 1×

For agents

$ claude mcp add apexcharts-card \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact