tradingview / lightweight-charts

Performant financial charts built with HTML5 canvas
https://www.tradingview.com/lightweight-charts/
Apache License 2.0
9.52k stars 1.63k forks source link

textAlign in PriceScaleOptions #1007

Closed GaZaTu closed 2 years ago

GaZaTu commented 2 years ago

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

It bothers me that numbers aren't correctly aligned on the price axis (e.g. 100 and 90_ instead of 100 and _90).

Describe the solution you'd like

I'd like to be able to align tick mark labels in the price axis to the right (which is how numbers are formatted in german for example).

Additional context

Adding ctx.textAlign = 'right' in front of https://github.com/tradingview/lightweight-charts/blob/a9041d5d4e8a5aa2909f99a580d73c747c83b0fa/src/gui/labels-image-cache.ts#L95 did obviously not produce the desired result as it probably conflicts with the textWidth calculations and shit so i have no idea how to fix this myself.

Capture Snap of the issue

timocov commented 2 years ago

Hi @GaZaTu,

could you provide any examples of financial charts where you saw such alignment? I just tried several of them and it seems that everywhere it is the same like we have now.

GaZaTu commented 2 years ago

uhhh ngl I don't understand what you mean. 😅 But if you mean the series type i used, then it's the area series.

Btw you can see the same behavior in the documentation: https://tradingview.github.io/lightweight-charts/docs/series-types#histogram (12M and 8M_)

timocov commented 2 years ago

@GaZaTu Sorry for confusing. You said that

It bothers me that numbers aren't correctly aligned on the price axis (e.g. 100 and 90_ instead of 100 and _90).

So I'm asking did you ever seen this type of alignment in any other financials charts? We tried several other charts and everywhere we saw the same alignment as we have right now, i.e. 100 and 90_ from your examples. I'm asking this question because I want to understand whether it is an often case to have an alignment as you described or it's the only your request.

GaZaTu commented 2 years ago

Oh i get it now. No i don't use any other charting libraries or any financial tooling really. This is just a personal request. 😋

timocov commented 2 years ago

I see. Well, I'm afraid since we don't have examples and it seems that the solution we have is kind of widely-known and used almost everywhere and it seems that no one asked for that previously (e.g. on tradingview.com) we aren't going to implement this so I'm going to close the issue.

GaZaTu commented 2 years ago

Can i still submit a PR to add this feature or are you not gonna implement it period?

timocov commented 2 years ago

@GaZaTu I don't think that this feature fits our understanding of the product and its requirements/features, so I'm afraid we aren't going to implement it nor merge a pull with the changes for it.