ApexCharts card - A highly customizable graph card

title:
text: ‘I have not read the documentation in a long time !!’

I never knew you could have text along the y-axis! :slight_smile:

Eventually I found the solution in the decimalsInFloat: 2 command. The documentation does show the y_axis_precision command is deprecated.

apex_config:
  yaxis:
    tickAmount: 10
    decimalsInFloat: 2

Great idea. Is there a way how to add multiple annotations … e.g. every midnight?

@mmo Did you ever manage to add “midnight annotations”?

Is it possible to change the “Loading” text when waiting for data or when there is no data?
Thanks!

No luck. I don’t think point annotations are implemented yet.

Found an easy way to add conditional annotations!

apex_config:
  yaxis:
    - min: 0
      max: |
        EVAL:function (max) {
          window.chart_max= (Math.round(max*2)/2) + 0.5;
          return window.chart_max;
        }
  annotations:
    position: back
    yaxis:
      - 'y': 1
        label:
          text: 'EVAL:(window.chart_max > 1 ? ''label'' : '''')'
          style:
            background: '#666'
            color: '#FFF'
        borderColor: 'EVAL:(window.chart_max > 1 ? ''#000'' : ''none'')'

– Ingrid

Does anyone have the sensor code used in the example at the data_generator, the sensor is called “sensor.test”?

I am just now realising this could replace the use of custom:config-template-card.
Instead of using ${states['sun.sun'].state}, you could use EVAL: String(document.getElementsByTagName('home-assistant')[0].hass.states['sun.sun'].state). :slight_smile:

– Ingrid

1 Like

To be honest, Your question sounds very “stupid” , sorry for my way of saying … fact is the(his) sensors name is named below , And the “outcome” from his test-sensor is above.

But to your question i think you wonder how/what “your” sensor deliver ( so you can query it correctly ) … IF so

  1. Copy the name of your sensor
  2. Click on left meny / Developer Tools / states
  3. Paste your entity-name ( filter entities )

Then you will see , current state, And the sensors attributes , sometimes in the form of an array/list

My sensor for now display’s this as attribute.

values:
  - - 1677628800
    - 7.3
  - - 1677715200
    - 6.6

Maybe it’s for you clearly how his test sensor works, but not for me. If i can make a sensor with the same output, i can try to understood how it works.

Nope , sorry i have no idea, looks like a temperature-sensor, but could be anything with 2 Values (7.3 / 6.6) and 2 “timestamps”

There you go again. Now calling others stupid. Eventhough you make a valid factual point, calling people names does not help. It doesn’t make you look smarter. Stop, just stop.

I do think i said " It was a stupid question " , beside that i wont got into polemic with you

“There are no stupid questions”.

I’m going to try to split the data into 2 attributes just like the example.

In The example he takes "the Value @ a certain DateTime, what you see in his result is the 3 first values( or last ) and the DateTime(in future) is transformed to a “timestamp” ( i dont see where he splits the data in 2 attributes . In the example he has PEAK ( peak-time/peak-value ) And thats what his sensor deliver ( most likely from factory-settings )
However what you show above is Not DateTime, i’ts already a “timestamp” … so my thought is this does not comes from your sensor, but it’s something maybe you already tried to “transform”

Yeah, i make from the date (2023-03-01T00:00:00Z) a timestamp, can in seconds also in miliseconds.

He is not splitting the data in 2 attributes, his data is already in 2 attributes.

The data of me is now 1 attribute, i think i have to split it up, to make 2 attributes like the example.

ahh, still struggling with old data from DB ? , not realtime-sensor, or future-values ?

Do you have a solar_production_sensor, that writes to your DB ? , and is this sensor

then try this in Developer-tools

PS: i assume you are aware that the example for data-generator is for future-values

The best hint i can give you is to look at your local-weather-forecast-entity, or future(tomorrows) electricity-price-entity

Yeah, still struggling, the code that other people use to generate a chart doesn’t work for me.
Don’t know why, but is says always Loading…

Sorry, missed your reply. After two hours of testing i realized that I didn’t have an upper case “O” in plotOptions and that was the issue. Happy times :laughing:

Unfortunately my way of stacking them to be able to have a different colour and data label of the current hour messed up the borderRadius effect :confused:

There is an issue regarding this problem.

Stacked bar chart

However, before giving up, try these options first.

    plotOptions: 
        bar: 
          horizontal: false
          borderRadius: 5
          borderRadiusApplication: end
          borderRadiusWhenStacked: all

or this

    plotOptions: 
        bar: 
          horizontal: false
          borderRadius: 
              -  5
              -  5
          borderRadiusApplication: end
          borderRadiusWhenStacked: all
2 Likes