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

Format left price scale #1328

Closed
daniel-zero opened this issue Apr 8, 2023 · 3 comments · Fixed by #1337
Closed

Format left price scale #1328

daniel-zero opened this issue Apr 8, 2023 · 3 comments · Fixed by #1337
Labels
enhancement Feature requests, and general improvements. needs investigation Needs further investigation. polish Very minor behavior improvement that users will enjoy.

Comments

@daniel-zero
Copy link

daniel-zero commented Apr 8, 2023

I'd like to format the percentage labels of the left price scale. Currently it is not possible to format the rendered label values. I can only format the right price scale. But maybe I'm missing something.

I want to remove the last two digits of the percentage value.

      leftPriceScale: {
        visible: true,
        mode: PriceScaleMode.Percentage,
        borderVisible: false,
      },
    this._percentage = this._chart.addLineSeries({
      priceScaleId: 'left',
      color: 'rgba(92, 163, 239, 0)',
      baseLineVisible: false,
      priceLineVisible: false,
      lastValueVisible: false,
      priceFormat: {
        type: 'custom',
        formatter: (price: number) => {
          return `${price.toFixed(0)}%`;
        },
      },
    });
@SlicedSilver
Copy link
Contributor

Using a custom price formatter with a percentage price scale is limited at the moment, and something that we should look into improving for the library.

Related issue: #1291

@SlicedSilver SlicedSilver added enhancement Feature requests, and general improvements. needs investigation Needs further investigation. polish Very minor behavior improvement that users will enjoy. labels Apr 9, 2023
@daniel-zero
Copy link
Author

@SlicedSilver can you give me a time-box for the next release containing the formatting feature? I'm asking because our product release depends on this feature.

@SlicedSilver
Copy link
Contributor

This has been merged in master, so if you would like to use this now (before we release our next update) then you can download the repo and build your own version of the library.

The steps to build the library are:

  1. Download / Clone the repo
  2. npm install
  3. npm run build:prod
  4. locate the built files in the dist folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, and general improvements. needs investigation Needs further investigation. polish Very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants