ApexCharts card - A highly customizable graph card

You can use the new formatter function:

apex_config:
  yaxis:
    labels:
      formatter: |
        EVAL:function (val) {
          return val * 1000;
        }

I’m no javascript man, so this is somewhat of a guess, but should work

You can use transform to change your “units”.
Like transform: return x * 1000;

The solution from @DonNL will only modify the yaxis numbers. This solution will also modify the values in the chart, so choose the one which suits you :slight_smile:

thx to ROmRider and DonNL,

works like a charm

Regards
Herbert

1 Like

Much better… I know which I would pick… :joy:

Hi there, I am struggling a bit with formatting my graph properly. What I’m trying to build is a graph that displays the two-hourly average of my sensors, but also the latest measured value. This is what I got so far:

type: 'custom:apexcharts-card'
layout: minimal
graph_span: 24h
update_interval: 1min
apex_config:
  legend:
    show: false
header:
  show: true
  title: Temperature
  show_states: true
  colorize_states: true
all_series_config:
  stroke_width: 2
  opacity: 0.2
  type: area
  curve: smooth
  group_by:
    func: avg
    duration: 120min
series:
  - entity: sensor.broadlink_temperature
    name: Living room
  - entity: sensor.bedroom_temperature
    name: Bedroom
  - entity: sensor.study_temperature_2
    name: Study

I like the general appearance but it’d be great if header could display the latest values (instead of the last two-hourly average). Also the graph should end with the lastest actual measurements and not with an average. Any suggestions how to achieve this? Thanks.

Hi all,


I’m trying to insert double Yaxis (see right chart) (left watt, right temperature).
But when I insert in the code yaxis_id the chart shows the bar with the wrong heigth.
The correct bars heigh is shown in the left chart…

type: custom:apexcharts-card
graph_span: 7d
cache: true
update_interval: 1hour
header:
  title: Assorbimento
  show: true
  show_states: true
  colorize_states: true
series:
  - entity: sensor.mqttpower
    yaxis_id: w
    type: column
    name: Mid
    group_by:
      func: avg
      duration: 1d
  - entity: sensor.mqttpower
    yaxis_id: w
    type: column
    name: Max
    group_by:
      func: max
      duration: 1d
  - entity: sensor.mqttpower
    yaxis_id: w
    type: column
    name: Min
    group_by:
      func: min
      duration: 1d
  - entity: sensor.temp_ext_temp
    yaxis_id: t
    type: line
    name: Esterna
    group_by:
      func: avg
      duration: 1d
    color: green
apex_config:
  yaxis:
    - id: t
      opposite: true
      forceNiceScale: false
      decimalsInFloat: 0
    - id: w
      forceNiceScale: false
      decimalsInFloat: 0
  xaxis:
    labels:
      format: dd
      show: true
      showAlways: true
  chart:
    type: area
    height: 300
  stroke:
    show: true
    width: 1
  legend:
    show: false
  dataLabels:
    enabled: false
    distributed: true
  fill:
    type: gradient
    gradient:
      shadeIntensity: 0.1
      opacityFrom: 0.25
      opacityTo: 1
      inverseColors: true
      stops:
        - 0
        - 90
        - 100

What am I wrong?

yaxis needs to sit under the main config section, not under apex_config and then it will work :slight_smile:

1 Like

Possible with: in_header: raw in the serie’s show settings.

That’s not very logical for a chart.

Hi. I have two qustions.

  1. How do i get “preview” from both sensors. The temperature is ok, but not the gravity.
  2. And how do i get more decimals in the state in the bottom. The Fermentation Gravity must have 3 decimals .

I am not able to see the values at the end of the column chart. Any issue in my config?

type: custom:apexcharts-card
apex_config:
  stroke:
    show: true
    width: 1
    curve: smooth
  legend:
    show: true
  dataLabels:
    enabled: true
graph_span: 24h
header:
  show: true
  title: Today's Energy Usage
  standard_format: true
series:
  - entity: sensor.daily_energy_usage
    type: column
    name: Power Usage
    group_by:
      func: avg
      duration: 2h

image

For that to happen data points needs to be aligned, so you need to use group_by and set the same duration for both series.

float_precision: 3

What do you mean by “see the values at the end of the column chart”?

image
@RomRider like the above image.

1 Like

Datalabels is an option available in the card configuration thus overriding what you have in apex_config

series:
  - entity: sensor.daily_energy_usage
    type: column
    name: Power Usage
    group_by:
      func: avg
      duration: 2h
    show:
      datalabels: true
1 Like

Wow! Absolutely amazing plugin!!!

One question, how do I remove this bottom label when hovering?

image

I really love the ApexCharts card. Amazing job!

I hope it will be integrated soon as an “official” Lovelace element.

2 Likes

Try

tooltip:
  enabled: false

Here you go:

apex_config:
  xaxis:
    tooltip:
      enabled: false
2 Likes

I don’t think that is ever going to happen :blush:
But don’t worry, for now, I have no plan to stop maintaining it and adding new features

5 Likes

I hope it is, it’s insanely superior to ChartJS which is used by Lovelace now.
It’s much more touch friendly.
And it also looks much nicer.

That did the trick, thank you!