How do I get apexcharts-card card to round durations?

I have a graph showing some 3D printer timing but it is showing out to ms for the dutation. I really only need hours and minutes. Any way to round this?


all_series_config:
  stroke_width: 2
  float_precision: 0
  show:
    name_in_header: true
    as_duration: hour

I don’t know if the UI element lets you configure that aspect, but you can always create a template sensor to process the underlying raw state and output whatever format you want, which hopefully can then go into the UI element instead of the over-precise raw state.

1 Like

…and you can display a value of a template sensor (in a desired format) on the apex charts card INSTEAD of a “not nice” value by using card-mod and “after/before” pseudoclasses as was described in the main mini-graph-card thread.

as_duration just transforms the number assuming it to be (in this case) hours.
So 3 will become 3 hours and any decimal will add minutes/seconds/milliseconds based on that. If your number/state already has decimals and does represent hours then the only thing you need to do is round that one.
e.g.

transform: return Math.round(x);

I fthis does not work good enough then you need to detail on what the state/number represents…and it might not work … depending

Hi, Were you able to solve this? Looking for the similar stuff…