shadeed / rtl-styling

An extensive guide on how to style for RTL in CSS
https://rtlstyling.com/
MIT License
366 stars 21 forks source link

Charts and data vizualisation #30

Open ffoodd opened 1 year ago

ffoodd commented 1 year ago

Hi there!

Back to RTL topic, I'm currently implementing RTL in chaarts and decided for some kind of charts to not flip them. Here're my thoughts:

FWIW, there're some edge cases regarding RTL in CSS which are bit weird to me, mostly clip-path and transform which keeps referring to top left as a starting point. There might be others, as well.

If you have any insight regarding this, I'd be pleased to know :)

shadeed commented 1 year ago

Hello hello! :)

The charts is an interesting topic to be covered on RTL Styling 101. I agree with your point on the circular charts, no need to flip them. But for the data-relative (like tables), flipping is needed.

FWIW, there're some edge cases regarding RTL in CSS which are bit weird to me, mostly clip-path and transform which keeps referring to top left as a starting point. There might be others, as well.

Would you share an example? If I got your point, that means that in a chart that uses clip-path, top-left needs to be flipped in RTL.

ffoodd commented 1 year ago

Here's an example in chaarts: https://ffoodd.github.io/chaarts/line-charts.html (WIP so might change or not work).

FWIW the simplest way to handle clip-path I could find is to use transform: scale(-1). Works fine in my case!

I suppose JS-based SVG charts can handle this in different ways, though.

shadeed commented 1 year ago

Totally agree. Using scale(-1) is a good fix and it works perfectly with CSS.

Thanks for shedding the light on this topic! I will research more and try to include it in a future update.