apexcharts-card icon indicating copy to clipboard operation
apexcharts-card copied to clipboard

Change order of series labels in the legend

Open wigster opened this issue 3 years ago • 5 comments

Checklist

  • [x] I am running the latest version of the card
  • [x] I checked if there isn't another feature request opened with the same request
  • [x] I checked that the feature is not already available in the dev branch

Is your feature request related to a problem? Please describe.

I am drawing area plots one on top of the other, with yesterday's data ("wczoraj") with low opacity. I want this series to be drawn behind the series with today's data ("dziÅ›"), so it must be defined first in the YAML. This now means that in the legend, the less important series is listed first. This is a bit OCD, of course, but it would be nice to be able to reverse the legend.

image

wigster avatar Mar 02 '21 14:03 wigster

Thanks for opening this issue. Unfortunately, this is how the library I use (ApexCharts) works. There's nothing I can do, sorry.

RomRider avatar Mar 02 '21 14:03 RomRider

Maybe you can have a look at https://apexcharts.com/docs/options/legend/#inverseOrder .

DominicWindisch avatar Nov 25 '21 22:11 DominicWindisch

Appreciate this is an old issue! But was there a way to use that inverseOrder option found? Thanks!

gapthorpe avatar Jul 23 '23 17:07 gapthorpe

Appreciate this is an old issue! But was there a way to use that inverseOrder option found? Thanks!

Well, yes. Add any option you need in the apex_config section. E.g.

type: custom:apexcharts-card
header:
  show: true
  title: my chart
  standard_format: true
series:
  - entity: sensor.xxx
    name: xx
apex_config:
  legend:
    position: bottom
    inverseOrder: true
  chart:
    height: 123px

DominicWindisch avatar Jul 23 '23 17:07 DominicWindisch

Ah that is brilliant, thanks so much for the quick answer!

just to check, is there any option to change order in the header as well?

gapthorpe avatar Jul 23 '23 18:07 gapthorpe