Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Price axis doesn't respect the width of crosshair label #834

Closed
thanhlmm opened this issue Sep 6, 2021 · 3 comments · Fixed by #836
Closed

Price axis doesn't respect the width of crosshair label #834

thanhlmm opened this issue Sep 6, 2021 · 3 comments · Fixed by #836
Assignees
Labels
bug Unexpected problem or unintended behavior.
Milestone

Comments

@thanhlmm
Copy link

thanhlmm commented Sep 6, 2021

Lightweight Charts Version: 3.5.0

Steps/code to reproduce:

  priceFormat: {
    type: "custom",
    minMove: 0.00000001,
    formatter: (price) => {
      return window.numeral(price).format("0.[000]") + "USD";
    }
  }

numeral is a lib to format number

Actual behavior:

Screen Shot 2021-09-06 at 20 25 31

Expected behavior:

The axis will show enough space for the label

Screenshots:

CodeSandbox/JSFiddle/etc link:
https://codesandbox.io/s/axis-number-width-qve8d?file=/index.html
You will need Open in New window to check it

@thanhlmm
Copy link
Author

thanhlmm commented Sep 6, 2021

Propose solution:

Currently, the chart width is determined by the length of Min and Max label. So I think it better to check width by all mark label visible + a medium point (min + max)/2

@timocov
Copy link
Contributor

timocov commented Sep 6, 2021

Hi there, it seems that we already fixed this on tradingview.com, I'll migrate a fix to lightweight-charts soon.

@timocov timocov added the bug Unexpected problem or unintended behavior. label Sep 6, 2021
@timocov timocov added this to the 3.6 milestone Sep 6, 2021
@timocov timocov self-assigned this Sep 6, 2021
@thanhlmm
Copy link
Author

thanhlmm commented Sep 7, 2021

Sound great

timocov added a commit that referenced this issue Sep 7, 2021
@timocov timocov changed the title Sometime the price axis is not big enough Price axis doesn't respect the width of crosshair label Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior.
Projects
None yet
2 participants