Apex Charts - rounding Numbers?!

hey

im playing a little with the Apex Charts but need some help.
The Output is sometimes a high floating number… So I need to round them by 2 - but how?^^

type: custom:apexcharts-card
chart_type: donut
apex_config:
  plotOptions:
    pie:
      donut:
        background: transparent
        labels:
          show: true
          total:
            show: lafeslaftrue
header:
  show: true
  title: Hausverbrauch
  show_states: true
  colorize_states: true
series:
  - entity: sensor.openwb_daily_yield_house
    name: Remaining
    transform: >-
      return parseFloat(x) -
      parseFloat(hass.states['sensor.stecker5_energy_today'].state) -
      parseFloat(hass.states['sensor.usb2_energy_today'].state) -
      parseFloat(hass.states['sensor.usb3_energy_today'].state) -
      parseFloat(hass.states['sensor.stecker7_energy_today'].state) -
      parseFloat(hass.states['sensor.tasmota_server_energy_today'].state) -
      parseFloat(hass.states['sensor.stecker1_energy_today'].state)
  - entity: sensor.stecker5_energy_today
    name: Waschmaschiene
  - entity: sensor.usb2_energy_today
    name: Spühlmaschiene
  - entity: sensor.usb3_energy_today
    name: TV Manu
  - entity: sensor.stecker7_energy_today
    name: TV Wohnzimmer
  - entity: sensor.tasmota_server_energy_today
    name: Server
  - entity: sensor.stecker1_energy_today
    name: Trockner

Check their github pages, there a rea few examples
Can I have only integer values in Y - axis when actual values may be non-integer? · Issue #1047 · apexcharts/apexcharts.js (github.com)

1 Like

There’s post here that does just that I think:

EDIT: confirmed it works to round the centre value

1 Like