Apexcharts reporting bar chart: a puzzle?

Hi,
herewith a simple and “basic” report:
Daily consumption of a Meross Plug on bar chart based on current Month
Value in header: Today and Total month
series of Total month i adopt in_chart: False in_header: true
today is 2March so 2 days to show values, i got 3 : one bar is the total Month
I seen also there is a rendering on grapghic if i put False or True value on in_chart
what’s wrong in this configuration:

type: custom:apexcharts-card
graph_span: 1month
span:
  start: month
header:
  show: true
  show_states: true
  colorize_states: true
  title: Daily Consumption TV
series:
  - entity: sensor.plug_tv_energy
    float_precision: 3
    name: Today
    type: column
    color: orange
    statistics:
      type: state
      period: day
    group_by:
      duration: 1d
      func: max
    show:
      in_header: true
  - entity: sensor.plug_tv_energy
    name: Total Month
    float_precision: 3
    statistics:
      type: state
      period: day
    group_by:
      duration: 1month
      func: sum
    show:
      in_chart: false
      in_header: true

![apexcharts|615x480](upload://kTJYVILvedJjJfS9M70T51ubi4W.jpeg)

thanks for support

From what I understand, the extra bar may come from mixing different group_by durations on the same entity within the same graph_span. Your first series groups by 1d, while the second groups by 1month. Even with in_chart: false, the monthly aggregation can still influence how ApexCharts processes the dataset for the current span.

Since today is March 2, grouping by 1month may create a full-month bucket that appears as an additional value during rendering.

You could try removing group_by from the monthly series and instead calculate the monthly total using a separate utility meter sensor. That way, the chart only handles daily data, and the header displays the monthly total independently.

This usually keeps the visual output consistent and avoids unexpected bars.

Hi,
i get your point
ket’s try to remove Total month series: nothing change
I got always an extra bar unbelieveable, the first highest other 2 are correct

type: custom:apexcharts-card
graph_span: 1month
span:
  start: month
header:
  show: true
  show_states: true
  colorize_states: true
  title: Daily Consumption TV
series:
  - entity: sensor.plug_tv_energy
    float_precision: 3
    name: Today
    type: column
    color: orange
    statistics:
      type: state
      period: day
    group_by:
      duration: 1d
      func: max
    show:
      in_header: true

![apexcharts|580x462](upload://q3ZpUwxIHSGxDyKdz3fV9GMnCcs.jpeg)




Hi,

The extra high first bar is not caused by the span anymore.

You’re currently using:

group_by:
  duration: 1d
  func: max

If sensor.plug_tv_energy is a cumulative energy sensor (which increases continuously), max returns the total meter value for each day, not the daily consumption.

That means the first bar of the month represents the full accumulated value at the first recorded sample inside the span, which is why it appears much higher than the others.

To get real daily consumption, you should either:

Option 1 (recommended):

statistics:
  type: sum
  period: day

and remove group_by entirely.

group_by:
  duration: 1d
  func: diff

This will calculate the daily delta instead of plotting the absolute meter value.

That should remove the “unbelievable” first bar :slightly_smiling_face:

Hi,
your explanation from logical view is crystal, fully agree ( I thinking in same way so I’m not so crazy :rofl:)

I forgot to say ( excuse me) : sensor is Dauly Cycle with rest at midnight
func: max should be the right for this purpose

On other hands just to enlarge, i discovered this add thse rows into yaml
chart:
type: bar
toolbar:
show: true

with this one we are able to retrieve a csv file with the value column

category,Today
Sat Feb 28 2026,0.732
Sun Mar 01 2026,0.566
Mon Mar 02 2026,0.46
Tue Mar 03 2026,0.244

now seen that ,I'm fully puzzled (or again crazy) how works this reporting
why 28/02 ?

I tried to implement a offset, with +91min
the extra bar 28/02 disappear
doesm't make sense from my perspective