RomRider / apexcharts-card

📈 A Lovelace card to display advanced graphs and charts based on ApexChartsJS for Home Assistant
MIT License
1.21k stars 84 forks source link

Decimals option not working for Y-axis #570

Closed jovana closed 1 year ago

jovana commented 1 year ago

Checklist

Describe the bug If set the decimals option below yaxis it is ignored. My data has almost always 4 decimals. Also tried the decimalsInFloat option. Below an image where in the red boxes the problem.

Scherm­afbeelding 2023-06-08 om 18 19 09

Version of the card Version: 2.0.4

To Reproduce This is the configuration I used:

type: custom:apexcharts-card
apex_config:
  chart:
    height: 600px
header:
  show: true
  title: Tibber El-pris
  show_states: true
  colorize_states: true
now:
  show: true
  color: white
  label: NU
hours_12: false
graph_span: 48h
span:
  start: day
yaxis:
  - id: kW
    decimals: 3
    opposite: true
    apex_config:
      tickAmount: 6
      decimalsInFloat: 3
  - id: EUR
series:
  - entity: sensor.tibber_price_list
    stroke_width: 2
    float_precision: 3
    color: blue
    curve: stepline
    show:
      legend_value: false
      extremas: true
      in_header: false
    extend_to: now
    yaxis_id: EUR
    name: Elpriset
    data_generator: |
      var a = entity.attributes.today.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      }); 
      var b = entity.attributes.tomorrow.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      });
      return a.concat(b);
  - entity: sensor.electricity_price_XXXXXX_95
    extend_to: now
    float_precision: 3
    show:
      legend_value: false
      extremas: true
    curve: stepline
    color: '#ffa500'
    stroke_width: 5
    yaxis_id: EUR
    name: Pris nu
  - entity: sensor.tibber_price_list
    stroke_width: 2
    float_precision: 3
    show:
      legend_value: false
      extremas: true
    data_generator: |
      var a = entity.attributes.today.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      }); 
      var b= entity.attributes.tomorrow.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      });
      return a.concat(b);
    curve: smooth
    attribute: min_price
    name: Minsta pris
    color: green
    yaxis_id: EUR
    type: line
    group_by:
      duration: 48h
      func: min
  - entity: sensor.tibber_price_list
    stroke_width: 2
    float_precision: 3
    show:
      legend_value: false
      extremas: true
    data_generator: |
      var a = entity.attributes.today.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      }); 
      var b= entity.attributes.tomorrow.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      });
      return a.concat(b);
    curve: smooth
    attribute: avg_price
    name: Medel pris
    color: violet
    yaxis_id: EUR
    type: line
    group_by:
      duration: 48h
      func: avg
  - entity: sensor.tibber_price_list
    stroke_width: 2
    float_precision: 3
    show:
      legend_value: false
      extremas: true
    data_generator: |
      var a = entity.attributes.today.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      }); 
      var b= entity.attributes.tomorrow.map((entry) => {
        return [new Date(entry.startsAt), entry.total];
      });
      return a.concat(b);
    curve: smooth
    attribute: max_price
    name: Max pris
    color: red
    yaxis_id: EUR
    type: line
    group_by:
      duration: 48h
      func: max

Expected behavior Now al the prices are shown like 0.3, but I would like to show like 0,287 or 0,253

Desktop (please complete the following information):

Smartphone (please complete the following information): Not tested.

Data set This is an image of the data set I'm using to draw the chart.

Scherm­afbeelding 2023-06-07 om 23 17 35

thx!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 10 days with no activity.