Skip to content

Styling ​

Charts use your theme's colours and fonts without any style at all, so everything on this page is optional. Colours accept every format in Colours: var(--lcars-*), theme: tokens, hex and rgba.

For per-series colours and line styles, the series options (color, stroke_width, curve, ...) are usually simpler than the lists below.


Reference lines ​

Horizontal lines at fixed values:

yaml
type: custom:lcards-chart
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
style:
  zero_line: true
  thresholds:
    - value: 18
      label: Warm
      color: var(--lcars-red)
    - value: 8
      label: Cold
      color: var(--lcars-blue)
      dash: true
OptionWhat it does
style.zero_lineDraw a line at 0
style.zero_line_colorIts colour
style.thresholdsA list of lines, each with the options below
Threshold optionWhat it does
valueWhere the line goes (required)
labelText on the line
colorLine colour
widthLine width (default 2)
dashDashed line
opacityLine opacity (default 0.7)

Colours ​

FieldTypeDescription
style.colors.serieslistSeries colours, used in order
style.colors.strokelistLine/outline colours
style.colors.filllistArea fill colours
style.colors.backgroundstringChart background
style.colors.foregroundstringDefault text and label colour
style.colors.gridstringGrid line colour
style.colors.marker.filllistPoint fill colours (default: the series colours)
style.colors.marker.strokelistPoint outline colours
style.colors.axis.xstringX-axis label colour
style.colors.axis.ystringY-axis label colour
style.colors.axis.borderstringAxis line colour
style.colors.axis.ticksstringTick mark colour
style.colors.legend.defaultstringLegend text colour
style.colors.legend.itemslistPer-series legend colours
style.colors.data_labelslistValue label colours
yaml
type: custom:lcards-chart
chart_type: area
sources:
  - entity: sensor.kitchen_temperature
    name: Kitchen
  - entity: sensor.bedroom_temperature
    name: Bedroom
style:
  colors:
    series:
      - "var(--lcars-yellow)"
      - "var(--lcars-violet)"
    grid: "var(--lcars-gray)"
  fill:
    type: gradient
    gradient:
      opacityFrom: 0.5
      opacityTo: 0.05
  legend:
    show: true

Lines and fills ​

style.stroke ​

FieldTypeDefaultDescription
style.stroke.widthnumber2Line width in px
style.stroke.curvestringsmoothsmooth, straight, stepline, monotoneCubic
style.stroke.dash_arraynumber0Dash length; 0 is solid

style.fill ​

FieldTypeDefaultDescription
style.fill.typestringsolidsolid, gradient, pattern, image
style.fill.opacitynumber0.7Fill opacity
style.fill.gradient.shadestring-light or dark
style.fill.gradient.typestring-horizontal, vertical, diagonal1, diagonal2
style.fill.gradient.shadeIntensitynumber-Shade intensity
style.fill.gradient.opacityFromnumber-Opacity where the gradient starts
style.fill.gradient.opacityTonumber-Opacity where the gradient ends
yaml
type: custom:lcards-chart
graph_span: 12h
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
style:
  stroke:
    width: 3
    dash_array: 8
    curve: straight

style.markers ​

Points drawn on each value.

FieldTypeDefaultDescription
style.markers.sizenumber0Point size in px; 0 hides them
style.markers.shapestringcirclecircle, square, rect, diamond, triangle, star, cross, plus
style.markers.stroke.widthnumber2Point outline width in px
yaml
type: custom:lcards-chart
graph_span: 12h
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
    group_by:
      func: avg
      duration: 1h
style:
  markers:
    size: 6
    shape: diamond
    stroke:
      width: 1

Grid, legend and labels ​

style.grid ​

FieldTypeDefaultDescription
style.grid.showbooleantrueShow grid lines
style.grid.stroke_dash_arraynumber4Grid line dash length
style.grid.row_colorslist-Alternating row background colours
style.grid.column_colorslist-Alternating column background colours
yaml
type: custom:lcards-chart
chart_type: column
sources:
  - entity: sensor.house_power
    name: Power
    group_by:
      func: avg
      duration: 2h
style:
  grid:
    stroke_dash_array: 0
    row_colors:
      - "rgba(255, 153, 0, 0.08)"
      - "transparent"

style.legend ​

FieldTypeDefaultDescription
style.legend.showbooleanfalseShow the legend
style.legend.positionstringbottomtop, bottom, left, right
style.legend.horizontalAlignstringcenterleft, center, right
style.legend.font_sizenumberfont size + 2Legend font size in px
yaml
type: custom:lcards-chart
sources:
  - entity: sensor.kitchen_temperature
    name: Kitchen
  - entity: sensor.bedroom_temperature
    name: Bedroom
  - entity: sensor.office_temperature
    name: Office
style:
  legend:
    show: true
    position: right
    font_size: 13

style.data_labels ​

Values written on the chart.

FieldTypeDefaultDescription
style.data_labels.showbooleanfalseShow value labels
style.data_labels.offsetYnumber0Vertical offset in px
style.data_labels.font_sizenumberfont sizeLabel font size in px
yaml
type: custom:lcards-chart
chart_type: column
graph_span: 7d
sources:
  - entity: sensor.outdoor_temperature
    name: Daily high
    statistics:
      type: max
      period: day
style:
  data_labels:
    show: true
    font_size: 11
  yaxis:
    decimals: 0

style.xaxis and style.yaxis ​

FieldTypeDefaultDescription
style.xaxis.labels.showbooleantrueShow X-axis labels
style.xaxis.labels.rotatenumber0Label rotation in degrees (category axes only; time axes don't rotate)
style.xaxis.border.showbooleanfalseShow the X-axis line
style.xaxis.ticks.showbooleanfalseShow X-axis tick marks
style.yaxis.labels.showbooleantrueShow Y-axis labels
style.yaxis.decimalsnumber-Decimal places for labels, tooltips and value labels
style.yaxis.border.showbooleanfalseShow the Y-axis line
style.yaxis.ticks.showbooleanfalseShow Y-axis tick marks

The X axis shows time by default. Set xaxis_type: category or xaxis_type: numeric at the top level for other kinds of X values. For several Y axes, use yaxis.

yaml
type: custom:lcards-chart
graph_span: 48h
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
style:
  xaxis:
    border:
      show: true
    ticks:
      show: true
  yaxis:
    decimals: 1
    border:
      show: true

style.display ​

FieldTypeDefaultDescription
style.display.toolbarbooleanfalseShow the zoom/download toolbar
style.display.tooltip.showbooleantrueShow the hover tooltip
style.display.tooltip.themestringdarkdark or light
yaml
type: custom:lcards-chart
graph_span: 6h
sources:
  - entity: sensor.house_power
    name: Power
style:
  display:
    toolbar: true
    tooltip:
      theme: light

style.typography ​

FieldTypeDefaultDescription
style.typography.font_familystringyour theme's fontFont for all chart text
style.typography.font_sizenumber12Base font size in px
yaml
type: custom:lcards-chart
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
style:
  typography:
    font_size: 16

style.theme ​

ApexCharts' own palette options. Explicit colours take priority.

FieldTypeDefaultDescription
style.theme.modestringdarkdark or light
style.theme.palettestring-ApexCharts palette (palette1 to palette10)
style.theme.monochrome.enabledbooleanfalseShades of a single colour
style.theme.monochrome.colorstring-The base colour
style.theme.monochrome.shade_tostringdarkdark or light
style.theme.monochrome.shade_intensitynumber0.65How far the shades spread
yaml
type: custom:lcards-chart
chart_type: donut
sources:
  - entity: sensor.kitchen_power
    name: Kitchen
  - entity: sensor.office_power
    name: Office
  - entity: sensor.garage_power
    name: Garage
  - entity: sensor.laundry_power
    name: Laundry
style:
  theme:
    monochrome:
      enabled: true
      color: "#ff9900"
      shade_to: dark
  legend:
    show: true

Chart-type options ​

FieldChart typeDefaultDescription
style.gauge_start_angleradialBar-90Where the gauge arc starts, in degrees
style.gauge_end_angleradialBar90Where it ends
style.gauge_totalradialBarfalseShow the sum of all gauges in the centre
style.value_formatradialBar-percent adds a % sign to the values
style.group_rowsrangeBartruePut bars with the same label on one row
style.show_labelsrangeBartrueShow labels on the bars
yaml
type: custom:lcards-chart
chart_type: radialBar
sources:
  - entity: sensor.phone_battery
    name: Phone
  - entity: sensor.tablet_battery
    name: Tablet
style:
  gauge_start_angle: -135
  gauge_end_angle: 135
  value_format: percent
  legend:
    show: true

Formatters ​

Format strings for axis labels and tooltips. These use a small chart-only syntax; they are not LCARdS templates.

FieldExamples
style.formatters.xaxis_labelHH:mm · MMM DD · ddd HH:mm
style.formatters.yaxis_label{value}°C · {value}%
style.formatters.tooltip{seriesName}: {y} · {x|MMM DD HH:mm}: {y}°C
  • Dates: YYYY, YY, MMMM (October), MMM (Oct), MM, M, dddd (Tuesday), ddd (Tue), DD, D, HH, H, hh, h, mm, m, ss, s, A (PM), a (pm). Put literal text in square brackets: [at] HH:mm.
  • Values: {value} in axis labels; {y}, {x}, {x|format} and {seriesName} in tooltips.

Units and decimal places usually need no formatter: set unit and float_precision on the series.

yaml
type: custom:lcards-chart
sources:
  - entity: sensor.outdoor_temperature
    name: Outside
style:
  formatters:
    xaxis_label: "ddd HH:mm"
    yaxis_label: "{value}°"
    tooltip: "{x|ddd [at] HH:mm}: {y}°C"

Animation ​

yaml
style:
  animation:
    preset: lcars_standard

The chart below uses lcars_dramatic; reload the page to see it again.

yaml
type: custom:lcards-chart
chart_type: column
sources:
  - entity: sensor.house_power
    name: Power
    group_by:
      func: avg
      duration: 1h
style:
  animation:
    preset: lcars_dramatic
PresetDescription
lcars_standardSmooth entrance (the default feel)
lcars_dramaticSlower, more theatrical entrance
lcars_minimalQuick, subtle entrance
lcars_realtimeNo entrance animation; quick updates for live data
lcars_alertFast entrance for alert displays
noneNo animation

Raw ApexCharts options ​

style.chart_options passes options straight to ApexCharts and overrides everything above. Use it only for things LCARdS doesn't cover: see the ApexCharts options reference.

yaml
type: custom:lcards-chart
chart_type: column
sources:
  - entity: sensor.house_power
    name: Power
    group_by:
      func: avg
      duration: 2h
style:
  chart_options:
    plotOptions:
      bar:
        borderRadius: 6
        columnWidth: "60%"

Only plain values work here; ApexCharts options that expect JavaScript functions can't be written in YAML.


A complete example ​

yaml
type: custom:lcards-chart
chart_type: area
graph_span: 24h

sources:
  - datasource: living_room
    buffer: smoothed
    name: Temperature
    unit: °C
    float_precision: 1
  - entity: sensor.living_room_humidity
    name: Humidity
    yaxis_id: humidity
    type: line

data_sources:
  living_room:
    entity: sensor.living_room_temperature
    history:
      hours: 24
    processing:
      smoothed:
        type: smooth
        method: exponential
        alpha: 0.2

yaxis:
  - id: temperature
  - id: humidity
    opposite: true
    min: 0
    max: 100

style:
  colors:
    series:
      - "var(--lcars-orange)"
      - "var(--lcars-blue)"
  fill:
    type: gradient
    gradient:
      opacityFrom: 0.5
      opacityTo: 0.05
  legend:
    show: true
  thresholds:
    - value: 22
      label: Warm
      color: var(--lcars-red)
  animation:
    preset: lcars_standard