ApexCharts card - A highly customizable graph card

Howdy team!

I’ve got a graph card that I would really love to add the current value to the leading edge / ‘now’ for each entity / line.

Any ideas how how / if this can be achieved? I’ve had a bit of a play around with apex_config options but haven’t had much luck unfortunately.

Any pointers in the right direction would be greatly appreciated!

I just saw the experimental brush feature and am quite fond of it.

Can anybody tell me if there is a trick to formatting the y-axis?

As you can see, the y-axis range is defined by the entity with the highest values (in this case the yellow peaks in the bottom graph).
But the blue line has a max of 129 W but is shown in the range of > 2000 W.

Any ideas?

I´m no expert - but it works for me - using the code, where “yaxis” is above “apex_config” and this above “forceNiceScale”

that “min” is not possible - when logarithmic is enabled - seems like a bug, cause other chart programs (as grafana) are working good here… but I coud help myself with two yaxis maybe…

Has anyone been able to sort their data series?

On this chart of environmental sensor batteries…

…I would like to be able to sort by lowest to highest battery level, but cannot find a configuration parameter on the apexcharts radial bar site.

You could maybe add the entities using templating and use that to “create” the list of entities in the order of state.

I am trying to get a total in a donut chart of three values added together in my donut-diagram, so 1822 (W) in my case

According to apexcharts this is done by setting lables to true, it never did the trick for me.

type: custom:apexcharts-card
chart_type: donut
header:
  show: true
  show_states: true
  colorize_states: true
  title: Current PV
series:
  - entity: sensor.balcony_solar_power
    name: Balcony
    type: column
    color: lightgreen
    float_precision: 0
  - entity: sensor.deye_12k_pv1_power
    name: Garage
    type: column
    color: orange
  - entity: sensor.deye_12k_pv2_power
    name: West roof
    type: column
    color: lightblue

Having issues with data generator…

Here’s the sensor data - “sensor.solcast_pv_forecast_forecast_today”:

Attributes:
DetailedForecast
period_start: ‘2023-09-18T00:00:00+10:00’
pv_estimate: 0
pv_estimate10: 0
pv_estimate90: 0
period_start: ‘2023-09-18T00:30:00+10:00’
pv_estimate: 0
pv_estimate10: 0
pv_estimate90: 0

(there’s zeros for values there, but the data has actual numbers/floats later on in the series)

Here’s the data generator section:

data_generator: |
return entity.attributes.detailedforecast.map((entry) => {
return [new Date(entry.period_start), entry.pv_estimate];
});

And here’s what i’m seeing - no graph lines - but data in the headers:
Chart

DetailedForecast …caps

I have the same question / issue with the now line shifted to the right. Any idea?

This is what I use to get a total in the centre:

Its the section in plotOptions that does it

  - type: custom:apexcharts-card
    chart_type: donut
    update_interval: 3s
    header:
      show: false
      show_states: false
    apex_config:
      chart:
        height: 405px
      stroke:
        width: 1
      legend:
        show: false
      dataLabels:
        enabled: true
        style:
          fontSize: 10px
        dropShadow:
          enabled: false
        formatter: >
          EVAL: function (value, opt) {
              return opt.w.config.labels[opt.seriesIndex] + ": " + opt.w.config.series[opt.seriesIndex].toFixed(0) + " " + " W" ;
            }
      plotOptions:
        pie:
          donut:
            size: "40%"
            dataLabels:
              minAngleToShowLabel: 0.5
            labels:
              show: true
              total:
                show: true
                label: Total
                formatter: |
                  EVAL:function(w) {
                    return w.globals.seriesTotals.reduce((a, b) => {return (a + b)} , 0).toFixed(0) + " W"
                    }

1 Like

@Holdestmade any idea how to link the center-value to an existing entity to show history/stats?

Not sure what you mean ?

I’ve got something bizarre. I just put moved three graphs into a grid. Making a layout for my phone. All looks great, but the graphs on my laptop and the graphs on my phone show different durations of data. My laptop shows about the past two weeks worth of data while my phone shows the past month and a half. They are both running against the same lovelace file. Right? The phone is using the HA ios app. The laptop is running chrome. I just created the dashboard tonight so it shouldn’t be old data. Any ideas???

actually needed to be: “detailedForecast”
Caps didnt match attributes for some odd reason :confused:

Would it be possible to show only hours in the bottom axle? As 01, 02, 03, … instead of 01:00, 02:00, 03:00, …

Sorry, found it by RTM:

apex_config:
  xaxis:
    labels:
      format: HH

This did the trick, thank you!
For completeness

type: custom:apexcharts-card
chart_type: donut
header:
  show: true
  show_states: true
  colorize_states: true
  title: Current PV
apex_config:
  plotOptions:
    pie:
      donut:
        size: 60%
        labels:
          show: true
          total:
            show: true
            label: Total W
            formatter: |
              EVAL:function(w) {
                return w.globals.seriesTotals.reduce((a, b) => {return (a + b)} , 0).toFixed(0) + " W"
                }
series:
  - entity: sensor.balcony_solar_power
    name: Balcony
    type: column
    color: lightgreen
    float_precision: 0
  - entity: sensor.deye_12k_pv1_power
    name: Garage
    type: column
    color: orange
    float_precision: 0
  - entity: sensor.deye_12k_pv2_power
    name: West roof
    type: column
    color: lightblue
    float_precision: 0

Screenshot 2023-09-22 at 12.15.42

Hi all,
I’m trying to replicate the statistics change function from the Statistics graph Card.
I’ve installed the apexchart beta version via HACS (v2.0.4-dev.1).

In the beta documentation its described as:

statistics:
  type: min, max, mean, sum, state, or change
  period 5minute, hour, day or month
  align: start, end or middle

Unfortunately after installing it i get the error message below:

As of right now i’ve found no information about statistics change function in this thread.
Every input is much appreciated. :hugs:

type: custom:apexcharts-card
graph_span: 1week
locale: de
stacked: true
all_series_config:
  type: column
  statistics:
    type: change
    period: day
    align: middle
  show:
    datalabels: true
apex_config:
  chart:
    stacked: true
  dataLabels:
    enabled: true
    background:
      enabled: false
    style:
      colors:
        - white
    dropShadow:
      enabled: true
      left: 2
      blur: 1
      color: black
  plotOptions:
    bar:
      borderRadius: 5
      horizontal: false
      rangeBarOverlap: true
      dataLabels:
        position: center
  grid:
    show: false
  tooltip:
    enabled: false
  legend:
    show: false
  xaxis:
    labels:
      datetimeFormatter:
        day: ddd
    axisBorder:
      show: false
    axisTicks:
      show: false
    tooltip:
      enabled: false
  yaxis:
    show: false
series:
  - entity: sensor.flur_verbrauch_total_active_energy
    name: Verbaucht gesamt
  - entity: sensor.flur_verbrauch_phase_a_total_active_energy
    name: Verbaucht a
  - entity: sensor.flur_verbrauch_phase_b_total_active_energy
    name: Verbaucht b
  - entity: sensor.flur_verbrauch_phase_c_total_active_energy
    name: Verbaucht c

Hi Martijn ,

facing the same issue , may I ask to which sensor you switched ?

thx Dennis

204dev1 is prior to 204 as I read it, where did you find the doc on the ‘change’?

Do you ask where i found the Documentation for v2.0.4-dev.1?

If so: