ApexCharts card - A highly customizable graph card

I tried with font-size and didn’t get it to work but font-family works just fine. Can you see why font-size isn’t working?

type: 'custom:apexcharts-card'
header:
  title: Elpriset idag & imorgon
  show: true
graph_span: 2d
span:
  start: day
now:
  show: true
  color: orange
apex_config:
  label: Now
  grid:
    show: true
    borderColor: '#404040'
    strokeDashArray: 3
    position: back
  yaxis:
    min: 0
    forceNiceScale: true
    labels:
      style:
        fontSize: 10px
        fontFamily: Segoe UI Light
  xaxis:
    axisBorder:
      show: false
    labels:
      style:
        fontSize: 10px
        fontFamily: Segoe UI Light
  chart:
    height: 225
  legend:
    show: false
  dataLabels:
    enabled: false
  stroke:
    width: 1
  fill:
    type: gradient
    gradient:
      shadeIntensity: 0.8
      inverseColors: true
      opacityFrom: 0.7
      opacityTo: 0.2
      stops:
        - 20
series:
  - entity: sensor.nordpool_kwh_se3_sek_3_095_025
    name: Idag
    type: area
    color: 3ca358
    extend_to_end: false
    show:
      legend_value: true
    data_generator: |
      return entity.attributes.raw_today.map((entry) => {
        return [new Date(entry.start), entry.value];
      });
  - entity: sensor.nordpool_kwh_se3_sek_3_095_025
    name: Imorgon
    type: area
    color: a3a3a3
    show:
      legend_value: false
    data_generator: |
      return entity.attributes.raw_tomorrow.map((entry) => {
        return [new Date(entry.start), entry.value];
      });
style: |
  ha-card {
     --ha-card-background: rgba(0, 0, 0, 0);
     box-shadow: none;
     margin: 8px;
     font-size: 20px;
     font-family: Segoe UI Light;
   }

div#header__title {
  font-size: 30px;
}

add that under style

1 Like

Thank you! Finally got it as clean as I wanted!

Btw, very nice looking card you got there!

Edit:
Do you see a reason why font-weight wouldn’t work there? I tried to use a font that isn’t available on my phone and that didn’t work (without work-arounds), but font-weight should work, right?

  ha-card {
     --ha-card-background: rgba(0, 0, 0, 0);
     box-shadow: none;
     margin: 8px 8px 18px 8px;
     font-size: 15px;
     text-align: center;
     font-weight: 250;
     font-family: Segoe Ui Light;
   }
   div#header__title {
     font-size: 15px;
     font-weight: 250;
     font-family: Segoe Ui Light;
   }

It works under the header. It starts at 500 so maybe there isn’t much of a noticeable difference going down to 250 based on your font. I put 900 in on one of mine just to try and it definitely changes a header title to bold.

Strange that I cna’t get it to work. Do you do it like this?

   div#header__title {
     font-size: 15px;
     font-weight: 900;
   }

Hi All,

I love this add-on so much !!! Really nice and lots of options.
Schermafbeelding 2021-02-18 om 08.50.06

Is it possible to move this part to upper right corner?
Now my graph is mixed with the buttons. Its a cosmetic thing …:

Schermafbeelding 2021-02-18 om 08.51.59

apex_config:
  chart:
    height: 300px
    zoom:
      enabled: true
    toolbar:
      show: true
      tools:
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true

And is there a way to get candlesticks graph?

You can use offsetX and offsetY, for example

toolbar:
  show: true
  offsetX: 0
  offsetY: -25
1 Like

I become every minute more and more happier :smiley:

Not yet, but I was thinking about adding it, I just need to find time to work on it :slight_smile:

1 Like

It does. Make sure cache is cleared is all I can think of. Using just this changes a title on my side. First picture is at 200 second at 900

              style: |
                div#header__title {
                  font-size: 15px;
                  font-weight: 900;
                  font-family: Segoe Ui Light;
                }  

Home_Assistant_-_2021-02-18_07.34.48 Home_Assistant_-_2021-02-18_07.35.34

Ah, so yes, I can get that to work but I was trying to get the header states to change (temperature at the very top). I’ll do some digging in the code to find that div, just assumed it was the same since the font_size changed.

if you inspect the page (control - shift - i), it looks like this is what you need to add under style

#state__value > #state {

1 Like

I tried the #state__value before and now also your code but not getting anything to work, even downloaded a new browser to make sure the cache was empty :slight_smile:

Never mind, sorry for taking your time and hijacking this thread.

Two questions that I haven’t been able to find answers to.

Is it possible to not show any decimaals in the header?

Can there be a line along the x-axis as I have drawn (the white line) and still have it very minimal at the bottom where the date/time is shown as in my example below?

Can a line/area/column be hidden if the value is zero, so that the line doesn’t end up as the orange line below?

Will it be possible to use attribute of a entity as sensor without creating a sensor that extract from a rest sensor:

sensor.bitladon_ada
state: 0.74905 

attributes
ticker: ADA 
name: Cardano 
buyfinal: 0.78274 
change24h: -0.91 
friendly_name: Bitladon ADA 
templates: icon_color: 'if (state === ''on'') return ''rgba(251,214,67,1)''; return ''rgba(71,116,157,1)'';' icon_color: rgba(71,116,157,1)

Now I use sensor.bitladon_ada to get the sell price
But want add a second sensor part:

sensor.bitladon_ada.attributes. buyfinal

to show them both in graph.

If not possible, will it a idea to support this so you can add attributes directly in graph

It’s already available, read the documentation on github :slight_smile:

1 Like

Yes, with float_precision: 0 in each serie

You can probably do something with annotations

You could use transform to remove data with a value of 0 (return x === 0 ? null : x;)

1 Like

I have a problem with a column chart, i have today 3 times the same values, but only the first bar is displayed en the other 2 not.
This is my config:

type: 'custom:apexcharts-card'
graph_span: 1d
span:
  end: day
header:
  show: true
  title: Verbuik gas per uur m3
apex_config:
  chart:
    height: 250
  stroke:
    width: 4
series:
  - entity: sensor.hourly_gas_consumption
    float_precision: 3
    type: column
    group_by:
      duration: 1h

2021-02-19_16h17_22

how can i solve this?

With group_by, if there is no state change (in the history) during that period of time, it will report null as a value giving you that result.